FastAPI service that detects the language of input text; exposes /health and /detect
124
This Docker image ships only the prediction (inference) stack: a FastAPI service, the shared text-cleaning step (aligned with training), and a frozen scikit-learn pipeline loaded from a .pkl artifact at startup.
It does not include training code, datasets, or notebooks. For the full project (training pipeline, EDA, data), see the source repository.
docker run --rm -p 8000:8000 mateo755/language-detector-api:v1
8000 (map as needed, e.g. -p 8000:8000).GET /health returns {"status":"ok"} (also used by the image HEALTHCHECK).| Variable | Description |
|---|---|
LANGUAGE_DETECTION_MODEL_PATH | Optional absolute path to a .pkl file inside the container. If unset, the model bundled in the image is used. Mount your own artifact and set this variable to override it. |
POST /detect — JSON body:
{ "text": "Any text to classify" }
Example with curl:
curl -s -X POST http://localhost:8000/detect \
-H "Content-Type: application/json" \
-d '{"text":"Hello world"}'
Response:
{ "text": "Hello world", "language": "<predicted_label>" }
The text field is limited to 50,000 characters per request.
Standard FastAPI OpenAPI/Swagger UI is available at /docs while the container is running.
Application and training code live in the project repository: https://github.com/Mateo755/language_recognition.git
Content type
Image
Digest
sha256:e1fc8d84a…
Size
126.8 MB
Last updated
6 months ago
docker pull mateo755/language-detector-api:v1