Skip to content

ErikElcsics/Build-Language-Translator-Local-Streamlit--Translates-English-Spanish-French-Python-Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

🌍 Build Local Language Translator - Translates English, Spanish and French with Streamlit and Python Code.

Build a lightweight, offline-capable translation app for English, Spanish, and French using MarianMT models.

Features

  • Local Translation: No API keys or internet required after setup

Bilingual Support:

  • English ↔ Spanish
  • English ↔ French
  • Small Models: ~150MB per language pair
  • Simple UI: Built with Streamlit for ease of use

Models & Performance

  • Models Used: MarianMT from Helsinki-NLP

  • opus-mt-en-es (English ↔ Spanish)

  • opus-mt-en-fr (English ↔ French)

  • Model Sizes: ~150MB each (total ~300MB for all pairs)

Performance:

  • Best for short/medium sentences
  • Moderate accuracy (comparable to mid-tier translators)
  • CPU-friendly (no GPU required)

Installation

Clone the repo: git clone https://github.com/ErikElcsics/Build-Language-Translator-Local-Streamlit--Translates-English-Spanish-French-Python-Code.git cd streamlit-translator

Install dependencies:

pip install streamlit transformers torch sentencepiece

Run the app:

streamlit run LocalLanguageTranslator.py

How It Works

  • Select Languages: Choose source/target from dropdowns.
  • Enter Text: Type/paste text to translate.
  • Click Translate: Output appears instantly.

Basic Technical Information:

  • Uses Hugging Face’s transformers to load MarianMT models.
  • Tokenizes input → generates translation → decodes output.

Libraries Used

  • streamlit (UI)
  • transformers (model loading)
  • torch (PyTorch backend)
  • sentencepiece (tokenization)

Notes

First run downloads models (~5-10 minutes depending on internet). Translations may be slower on CPU (2-5 seconds per sentence).

License: MIT

English to Spanish

image

English to French

image

French to English

image

Spanish to English

image

About

This project is a lightweight, offline-capable translation app for English, Spanish, and French using MarianMT models.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages