Welcome to Open-Translate, where innovation meets seamless communication. Our project serves as a user-friendly interface for machine translation, complemented by a robust Restful API implementation.
The provided code is intentionally generic, allowing you to seamlessly integrate the frontend with your unique project requirements.
git clone https://github.com/danielinux7/open-translate.git
cd open-translate
npm install
ng serve
To tailor the frontend to your specific requirements, consider the following customization options:
Expand the language options by adding a new language to the src/app/languages.ts
file. Simply include it in the languages object list.
Adjust API calls to suit your needs by modifying the relevant sections in the src/app/translate.service.ts
file. For local testing of the API server, set the endpoint to localhost
.
The backend comprises two servers: a Flask server responsible for handling RESTful API calls, and a TensorFlow server dedicated to managing Neural Machine Translation (NMT) models. When a call is initiated, the Flask server manages the requests and seamlessly passes them to the TensorFlow server.
git clone https://github.com/danielinux7/open-translate.git
cd open-translate/server
bash setup_prod.sh # use setup.sh for localhost
bash run_prod.sh # use run.sh for localhost
You should configure your production server name in setup_prod.sh
and run_prod.sh
. You can stop the servers by running bash stop.sh
.
The payload for API calls includes the following key components:
langSrc
: Source language identifier.langTgt
: Target language identifier.source
: Representing the source content.
The response includes a target
key-value pair, providing the translated content.
Expanding the server's language capabilities is a straightforward process. To integrate your TensorFlow saved model:
- Place the model under the
/models/<langSrc-langTgt>/<Version>
folder.- Example:
/models/en-fr/1/
for English to French translation, version 1.
- Example:
- If you introduce a new version, TensorFlow serves the latest version.
For tokenization, the backend uses Sentencepiece. Include the src.model
and tgt.model
models in the /models/<langSrc-langTgt>/<Version>/assets
folder.
You can unpuck server/models.zip
to get the available models running.
The /starred
folder serves as the destination for user-submitted edited or high-quality translations via the frontend.