Spaces:
Sleeping
Sleeping
Download main.py from Soaravox/soaravox-api: direct link, hf CLI and curl.
- Browser
- Download file 904 Bytes
-
https://huggingface.co/spaces/Soaravox/soaravox-api/resolve/7caa324d68ca14495a720e192250b6e16553ebc2/main.py
- Command line
-
hf download hf://spaces/Soaravox/soaravox-api@7caa324d68ca14495a720e192250b6e16553ebc2/main.py
-
curl -L -o main.py https://huggingface.co/spaces/Soaravox/soaravox-api/resolve/7caa324d68ca14495a720e192250b6e16553ebc2/main.py
904 Bytes
| import uvicorn | |
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from api.routes import router as chat_router | |
| from fastapi.staticfiles import StaticFiles | |
| app = FastAPI(title="Soaravox API", version="1.0.0") | |
| app.mount("/static", StaticFiles(directory="."), name="static") | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| app.include_router(chat_router, prefix="/api") | |
| def health_check(): | |
| from services.llm import llm_service | |
| return { | |
| "status": "ok", | |
| "llm_loading": llm_service.is_loading, | |
| "llm_status": llm_service.status, | |
| "llm_error": llm_service.loading_error, | |
| "llm_ready": llm_service.llm is not None | |
| } | |
| if __name__ == "__main__": | |
| uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) | |