Spaces:
Running

mgokg commited on
Commit
87ca708
·
verified ·
1 Parent(s): a470e65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -378,8 +378,12 @@ with gr.Blocks() as demo:
378
 
379
  # Mount Gradio into FastAPI. Routes defined on `api` above take
380
  # precedence over the mount at "/".
381
-
 
 
 
382
 
383
 
384
  if __name__ == "__main__":
385
- app = gr.mount_gradio_app(api, demo, path="/", ssr_mode=False)
 
 
378
 
379
  # Mount Gradio into FastAPI. Routes defined on `api` above take
380
  # precedence over the mount at "/".
381
+ # Mount Gradio into FastAPI (module level, so `app` exists for
382
+ # both `python app.py` and `uvicorn app:app`). Routes defined on
383
+ # `api` above take precedence over the mount at "/".
384
+ app = gr.mount_gradio_app(api, demo, path="/", ssr_mode=False)
385
 
386
 
387
  if __name__ == "__main__":
388
+ port = int(os.environ.get("PORT", 7860))
389
+ uvicorn.run(app, host="0.0.0.0", port=port)