Upload folder using huggingface_hub
Browse files- gridops/server/app.py +15 -0
gridops/server/app.py
CHANGED
|
@@ -12,6 +12,7 @@ from pathlib import Path
|
|
| 12 |
from typing import Any
|
| 13 |
|
| 14 |
from fastapi import FastAPI
|
|
|
|
| 15 |
from fastapi.staticfiles import StaticFiles
|
| 16 |
from pydantic import BaseModel
|
| 17 |
|
|
@@ -100,6 +101,20 @@ def list_tasks():
|
|
| 100 |
}
|
| 101 |
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
# ── Serve dashboard static files ────────────────────────────────────────
|
| 104 |
|
| 105 |
STATIC_DIR = Path(__file__).parent / "static"
|
|
|
|
| 12 |
from typing import Any
|
| 13 |
|
| 14 |
from fastapi import FastAPI
|
| 15 |
+
from fastapi.responses import RedirectResponse
|
| 16 |
from fastapi.staticfiles import StaticFiles
|
| 17 |
from pydantic import BaseModel
|
| 18 |
|
|
|
|
| 101 |
}
|
| 102 |
|
| 103 |
|
| 104 |
+
# ── Root redirect to dashboard ───────────────────────────────────────────
|
| 105 |
+
|
| 106 |
+
@app.get("/")
|
| 107 |
+
def root_redirect():
|
| 108 |
+
"""Redirect root to dashboard so HF Space iframe shows the UI."""
|
| 109 |
+
return RedirectResponse(url="/dashboard/")
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
@app.get("/web")
|
| 113 |
+
def web_redirect():
|
| 114 |
+
"""Redirect /web to dashboard (OpenEnv default web UI path)."""
|
| 115 |
+
return RedirectResponse(url="/dashboard/")
|
| 116 |
+
|
| 117 |
+
|
| 118 |
# ── Serve dashboard static files ────────────────────────────────────────
|
| 119 |
|
| 120 |
STATIC_DIR = Path(__file__).parent / "static"
|