Make sure these requirements are satisfied:
- Make sure your python version is 3.6 and has installed the libraries mentioned in
requirements.txt
You can usepip3 install -r requirements.txt
rest_server.py
has executable permissions -chmod +x rest_server.py
- Make sure you create two folders
en_de
anden_fr
at this directory level
Add fairseq model files (only files - generally 4 per model) for
English to German to en_de
English to French to en_fr
How to use:
- open a shell/terminal in repository and run
./rest_server.py
- REST server runs on
localhost:5000/translate
- Use the following JSON object to send translation requests to rest server:\
{
"src_lang" : "en",
"tgt_lang" : "de" or "fr",
"text" : "text to translate"
}
- The response for the request will take about 10s to arrive, it will arrive in the following form:
{
"text" : "translated text",
"err_no" : error number,
"err" : "error descr"
}