Upload folder using huggingface_hub
Browse files- gridops/server/app.py +10 -6
gridops/server/app.py
CHANGED
|
@@ -104,15 +104,19 @@ def list_tasks():
|
|
| 104 |
# ── Root redirect to dashboard ───────────────────────────────────────────
|
| 105 |
|
| 106 |
@app.get("/")
|
| 107 |
-
def
|
| 108 |
-
"""
|
| 109 |
-
|
|
|
|
|
|
|
| 110 |
|
| 111 |
|
| 112 |
@app.get("/web")
|
| 113 |
-
def
|
| 114 |
-
"""
|
| 115 |
-
|
|
|
|
|
|
|
| 116 |
|
| 117 |
|
| 118 |
# ── Serve dashboard static files ────────────────────────────────────────
|
|
|
|
| 104 |
# ── Root redirect to dashboard ───────────────────────────────────────────
|
| 105 |
|
| 106 |
@app.get("/")
|
| 107 |
+
def root_serve():
|
| 108 |
+
"""Serve dashboard directly at root so HF Space iframe shows the UI."""
|
| 109 |
+
from fastapi.responses import HTMLResponse
|
| 110 |
+
index = Path(__file__).parent / "static" / "index.html"
|
| 111 |
+
return HTMLResponse(content=index.read_text(), status_code=200)
|
| 112 |
|
| 113 |
|
| 114 |
@app.get("/web")
|
| 115 |
+
def web_serve():
|
| 116 |
+
"""Serve dashboard at /web (OpenEnv default web UI path)."""
|
| 117 |
+
from fastapi.responses import HTMLResponse
|
| 118 |
+
index = Path(__file__).parent / "static" / "index.html"
|
| 119 |
+
return HTMLResponse(content=index.read_text(), status_code=200)
|
| 120 |
|
| 121 |
|
| 122 |
# ── Serve dashboard static files ────────────────────────────────────────
|