TRAPI : a simple python API to make good translations

 

TRAPI is an example of how with a few lines of Python code it is possible to create an API for doing translations.

TRAPI uses a local model installed on your server; It is based on model takes   https://huggingface.co . Inside the Python code you can find three example models, but you can find more on the URL written above.

# Load model
#model_name = 'Helsinki-NLP/opus-mt-tc-big-en-it' # english -> italian
model_name = 'Helsinki-NLP/opus-mt-tc-big-en-fr' # english -> french
#model_name = 'Helsinki-NLP/opus-mt-tc-big-en-es' # english -> spanish

The API is based on flask that handles a form html with some code javascript . 
Here below an example  of a translation from a wikipedia article: https://en.wikipedia.org/wiki/Linux




The project is available on github: https://github.com/sscotty71/trapi 


Enjoy ;)



Popular posts from this blog