This documentation describes how to use the Language Translation API, which provides translation capabilities for multiple languages.
The Language Translation API is built using Python's FAST-API framework and provides the following capabilities:
- Translation from one language to another, with support for multiple languages
To run the Language Translation API locally, follow the steps below:
- Clone the repository from Github: git clone
https://github.com/deepaksirohiwal/Deep_learning_language_translation_API.git
- Install the required dependencies by running
pip install -r requirements.txt
- Run the API using Uvicorn by running
uvicorn main:app --reload
- The API will now be available at
http://localhost:8000/
To run the Langauge Translation API locally using Docker image, follow the steps below:
- Build the docker image
docker buildx build --platform linux/amd64 -t dlapi .
- Runt the API inside the docker container
docker run -d --name dlapi -p 80:80 dlapi
- The API will now be available at
http://localhost:80
To use the Language Translation API, send a POST request to the endpoint /translate
and a task_id
will be return. The request body should be in JSON format and contain the following parameters:
text
: The text to be translated.base_lang
: The source language of the text (e.g., English).final_language
: The target language for the translation (e.g., French). Use the returnedtask_id
to send a GET request to the endpoint/results
Here's an example request:
The API will respond with a JSON object containing the translated text:
The Language Translation API supports multiple languages and trained on t5-small
model. This model can be replaced by more powerfull t5-base and t5-large. Here's a list of currently supported languages and their corresponding language codes:
- English
- French
- German
- Romanian
That's it! You now know how to run and use the Language Translation API. If you have any questions or feedback, please feel free to contact me.