Spaces:
Running
Running
openhands commited on
Commit ·
9ba6edb
1
Parent(s): 14690be
Remove conflicting server-side redirect
Browse filesThe JavaScript redirect_script already handles / -> /home redirection.
The server-side redirect was causing issues with the proxy.
app.py
CHANGED
|
@@ -380,18 +380,13 @@ logger.info("All routes configured")
|
|
| 380 |
|
| 381 |
# Mount the REST API on /api
|
| 382 |
from fastapi import FastAPI
|
| 383 |
-
from fastapi.responses import RedirectResponse
|
| 384 |
from api import api_app
|
| 385 |
|
| 386 |
# Create a parent FastAPI app that will host both the API and Gradio
|
| 387 |
root_app = FastAPI()
|
| 388 |
root_app.mount("/api", api_app)
|
| 389 |
|
| 390 |
-
#
|
| 391 |
-
@root_app.get("/", include_in_schema=False)
|
| 392 |
-
async def root_redirect():
|
| 393 |
-
return RedirectResponse(url="/home")
|
| 394 |
-
|
| 395 |
app = gr.mount_gradio_app(root_app, demo, path="/")
|
| 396 |
logger.info("REST API mounted at /api, Gradio app mounted at /")
|
| 397 |
|
|
|
|
| 380 |
|
| 381 |
# Mount the REST API on /api
|
| 382 |
from fastapi import FastAPI
|
|
|
|
| 383 |
from api import api_app
|
| 384 |
|
| 385 |
# Create a parent FastAPI app that will host both the API and Gradio
|
| 386 |
root_app = FastAPI()
|
| 387 |
root_app.mount("/api", api_app)
|
| 388 |
|
| 389 |
+
# Mount Gradio app - the JavaScript redirect_script handles / -> /home
|
|
|
|
|
|
|
|
|
|
|
|
|
| 390 |
app = gr.mount_gradio_app(root_app, demo, path="/")
|
| 391 |
logger.info("REST API mounted at /api, Gradio app mounted at /")
|
| 392 |
|