Spaces:
Sleeping
Sleeping
Update backend/main.py
Browse files- backend/main.py +12 -0
backend/main.py
CHANGED
|
@@ -20,6 +20,18 @@ app.add_middleware(
|
|
| 20 |
allow_methods=["*"],
|
| 21 |
allow_headers=["*"],
|
| 22 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
# ββ Config ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 25 |
GROQ_MODEL = "llama-3.3-70b-versatile"
|
|
|
|
| 20 |
allow_methods=["*"],
|
| 21 |
allow_headers=["*"],
|
| 22 |
)
|
| 23 |
+
# ββ Static files + SPA βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 24 |
+
from fastapi.staticfiles import StaticFiles
|
| 25 |
+
from fastapi.responses import FileResponse
|
| 26 |
+
import pathlib
|
| 27 |
+
|
| 28 |
+
_static_dir = pathlib.Path(__file__).parent / "static"
|
| 29 |
+
if _static_dir.exists():
|
| 30 |
+
app.mount("/assets", StaticFiles(directory=str(_static_dir / "assets")), name="assets")
|
| 31 |
+
|
| 32 |
+
@app.get("/")
|
| 33 |
+
async def serve_index():
|
| 34 |
+
return FileResponse(str(_static_dir / "index.html"))
|
| 35 |
|
| 36 |
# ββ Config ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 37 |
GROQ_MODEL = "llama-3.3-70b-versatile"
|