Spaces:
Sleeping
Sleeping
Download adsp/app/api/routes/system.py from thanhnv2323/humanize-text-python: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/thanhnv2323/humanize-text-python/resolve/main/adsp/app/api/routes/system.py
- Command line
-
hf download hf://spaces/thanhnv2323/humanize-text-python/adsp/app/api/routes/system.py
-
curl -L -o system.py https://huggingface.co/spaces/thanhnv2323/humanize-text-python/resolve/main/adsp/app/api/routes/system.py
1.12 kB
| """System/health API routes.""" | |
| from __future__ import annotations | |
| from typing import Any | |
| from pydantic import BaseModel, ConfigDict, Field | |
| class HealthResponse(BaseModel): | |
| model_config = ConfigDict( | |
| json_schema_extra={"example": {"status": "ok", "version": "0.1.0", "qa_status": "ready"}} | |
| ) | |
| status: str = Field(default="ok", description="Overall API health status.") | |
| version: str = Field(description="Application API version.") | |
| qa_status: str = Field( | |
| default="unknown", | |
| description="QA service warmup status. Expected values: idle, warming, ready, error.", | |
| ) | |
| def register_system_routes(app: Any, *, version: str) -> None: | |
| def health() -> HealthResponse: | |
| services = getattr(app.state, "services", None) | |
| qa_status = getattr(getattr(services, "qa", None), "status", "unknown") | |
| return HealthResponse(version=version, qa_status=qa_status) | |