added first draft of upload interface
This commit is contained in:
@@ -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")
|
||||
Reference in New Issue
Block a user