qqwjq1981 commited on
Commit
1d89e22
·
verified ·
1 Parent(s): edadb68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1132,7 +1132,7 @@ def create_gradio_interface(state=None):
1132
  # In[21]:
1133
  demo = create_gradio_interface()
1134
  # Use Gradio's `server_app` to get an ASGI app for Blocks
1135
- gradio_asgi_app = gr.routes.App.create_app(demo, server_path="/gradio")
1136
 
1137
  logging.debug(f"Gradio version: {gr.__version__}")
1138
  logging.debug(f"FastAPI version: {fastapi.__version__}")
@@ -1152,7 +1152,9 @@ else:
1152
  # Redirect from the root endpoint to the Gradio app
1153
  @app.get("/", response_class=RedirectResponse)
1154
  async def index():
1155
- return RedirectResponse(url="/gradio", status_code=307)
 
 
1156
 
1157
  # Run the FastAPI server using uvicorn
1158
  if __name__ == "__main__":
 
1132
  # In[21]:
1133
  demo = create_gradio_interface()
1134
  # Use Gradio's `server_app` to get an ASGI app for Blocks
1135
+ gradio_asgi_app = gr.routes.App.create_app(demo)
1136
 
1137
  logging.debug(f"Gradio version: {gr.__version__}")
1138
  logging.debug(f"FastAPI version: {fastapi.__version__}")
 
1152
  # Redirect from the root endpoint to the Gradio app
1153
  @app.get("/", response_class=RedirectResponse)
1154
  async def index():
1155
+ return {"message": "FastAPI is running. Visit /gradio for the Gradio interface."}
1156
+
1157
+ # return RedirectResponse(url="/gradio", status_code=307)
1158
 
1159
  # Run the FastAPI server using uvicorn
1160
  if __name__ == "__main__":