Sign inSign up

mateo755/language-detector-api

By mateo755

•Updated 6 months ago

FastAPI service that detects the language of input text; exposes /health and /detect

Image
Machine learning & AI
0

124

mateo755/language-detector-api repository overview

⁠Language Detector API (inference image)

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.

⁠Quick start
docker run --rm -p 8000:8000 mateo755/language-detector-api:v1
  • Port: 8000 (map as needed, e.g. -p 8000:8000).
  • Health: GET /health returns {"status":"ok"} (also used by the image HEALTHCHECK).
⁠Environment variables
VariableDescription
LANGUAGE_DETECTION_MODEL_PATHOptional 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.
⁠Endpoints

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.

⁠Interactive docs

Standard FastAPI OpenAPI/Swagger UI is available at /docs while the container is running.

⁠Source

Application and training code live in the project repository: https://github.com/Mateo755/language_recognition.git⁠

Tag summary

Content type

Image

Digest

sha256:e1fc8d84a…

Size

126.8 MB

Last updated

6 months ago

docker pull mateo755/language-detector-api:v1