m7n commited on
Commit
b3a9c9a
·
1 Parent(s): 5460b58

remove fastapi, revert to gradio fileserving (?)

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -70,13 +70,7 @@ pyalex.config.email = "[email protected]"
70
 
71
  print(f"Imports completed: {time.strftime('%Y-%m-%d %H:%M:%S')}")
72
 
73
- # FastAPI setup
74
- app = FastAPI()
75
- static_dir = Path('./static')
76
- static_dir.mkdir(parents=True, exist_ok=True)
77
- app.mount("/static", StaticFiles(directory=static_dir), name="static")
78
-
79
- # Gradio configuration
80
  gr.set_static_paths(paths=["static/"])
81
 
82
  # Resource configuration
@@ -652,10 +646,10 @@ with gr.Blocks(theme=theme, css="""
652
 
653
 
654
  # Mount and run app
655
- app = gr.mount_gradio_app(app, demo, path="/",ssr_mode=False)
656
 
657
- app.zerogpu = True # Add this line
658
 
659
 
660
  if __name__ == "__main__":
661
- uvicorn.run(app, host="0.0.0.0", port=7860)
 
70
 
71
  print(f"Imports completed: {time.strftime('%Y-%m-%d %H:%M:%S')}")
72
 
73
+ # Instead of FastAPI setup, just use Gradio's file serving
 
 
 
 
 
 
74
  gr.set_static_paths(paths=["static/"])
75
 
76
  # Resource configuration
 
646
 
647
 
648
  # Mount and run app
649
+ # app = gr.mount_gradio_app(app, demo, path="/",ssr_mode=False)
650
 
651
+ # app.zerogpu = True # Add this line
652
 
653
 
654
  if __name__ == "__main__":
655
+ demo.launch(server_name="0.0.0.0", server_port=7860)