Spaces:
Sleeping
Sleeping
| from pathlib import Path | |
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| import sys, os | |
| root_ = Path(__file__).resolve().parent | |
| project_root = root_.parent | |
| if str(project_root) not in sys.path: | |
| sys.path.insert(0, str(project_root)) | |
| # Importation des custom libs | |
| from api.config import settings | |
| from api.routers import upload, auth, chat, kpis | |
| app = FastAPI( | |
| title="Healthcare AI Diagnosis API", | |
| description="API pour le Chatbot Zephyr & le Modèle Spark", | |
| version="0.1.0" | |
| ) | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| app.include_router(upload.router, prefix="/api/upload", tags=["Upload"]) | |
| app.include_router(auth.router, prefix="/api/auth", tags=["Auth"]) | |
| app.include_router(chat.router, prefix="/api/chat", tags=["Chat"]) | |
| app.include_router(kpis.router, prefix="/api/kpis", tags=["Chat"]) | |
| def root(): | |
| return {"status": "Le serveur HealthCare est opérationnel"} | |
| # if __name__ == "__main__": | |
| # import uvicorn | |
| # uvicorn.run(app, host=settings.server.host, port=settings.server.port) | |
| # print(os.getenv("HF_TOKEN")) | |