sohamchitimali commited on
Commit
d6beeea
·
1 Parent(s): f1d6968

Added Uvicorn

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -1308,13 +1308,16 @@ app = gr.mount_gradio_app(api_app, demo, path="/")
1308
  # Use this block to run the app correctly with Uvicorn
1309
  if __name__ == "__main__":
1310
  print("Starting server with Uvicorn...")
 
 
 
 
1311
 
1312
- # This is the correct way to run your combined app.
1313
- # It uses the `app` object we created above and allows `root_path` to work.
1314
- # We have REMOVED demo.launch().
1315
  uvicorn.run(
1316
  app,
1317
  host="0.0.0.0",
1318
  port=7860,
1319
- root_path="/" # This is the crucial setting for deployment
1320
- )
 
1308
  # Use this block to run the app correctly with Uvicorn
1309
  if __name__ == "__main__":
1310
  print("Starting server with Uvicorn...")
1311
+
1312
+ # Read the ROOT_PATH from an environment variable.
1313
+ # Default to "/" if the variable is not set (for local testing).
1314
+ root_path = os.getenv("ROOT_PATH", "/")
1315
 
1316
+ print(f"Using root_path: {root_path}") # Add a log to see what's being used
1317
+
 
1318
  uvicorn.run(
1319
  app,
1320
  host="0.0.0.0",
1321
  port=7860,
1322
+ root_path=root_path # <-- Use the dynamically determined root_path
1323
+ )