Spaces:
Running
Running
Download app/api/meta.py from cmeneses99/sms-classifier-api: direct link, hf CLI and curl.
- Browser
- Download file 704 Bytes
-
https://huggingface.co/spaces/cmeneses99/sms-classifier-api/resolve/main/app/api/meta.py
- Command line
-
hf download hf://spaces/cmeneses99/sms-classifier-api/app/api/meta.py
-
curl -L -o meta.py https://huggingface.co/spaces/cmeneses99/sms-classifier-api/resolve/main/app/api/meta.py
704 Bytes
| from fastapi import APIRouter | |
| from ..core.model_loader import get_categories | |
| from ..core.category_meta import CATEGORY_META | |
| from ..services.classifier import get_cache | |
| router = APIRouter(tags=["meta"]) | |
| _FALLBACK = {"color": "#94a3b8", "description": "", "example_es": "", "example_en": ""} | |
| def health(): | |
| return { | |
| "status": "ok", | |
| "model": "distilbert-multilingual-sms", | |
| "version": "2.0.0", | |
| "cache": get_cache().stats(), | |
| } | |
| def categories_api(): | |
| cats = get_categories() | |
| return { | |
| "categories": [{"name": c, **CATEGORY_META.get(c, _FALLBACK)} for c in cats], | |
| "total": len(cats), | |
| } | |