BhashaSetu (Sanskrit for "Language Bridge") is an AI-powered document-level machine translation workspace designed specifically for low-resource Indic languages. Built on IndicTrans2, it provides seamless English-to-Indic translation for Malayalam, Telugu, Kannada, Tamil, and Hindi.
- Watch the Streamlit Demo Video Here: Google Drive link
- Watch the Flask + JS Demo Video Here: Google Drive link
- π Multi-Language Support: English β Malayalam, Telugu, Kannada, Tamil, Hindi
- π IndicTrans2 Powered: State-of-the-art specialized Indic translation model
- π Real-time Metrics: Translation time tracking and performance monitoring
- π¨ Elegant UI: Editorial design with glassmorphism and smooth animations
- π One-Click Copy: Copy translations to clipboard
- π Two Deployment Options: Flask + Vanilla JS or Streamlit
| Language | BLEU | ChrF | TER | METEOR |
|---|---|---|---|---|
| Kannada | 17.82 | 54.91 | 76.20 | 0.3999 |
| Malayalam | 15.73 | 52.87 | 84.46 | 0.3530 |
| Telugu | 12.54 | 48.33 | 84.50 | 0.3160 |
| Tamil | 11.47 | 50.51 | 92.45 | 0.3082 |
Evaluated on Pralekha dataset test split (1000 samples per language)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BhashaSetu Application β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β βββββββββββββββββββ βββββββββββββββββββββββ β
β β Frontend UI βββββββββββββββΊβ Backend API β β
β β (HTML/CSS/JS) β REST API β (Flask/Streamlit) β β
β βββββββββββββββββββ ββββββββββββ¬βββββββββββ β
β β β
β βββββββββββΌββββββββββ β
β β IndicTrans2-1B β β
β β (Hugging Face) β β
β βββββββββββββββββββββ β
β β β
β βββββββββββΌββββββββββ β
β β Unicode Indic β β
β β Transliterator β β
β βββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Python 3.10+
- Hugging Face Account (for model access)
- 8GB+ RAM (16GB recommended)
- GPU Optional (CUDA-compatible for faster inference)
git clone https://github.com/yourusername/bhashasetu.git
cd bhashasetu# Create virtual environment
python -m venv venv```
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activateFor Flask Version:
pip install -r requirements.txtFor Streamlit Version:
pip install -r requirements-streamlit.txt# Copy the example environment file
cp .env.example .env
# Edit .env and add your Hugging Face token
# Get your token from: https://huggingface.co/settings/tokens
Edit .env:
env
HF_TOKEN=hf_your_actual_token_here
USE_CUDA=0 # Set to 1 if you have GPU
DEBUG=false- IndicTrans2 requires access approval:
- Visit ai4bharat/indictrans2-en-indic-1B
- Click "Agree and access repository"
- Wait for approval (usually instant)
Using the run script
./run_streamlit.sh
# Or directly
streamlit run streamlit/app_streamlit.py
Access at: http://localhost:8501- β Single-command startup
- β Built-in UI components
- β Automatic state management
- β Faster development iteration
# Terminal 1: Start Flask Backend
cd backend
python app_flask.py
# Terminal 2: Serve Frontend
cd frontend
python -m http.server 8000
Access at: http://localhost:8000- β RESTful API architecture
- β Separation of concerns
- β Scalable for production
- β Custom frontend control
# Streamlit version
docker-compose -f docker/docker-compose-streamlit.yml up
# Flask version
docker-compose -f docker/docker-compose-flask.yml up- Enter Source Text: Type or paste English text in the left panel
- Select Target Language: Choose from Malayalam, Telugu, Kannada, Tamil, or Hindi
- Choose Style: Select "Formal" or "Casual" translation mode
- Click Translate: Press the "Translate Now" button
- View Results: Translation appears in the right panel with time metrics
BhashaSetu uses IndicTrans2-1B, an encoder-decoder transformer specifically trained on 1.17M English-Indic parallel document pairs from the Pralekha dataset.
- Parameters: 1 Billion
- Architecture: Transformer Encoder-Decoder
- Training Data: PIB news bulletins + Mann Ki Baat transcripts
- Context Window: 512 tokens
English Input β Language Tagging β Beam Search Decoding β Script Transliteration β Indic Output
Language Tagging: Input prefixed with eng_Latn {target}_ {script}
- We initially tested general-purpose LLMs:
- Qwen2.5-7B: BLEU 0.01, frequent English fallback
- DeepSeek-7B: BLEU 0.0004, script corruption
- Low-resource language limitations in pretraining
- Morphological complexity of Indic scripts
- Long-context instability in decoder-only models
- IndicTrans2's specialized training on parallel Indic corpora provides 1500x improvement over LLM baselines.
bhashasetu/
βββ README.md # Project documentation
βββ .gitignore # Git ignore rules
βββ .env.example # Environment variables template
βββ requirements.txt # Flask version dependencies
βββ requirements-streamlit.txt # Streamlit version dependencies
βββ setup.sh # One-click setup script
βββ run_flask.sh # Flask launcher
βββ run_streamlit.sh # Streamlit launcher
β
βββ backend/ # Flask Backend
β βββ app_flask.py # Flask API server
β βββ model.py # IndicTrans2 wrapper
β βββ config.py # Configuration
β βββ requirements.txt # Backend dependencies
β
βββ frontend/ # Vanilla JS Frontend
β βββ index.html # Main HTML
β βββ css/
β β βββ styles.css # Custom styles
β βββ js/
β βββ config.js # Configuration
β βββ ui.js # UI manager
β βββ translation.js # Translation service
β βββ app.js # Main application
β
βββ streamlit/ # Streamlit Version
β βββ app_streamlit.py # Single-file Streamlit app
β
βββ docker/ # Docker Configuration
βββ Dockerfile.backend
βββ Dockerfile.streamlit
βββ docker-compose-flask.yml
βββ docker-compose-streamlit.yml
Environment Variables
Variable Description Default
HF_TOKEN Hugging Face API token Required
USE_CUDA Enable GPU acceleration 0
DEBUG Enable debug mode false
PORT Server port 5000
MAX_LENGTH Max translation tokens 256
BATCH_SIZE Batch processing size 4
Add new languages in config.py or app_streamlit.py:
LANGUAGE_CONFIGS = {
"NewLanguage": {
"src": "eng_Latn",
"tgt": "xxx_Xxxx",
"translit_src": "hi",
"translit_tgt": "xx"
}
}Issue Solution
Model won't load Verify HF_TOKEN in .env file
"Gated model" error Accept terms at model page
CUDA out of memory Set USE_CUDA=0 or reduce BATCH_SIZE
Material Icons not showing Check internet connection (fonts loaded from Google)
Slow first translation Model loading takes 30-60s; subsequent translations fast
Script showing Devanagari Transliterator issue; check translit_src/translit_tgt
Debug Mode Enable debug mode for detailed logs:
export DEBUG=true
python backend/app_flask.py# Enable CUDA (requires NVIDIA GPU + CUDA toolkit)
export USE_CUDA=1Adjust batch size based on available memory:
# In config.py
BATCH_SIZE = 8 # Increase for better throughput
MAX_LENGTH = 256 # Adjust based on text lengthThe model caches automatically in:
Linux/macOS: ~/.cache/huggingface/
Windows: %USERPROFILE%\.cache\huggingface\- Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (git checkout -b feature/amazing-feature) -Commit changes (git commit -m 'Add amazing feature') -Push to branch (git push origin feature/amazing-feature)
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you use BhashaSetu in your research, please cite:
@software{bhashasetu2026,
title = {BhashaSetu: Document-Level Machine Translation for Indic Languages},
author = {T. Vishwanath, S. Samith, S. Vijay},
year = {2026},
url = {https://github.com/yourusername/bhashasetu}
}
@inproceedings{suryanarayanan-etal-2025-pralekha,
title = "{PRALEKHA}: Cross-Lingual Document Alignment for {I}ndic Languages",
author = "Suryanarayanan, Sanjay and Song, Haiyue and Khan, Mohammed Safi Ur Rahman and Kunchukuttan, Anoop and Dabre, Raj",
booktitle = "Proceedings of IJCNLP-AACL 2025",
year = "2025"
}-
T. Vishwanath - GitHub
Project Link: https://github.com/Vishwanath-06/BhashaSethu
Built with β€οΈ for Indic Languages | The Ethereal Conduit π