21 lines
542 B
Python
21 lines
542 B
Python
from fastapi import APIRouter
|
|
from fastapi.responses import JSONResponse
|
|
|
|
from app.ml.model_manager import model_manager
|
|
|
|
router = APIRouter(tags=["Health"])
|
|
|
|
|
|
@router.get("/health")
|
|
def health():
|
|
"""Liveness: процесс жив и отвечает."""
|
|
return {"status": "ok"}
|
|
|
|
|
|
@router.get("/ready")
|
|
def ready():
|
|
"""Readiness: модели загружены, можно слать запросы."""
|
|
if not model_manager.ready:
|
|
return JSONResponse(status_code=503, content={"status": "loading"})
|
|
return {"status": "ready"}
|