Spaces:
Sleeping
Sleeping
GitHub Actions commited on
Commit Β·
727aa6e
1
Parent(s): f5e8934
π Auto-deploy from GitHub
Browse files
app/api/v1/endpoints/health.py
CHANGED
|
@@ -31,14 +31,14 @@ async def health_check():
|
|
| 31 |
"""
|
| 32 |
try:
|
| 33 |
# Check model loading status
|
| 34 |
-
|
| 35 |
try:
|
| 36 |
from ....core.model_loader import get_generator
|
| 37 |
# Try to get the generator - if it's cached, this will be instant
|
| 38 |
generator = get_generator()
|
| 39 |
-
|
| 40 |
except Exception as e:
|
| 41 |
-
|
| 42 |
|
| 43 |
# Check HuggingFace space if configured
|
| 44 |
hf_status = await check_huggingface_space()
|
|
@@ -46,7 +46,7 @@ async def health_check():
|
|
| 46 |
return HealthResponse(
|
| 47 |
status="healthy",
|
| 48 |
server="running",
|
| 49 |
-
|
| 50 |
huggingface_space=hf_status,
|
| 51 |
huggingface_space_url=HF_SPACE_URL
|
| 52 |
)
|
|
|
|
| 31 |
"""
|
| 32 |
try:
|
| 33 |
# Check model loading status
|
| 34 |
+
ml_model_status = "loading"
|
| 35 |
try:
|
| 36 |
from ....core.model_loader import get_generator
|
| 37 |
# Try to get the generator - if it's cached, this will be instant
|
| 38 |
generator = get_generator()
|
| 39 |
+
ml_model_status = "ready" if generator else "loading"
|
| 40 |
except Exception as e:
|
| 41 |
+
ml_model_status = f"error: {str(e)[:50]}..."
|
| 42 |
|
| 43 |
# Check HuggingFace space if configured
|
| 44 |
hf_status = await check_huggingface_space()
|
|
|
|
| 46 |
return HealthResponse(
|
| 47 |
status="healthy",
|
| 48 |
server="running",
|
| 49 |
+
ml_model_status=ml_model_status,
|
| 50 |
huggingface_space=hf_status,
|
| 51 |
huggingface_space_url=HF_SPACE_URL
|
| 52 |
)
|
app/api/v1/schemas/health_schema.py
CHANGED
|
@@ -5,6 +5,6 @@ from typing import Optional
|
|
| 5 |
class HealthResponse(BaseModel):
|
| 6 |
status: str
|
| 7 |
server: str
|
| 8 |
-
|
| 9 |
huggingface_space: Optional[str] = None
|
| 10 |
huggingface_space_url: Optional[str] = None
|
|
|
|
| 5 |
class HealthResponse(BaseModel):
|
| 6 |
status: str
|
| 7 |
server: str
|
| 8 |
+
ml_model_status: str
|
| 9 |
huggingface_space: Optional[str] = None
|
| 10 |
huggingface_space_url: Optional[str] = None
|