elix3r commited on
Commit
92a1db7
·
verified ·
1 Parent(s): 6810476

Upload folder using huggingface_hub

Browse files
server/app.py CHANGED
@@ -347,10 +347,11 @@ async def scalar_ui(request: Request) -> HTMLResponse: # noqa: ARG001
347
  return HTMLResponse(_SCALAR_HTML)
348
 
349
 
350
- @app.get("/", include_in_schema=False)
351
- async def root_ui() -> RedirectResponse:
352
- """Use the task-oriented Gradio workspace as the default Space landing page."""
353
- return RedirectResponse(url="/ui")
 
354
 
355
 
356
  @app.get("/healthz", response_model=HealthResponse)
@@ -528,7 +529,7 @@ async def analyze_ingestion(request: AnalyzeIngestionRequest) -> AnalyzeIngestio
528
 
529
 
530
  _gradio_workspace = build_gradio_workspace()
531
- app = gr.mount_gradio_app(app, _gradio_workspace, path="/ui")
532
 
533
 
534
  def main() -> None:
 
347
  return HTMLResponse(_SCALAR_HTML)
348
 
349
 
350
+ @app.get("/ui", include_in_schema=False)
351
+ @app.get("/ui/", include_in_schema=False)
352
+ async def legacy_ui_path() -> RedirectResponse:
353
+ """Backwards-compatible redirect from the old /ui path to the root page."""
354
+ return RedirectResponse(url="/")
355
 
356
 
357
  @app.get("/healthz", response_model=HealthResponse)
 
529
 
530
 
531
  _gradio_workspace = build_gradio_workspace()
532
+ app = gr.mount_gradio_app(app, _gradio_workspace, path="/")
533
 
534
 
535
  def main() -> None:
tests/smoke/test_ingestion_api.py CHANGED
@@ -34,18 +34,19 @@ def test_health_endpoint_returns_status():
34
  assert payload["status"] in {"ok", "healthy"}
35
 
36
 
37
- def test_root_redirects_to_gradio_ui():
38
- response = client.get("/", follow_redirects=False)
39
 
40
- assert response.status_code in {302, 307}
41
- assert response.headers["location"].startswith("/ui")
 
42
 
43
 
44
- def test_gradio_ui_is_reachable():
45
- response = client.get("/ui/", follow_redirects=True)
46
 
47
- assert response.status_code == 200
48
- assert "text/html" in response.headers.get("content-type", "")
49
 
50
 
51
  def test_healthz_endpoint_returns_versioned_ok():
 
34
  assert payload["status"] in {"ok", "healthy"}
35
 
36
 
37
+ def test_root_serves_gradio_ui():
38
+ response = client.get("/", follow_redirects=True)
39
 
40
+ assert response.status_code == 200
41
+ assert "text/html" in response.headers.get("content-type", "")
42
+ assert "TalkingHeadBench Workspace" in response.text
43
 
44
 
45
+ def test_legacy_ui_path_redirects_to_root():
46
+ response = client.get("/ui/", follow_redirects=False)
47
 
48
+ assert response.status_code in {302, 307}
49
+ assert response.headers.get("location") == "/"
50
 
51
 
52
  def test_healthz_endpoint_returns_versioned_ok():