added first draft of upload interface

This commit is contained in:
Christian Krakau-Louis
2025-03-24 16:52:47 +01:00
parent 97dfe27113
commit e526f691ef
4 changed files with 137 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
# app/frontend.py (new file or inline in main.py)
from fastapi import APIRouter
from fastapi.responses import FileResponse
from fastapi.staticfiles import StaticFiles
import os
router = APIRouter()
# 1) Serve the folder that contains index.html, etc.
# e.g. "frontend" is relative to your project root
frontend_folder = os.path.join(os.path.dirname(__file__), "..", "frontend")
# If you just want to serve the entire folder as static:
router.mount("/static", StaticFiles(directory=frontend_folder), name="static")
# 2) For the root route ("/"), return the index.html
@router.get("/ui", response_class=FileResponse)
def serve_ui():
return os.path.join(frontend_folder, "index.html")