Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- server/app.py +5 -6
- server/gradio_ui.py +1 -1
- tests/smoke/test_ingestion_api.py +9 -9
server/app.py
CHANGED
|
@@ -347,11 +347,10 @@ async def scalar_ui(request: Request) -> HTMLResponse: # noqa: ARG001
|
|
| 347 |
return HTMLResponse(_SCALAR_HTML)
|
| 348 |
|
| 349 |
|
| 350 |
-
@app.get("/
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
return RedirectResponse(url="/")
|
| 355 |
|
| 356 |
|
| 357 |
@app.get("/healthz", response_model=HealthResponse)
|
|
@@ -529,7 +528,7 @@ async def analyze_ingestion(request: AnalyzeIngestionRequest) -> AnalyzeIngestio
|
|
| 529 |
|
| 530 |
|
| 531 |
_gradio_workspace = build_gradio_workspace()
|
| 532 |
-
app = gr.mount_gradio_app(app, _gradio_workspace, path="/")
|
| 533 |
|
| 534 |
|
| 535 |
def main() -> None:
|
|
|
|
| 347 |
return HTMLResponse(_SCALAR_HTML)
|
| 348 |
|
| 349 |
|
| 350 |
+
@app.get("/", include_in_schema=False)
|
| 351 |
+
async def root_ui() -> RedirectResponse:
|
| 352 |
+
"""Serve the task-oriented UI on the default /web landing surface."""
|
| 353 |
+
return RedirectResponse(url="/web/")
|
|
|
|
| 354 |
|
| 355 |
|
| 356 |
@app.get("/healthz", response_model=HealthResponse)
|
|
|
|
| 528 |
|
| 529 |
|
| 530 |
_gradio_workspace = build_gradio_workspace()
|
| 531 |
+
app = gr.mount_gradio_app(app, _gradio_workspace, path="/web")
|
| 532 |
|
| 533 |
|
| 534 |
def main() -> None:
|
server/gradio_ui.py
CHANGED
|
@@ -171,7 +171,7 @@ def build_gradio_workspace() -> gr.Blocks:
|
|
| 171 |
"without opening API docs."
|
| 172 |
)
|
| 173 |
gr.Markdown(
|
| 174 |
-
"Useful links: [/docs](/docs) for API reference, [/
|
| 175 |
)
|
| 176 |
|
| 177 |
with gr.Tabs():
|
|
|
|
| 171 |
"without opening API docs."
|
| 172 |
)
|
| 173 |
gr.Markdown(
|
| 174 |
+
"Useful links: [/docs](/docs) for API reference, [/openapi.json](/openapi.json) for raw schema."
|
| 175 |
)
|
| 176 |
|
| 177 |
with gr.Tabs():
|
tests/smoke/test_ingestion_api.py
CHANGED
|
@@ -34,19 +34,19 @@ def test_health_endpoint_returns_status():
|
|
| 34 |
assert payload["status"] in {"ok", "healthy"}
|
| 35 |
|
| 36 |
|
| 37 |
-
def
|
| 38 |
-
response = client.get("/", follow_redirects=
|
| 39 |
|
| 40 |
-
assert response.status_code
|
| 41 |
-
assert
|
| 42 |
-
assert "TalkingHeadBench Workspace" in response.text
|
| 43 |
|
| 44 |
|
| 45 |
-
def
|
| 46 |
-
response = client.get("/
|
| 47 |
|
| 48 |
-
assert response.status_code
|
| 49 |
-
assert response.headers.get("
|
|
|
|
| 50 |
|
| 51 |
|
| 52 |
def test_healthz_endpoint_returns_versioned_ok():
|
|
|
|
| 34 |
assert payload["status"] in {"ok", "healthy"}
|
| 35 |
|
| 36 |
|
| 37 |
+
def test_root_redirects_to_web_surface():
|
| 38 |
+
response = client.get("/", follow_redirects=False)
|
| 39 |
|
| 40 |
+
assert response.status_code in {302, 307}
|
| 41 |
+
assert response.headers.get("location") == "/web/"
|
|
|
|
| 42 |
|
| 43 |
|
| 44 |
+
def test_web_surface_serves_gradio_ui():
|
| 45 |
+
response = client.get("/web/", follow_redirects=True)
|
| 46 |
|
| 47 |
+
assert response.status_code == 200
|
| 48 |
+
assert "text/html" in response.headers.get("content-type", "")
|
| 49 |
+
assert "TalkingHeadBench Workspace" in response.text
|
| 50 |
|
| 51 |
|
| 52 |
def test_healthz_endpoint_returns_versioned_ok():
|