File size: 629 Bytes
9db766f
 
 
 
24cfb63
 
9db766f
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""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()
    )