Skip to content

LangToLang is a powerful language translation app built with Streamlit and Hugging Face MarianMT models. It supports translation between multiple languages Experience seamless and real-time translation with a user-friendly interface.

Notifications You must be signed in to change notification settings

mohAhmadRaza/AI-ML-LangToLang-Translator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation


LangToLang - Language Translator

Screenshot (224)

LangToLang is a language translation web application built using Streamlit and Hugging Face's MarianMT models. It allows users to translate text between various languages, including English, French, German, Spanish, Italian, Russian, Chinese, Japanese, Korean, Arabic, and Urdu.

Features

  • Translate Text: Easily translate text between multiple languages.
  • Language Selection: Choose source and target languages from a variety of options.
  • User-Friendly Interface: A clean and intuitive interface built with Streamlit.
  • Real-Time Translation: Get instant translation results as you type.

Table of Contents

Installation

Prerequisites

  • Python 3.7+
  • Streamlit
  • PyTorch (for running Hugging Face models)
  • Hugging Face Transformers library

Steps

  1. Clone the Repository:

    git clone https://github.com/[Your GitHub Username]/LangToLang.git
    cd LangToLang
  2. Install the Required Packages:

    pip install -r requirements.txt
  3. Run the Application:

    streamlit run app.py

Usage

  1. Select the source and target languages from the sidebar.
  2. Enter the text you wish to translate in the text area.
  3. Click the "Translate" button to see the translated text.

Model Information

LangToLang uses Hugging Face's MarianMT models for translation. These models are pre-trained for various language pairs and provide accurate and efficient translations.

Hugging Face Models Used

Deployed Application

Try out the live version of LangToLang:

How to Achieve the Same

Step-by-Step Guide

  1. Choose a Model on Hugging Face:

  2. Install the Required Libraries:

    pip install torch transformers streamlit
  3. Load the Model and Tokenizer:

    from transformers import MarianMTModel, MarianTokenizer
    
    model_name = f'Helsinki-NLP/opus-mt-{src_lang}-{tgt_lang}'  
    model = MarianMTModel.from_pretrained(model_name)
    tokenizer = MarianTokenizer.from_pretrained(model_name)
  4. Translate Text:

    text = "Hello, how are you?"
    translated = model.generate(**tokenizer(text, return_tensors="pt", padding=True))
    translated_text = tokenizer.decode(translated[0], skip_special_tokens=True)
    print(translated_text)
  5. Integrate with Streamlit:

    • Build a simple UI using Streamlit to take user input and display translations, as shown in the provided LanguageTranslator.py file.
  6. Deploy the Application:

Contributing

Contributions are welcome! If you have any ideas or improvements, feel free to fork the repository and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact


This README.md provides an overview of the project, instructions for installation and usage, model information, and a guide for others to replicate the project using Hugging Face models. Make sure to update all the placeholder text with your actual information before uploading it to GitHub.

About

LangToLang is a powerful language translation app built with Streamlit and Hugging Face MarianMT models. It supports translation between multiple languages Experience seamless and real-time translation with a user-friendly interface.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages