Spaces:
Sleeping
Sleeping
Download app/main.py from sandy898/resonate-api: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/sandy898/resonate-api/resolve/main/app/main.py
- Command line
-
hf download hf://spaces/sandy898/resonate-api/app/main.py
-
curl -L -o main.py https://huggingface.co/spaces/sandy898/resonate-api/resolve/main/app/main.py
1.15 kB
| # backend/app/main.py | |
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from app.api import routes | |
| from app.api import profile_analytics # <--- ADD THIS IMPORT | |
| from app.core.ml_manager import ml_manager | |
| from contextlib import asynccontextmanager | |
| from app.core.config import settings | |
| from app.api import auth, crud_routes | |
| from app.db.database import engine, Base | |
| async def lifespan(app: FastAPI): | |
| async with engine.begin() as conn: | |
| await conn.run_sync(Base.metadata.create_all) | |
| ml_manager.initialize(settings.DATA_DIR) | |
| yield | |
| app = FastAPI(title="Resonate API", lifespan=lifespan) | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["http://localhost:3000", "https://resonance-blush-five.vercel.app"], | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| # Include all routers | |
| app.include_router(routes.router, prefix=settings.API_V1_STR) | |
| app.include_router(profile_analytics.router, prefix=settings.API_V1_STR) | |
| app.include_router(auth.router, prefix=settings.API_V1_STR) | |
| app.include_router(crud_routes.router, prefix=settings.API_V1_STR) |