Sign inSign up

cargoshipsh/language-detection

By cargoshipsh

•Updated over 3 years ago

API for detecting language of an input text

Image
0

286

cargoshipsh/language-detection repository overview

Automatically detect the language of an input text. This docker images provides an easy to use API including a protection by an API key (using FastAPI⁠). This model is based on FastText⁠ and is trained on data from Wikipedia⁠, Tatoeba⁠ and SETimes⁠. The model itself is only 917kB in size and doesn't require a GPU to run.

To learn more about this and other easy-to-use models as pre-packaged APIs, visit cargoship.sh⁠

⁠License

The model itself is licensed under Creative Commons Attribution-Share-Alike License 3.0⁠. The code for the API wrapper is licensed under MIT License⁠.

⁠System Requirements

Minimum: 1GB RAM, 1 vCPU
Recommended: 2GB RAM, 2 vCPU

⁠Usage

Input [POST]

{
  "text": "This is a text in English"
}

Output

{
  "language": "en"
}

You need to set an API Key via the environment variable API_KEY to run the image and set the X-API-KEY header in your request with the same KEY.

⁠Example

Make sure you have Docker installed then run the following command:

docker run -p 80:80 --env API_KEY=CHANGE_ME cargoshipsh/language-detection:main

In a new terminal window, run the following command to call the API

curl -X POST -H 'Content-type: application/json' -H 'X-API-Key: CHANGE_ME' --data '{"text":"Hello, World!"}' http://localhost:80

You see the output of the model in the terminal.

{"language":"en"}

Tag summary

Content type

Image

Digest

sha256:7eaec026f…

Size

207.8 MB

Last updated

over 3 years ago

docker pull cargoshipsh/language-detection