File size: 1,237 Bytes
7ddb64a
 
 
 
 
 
 
 
 
 
 
 
9b0ce22
7ddb64a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9b0ce22
7ddb64a
 
 
9b0ce22
7ddb64a
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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"])

@app.get("/")
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"))