This Flask web application allows users to translate English sentences to French and German using Hugging Face's Transformers library. It provides a simple user interface for language translation.
This Flask web application allows users to translate English sentences to French and Spanish. It provides a user-friendly interface where users can input a sentence, select a target language, and click "Translate" to view the translation result on a new page.
Make sure you have the following libraries installed:
- Flask
- Transformers
- Torch
- SentencePiece
It's recommended to create a virtual environment to isolate your project's dependencies. You can use the following steps to set up a virtual environment:
-
Navigate to your project directory: cd /path/to/your/project
-
Create a virtual environment (replace myenv with your preferred environment name):
python -m venv myenv
- Activate the virtual environment:
On Windows:
myenv\Scripts\activate
On macOS and Linux:
source myenv/bin/activate
- Install the required libraries within the virtual environment:
pip install Flask transformers torch sentencepiece
You can extend this project to support additional languages by adding new translation models and updating the HTML form to include the new languages.
This project uses the Hugging Face Transformers library for natural language processing.
This project is open-source and available under the MIT License.
Happy translating!