Spaces:
Running
Running
File size: 704 Bytes
f9ac587 84bb476 f9ac587 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 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": ""}
@router.get("/health")
def health():
return {
"status": "ok",
"model": "distilbert-multilingual-sms",
"version": "2.0.0",
"cache": get_cache().stats(),
}
@router.get("/api/categories")
def categories_api():
cats = get_categories()
return {
"categories": [{"name": c, **CATEGORY_META.get(c, _FALLBACK)} for c in cats],
"total": len(cats),
}
|