Skip to content

This repository provides a simple web application using Flask that translates English sentences to Hindi. It uses a pre-trained neural translation model from Hugging Face and includes error handling for a smoother user experience. You can run the app locally and experiment with translating different English phrases into Hindi.

Notifications You must be signed in to change notification settings

AmitAnand-git/English-to-Hindi-Neural-Translation-Model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

English to Hindi Neural Translation Model

This repository contains a simple web application built with Flask that utilizes a pre-trained neural translation model to translate English sentences into Hindi.

Key Features

  • Pre-trained Model: The application leverages the Helsinki-NLP/opus-mt-en-hi model, a powerful translation model trained on a large dataset of English-Hindi parallel text.
  • Flask Web App: A Flask web app provides a user-friendly interface for inputting English sentences and receiving Hindi translations.
  • Error Handling: The app includes error handling to prevent crashes and display informative messages to the user.

Project Structure

└── English-to-Hindi Neural Translation Model
    ├── TEMPLATES
    │   └── index.html
    └── app.py

How to Run

  1. Install Dependencies: Make sure you have Python 3.x installed and the required libraries. You can install them using:

    pip install -r requirements.txt
  2. Run the App: Execute the following command:

    python app.py
  3. Access the App: Open your web browser and navigate to http://127.0.0.1:5000/ (or the address displayed in your terminal).

Usage

  1. Enter an English sentence in the text box on the web page.
  2. Click the "Translate" button.
  3. The translated Hindi sentence will be displayed below the input box.

Customization

  • You can customize the translation model by replacing Helsinki-NLP/opus-mt-en-hi with another suitable model from Hugging Face.
  • Modify the max_length parameter in the translate_sentence() function to adjust the maximum length of the translated sentences.
  • Feel free to enhance the web app's interface and functionality.

Notes

  • The model's performance might vary depending on the complexity and domain of the input text.
  • For optimal results, consider fine-tuning the model on a domain-specific dataset.
  • This project serves as a basic example for demonstrating neural machine translation. Further improvements and feature additions are encouraged.

Contributions

Contributions are welcome! Feel free to fork this repository and submit pull requests for enhancements and bug fixes.

About

This repository provides a simple web application using Flask that translates English sentences to Hindi. It uses a pre-trained neural translation model from Hugging Face and includes error handling for a smoother user experience. You can run the app locally and experiment with translating different English phrases into Hindi.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published