Spaces:
Sleeping
Sleeping
Merge pull request #2 from sgoonjan/building-v1
Browse files
src/keyarrange/api/app.py
CHANGED
|
@@ -30,12 +30,14 @@ UPLOAD_DIR.mkdir(parents=True, exist_ok=True)
|
|
| 30 |
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
| 31 |
|
| 32 |
# Serve frontend
|
| 33 |
-
|
|
|
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
@app.get("/", response_class=HTMLResponse)
|
| 37 |
async def root():
|
| 38 |
-
return (
|
| 39 |
|
| 40 |
|
| 41 |
@app.get("/health")
|
|
|
|
| 30 |
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
| 31 |
|
| 32 |
# Serve frontend
|
| 33 |
+
from pathlib import Path
|
| 34 |
+
WEB_DIR = Path(__file__).parent.parent.parent.parent / "web" # src/keyarrange/api/app.py → repo root
|
| 35 |
+
app.mount("/web", StaticFiles(directory=str(WEB_DIR)), name="web")
|
| 36 |
|
| 37 |
|
| 38 |
@app.get("/", response_class=HTMLResponse)
|
| 39 |
async def root():
|
| 40 |
+
return (WEB_DIR / "index.html").read_text()
|
| 41 |
|
| 42 |
|
| 43 |
@app.get("/health")
|