NinjainPJs Claude Opus 4.6 (1M context) commited on
Commit
b014e33
·
1 Parent(s): a34068e

Fix: mount Gradio at root path for HF Spaces compatibility

Browse files

HF Spaces proxies through iframe - the /ui redirect was causing blank screen.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Files changed (2) hide show
  1. app/main.py +2 -7
  2. app/ui/gradio_app.py +1 -1
app/main.py CHANGED
@@ -63,13 +63,8 @@ app.include_router(health.router)
63
  app.include_router(ingest.router)
64
  app.include_router(query.router)
65
 
66
- # Mount Gradio UI
67
  from app.ui.gradio_app import create_gradio_app
68
 
69
  gradio_app = create_gradio_app()
70
- app = gr.mount_gradio_app(app, gradio_app, path="/ui")
71
-
72
-
73
- @app.get("/", include_in_schema=False)
74
- async def root():
75
- return RedirectResponse(url="/ui")
 
63
  app.include_router(ingest.router)
64
  app.include_router(query.router)
65
 
66
+ # Mount Gradio UI at root
67
  from app.ui.gradio_app import create_gradio_app
68
 
69
  gradio_app = create_gradio_app()
70
+ app = gr.mount_gradio_app(app, gradio_app, path="/")
 
 
 
 
 
app/ui/gradio_app.py CHANGED
@@ -6,7 +6,7 @@ import httpx
6
 
7
  logger = logging.getLogger(__name__)
8
 
9
- API_BASE = "http://localhost:7860"
10
 
11
  CUSTOM_CSS = """
12
  .main-header {
 
6
 
7
  logger = logging.getLogger(__name__)
8
 
9
+ API_BASE = "http://127.0.0.1:7860"
10
 
11
  CUSTOM_CSS = """
12
  .main-header {