Spaces:
Sleeping
Sleeping
API Reference
Base URL: http://localhost:4002
Evidence:
app/api/router.pyapp/routers/classification.pyapp/routers/health.py
Endpoints
| Method | Path | Request | Response |
|---|---|---|---|
| GET | /health/liveness |
none | {status} |
| GET | /health/readiness |
none | {status, labels_count} |
| GET | /endpoint/ |
none | list of routes/methods |
| POST | /api/classifier |
{text} |
"<label>" |
| POST | /api/language |
{text} |
"<language>" |
| POST | /api/transformer |
multipart file |
{filename, content} |
| POST | /classify |
multipart file |
{label, language, type?} |
| POST | /configlabel |
{labels:["a","b"]} |
string[] |
| GET | /labels |
none | string[] |
POST /configlabel contract (exact)
Request body:
- JSON object with required
labelsarray. - Example:
{"labels":["tech","health","legal"]}
Normalization behavior:
- Trim whitespace for each label.
- Remove empty entries.
- Preserve order.
- Keep duplicates as provided.
Response:
200withstring[], the stored labels after normalization.- Example response:
["tech", "health", "legal"]
Errors:
400with detail"At least one label is required"when all parsed labels are empty.422whenlabelsis missing or unknown fields are provided (schema validation error).
Related state behavior:
- Labels are process-local in memory and reset on restart.
GET /labelsreturns the same current in-memory list.
Validation and errors
400for input validation and extraction problems.502for classifier/language inference failures.500for unexpected failures.
Evidence:
app/routers/classification.py(_handle_exception)app/schemas/classification.py
Contract notes
- Contract returns plain string for
/api/classifierand/api/language(not wrapped object). /classifyreturns optionaltype="not english"when language output is noten.
Evidence:
app/routers/classification.pyapp/pipelines/classification_pipeline.py