sohamchitimali commited on
Commit
7ce3771
·
1 Parent(s): d237a5a

Model Changes

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -1301,14 +1301,19 @@ with gr.Blocks(
1301
  # Configure for deployment
1302
  demo.queue(max_size=20)
1303
 
1304
- # Mount Gradio on FastAPI
1305
  app = gr.mount_gradio_app(api_app, demo, path="/")
1306
 
 
1307
  if __name__ == "__main__":
1308
- demo.launch(
1309
- server_name="0.0.0.0",
1310
- server_port=7860,
1311
- share=False,
1312
- show_error=True,
1313
- max_threads=10
1314
- )
 
 
 
 
 
1301
  # Configure for deployment
1302
  demo.queue(max_size=20)
1303
 
1304
+ # Mount Gradio on FastAPI. This `app` object is what we will run.
1305
  app = gr.mount_gradio_app(api_app, demo, path="/")
1306
 
1307
+ # Use this block to run the app correctly with Uvicorn
1308
  if __name__ == "__main__":
1309
+ print("Starting server with Uvicorn...")
1310
+
1311
+ # This is the correct way to run your combined app.
1312
+ # It uses the `app` object we created above and allows `root_path` to work.
1313
+ # We have REMOVED demo.launch().
1314
+ uvicorn.run(
1315
+ app,
1316
+ host="0.0.0.0",
1317
+ port=7860,
1318
+ root_path="/" # This is the crucial setting for deployment
1319
+ )