Spaces:
Sleeping
Sleeping
| import os | |
| from fastapi import FastAPI | |
| from fastapi.staticfiles import StaticFiles | |
| from app.api.routes import rag, visualize, grading, upload | |
| from app.api.routes import images | |
| # ✅ Use persistent storage on HF, local folder otherwise | |
| BASE_DATA_DIR = os.getenv("HF_HOME", ".") | |
| OUTPUT_DIR = os.path.join(BASE_DATA_DIR, "outputs") | |
| # ✅ Create the folder BEFORE mounting | |
| os.makedirs(OUTPUT_DIR, exist_ok=True) | |
| app = FastAPI(title="Multimodal RAG API") | |
| app.include_router(rag.router) | |
| app.include_router(visualize.router) | |
| app.include_router(grading.router) | |
| app.include_router(upload.router) | |
| app.include_router(images.router) | |
| # ✅ Mount the real path (not hardcoded "outputs") | |
| app.mount("/outputs", StaticFiles(directory=OUTPUT_DIR), name="outputs") | |
| def root(): | |
| return {"status": "running"} | |