|
|
"""Health check endpoint""" |
|
|
|
|
|
from fastapi import APIRouter |
|
|
from datetime import datetime |
|
|
from models import HealthResponse |
|
|
from services import stance_model_manager |
|
|
|
|
|
router = APIRouter() |
|
|
|
|
|
|
|
|
@router.get("/health", response_model=HealthResponse, tags=["General"]) |
|
|
async def health_check(): |
|
|
"""Health check endpoint""" |
|
|
return HealthResponse( |
|
|
status="healthy" if stance_model_manager.model_loaded else "unhealthy", |
|
|
model_loaded=stance_model_manager.model_loaded, |
|
|
device=str(stance_model_manager.device) if stance_model_manager.device else "unknown", |
|
|
timestamp=datetime.now().isoformat() |
|
|
) |
|
|
|
|
|
|