Download main.py from Unexpo/mapApp: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/spaces/Unexpo/mapApp/resolve/main/main.py
- Command line
-
hf download hf://spaces/Unexpo/mapApp/main.py
-
curl -L -o main.py https://huggingface.co/spaces/Unexpo/mapApp/resolve/main/main.py
1.11 kB
| import uvicorn | |
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from config import settings | |
| from api.damage import router as damage_router | |
| from api.shelters import router as shelters_router | |
| # Initialize FastAPI application | |
| app = FastAPI( | |
| title=settings.PROJECT_NAME, | |
| version=settings.VERSION, | |
| description="Backend API for progressive damage assessment mapping and shelter distribution in Guarenas-Guatire." | |
| ) | |
| # Enable CORS for frontend PWA integration | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=settings.ALLOWED_ORIGINS, | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| # Include sub-routers (Controller layer) | |
| app.include_router(damage_router, prefix="/api/v1/damage", tags=["damage"]) | |
| app.include_router(shelters_router, prefix="/api/v1/shelters", tags=["shelters"]) | |
| def read_root(): | |
| return { | |
| "status": "healthy", | |
| "app": settings.PROJECT_NAME, | |
| "version": settings.VERSION | |
| } | |
| if __name__ == "__main__": | |
| uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) | |