martynattakit/CodeSentinel-CWE_Classification
1
1"""2app.py3HF Spaces entry point — serves both the FastAPI backend and the frontend UI.4HF Spaces runs this file directly with: python app.py5"""6 7import uvicorn8from fastapi.staticfiles import StaticFiles9from fastapi.responses import FileResponse10from pathlib import Path11 12from api.main import app13 14# ── Serve frontend ────────────────────────────────────────────────────────────15# Mount the frontend folder so index.html is served at "/"16 17FRONTEND_DIR = Path(__file__).parent / "frontend"18 19@app.get("/", include_in_schema=False)20async def serve_frontend():21 return FileResponse(FRONTEND_DIR / "index.html")22 23# ── Run ───────────────────────────────────────────────────────────────────────24if __name__ == "__main__":25 uvicorn.run(26 "app:app",27 host="0.0.0.0",28 port=7860, # HF Spaces default port29 reload=False,30 )