Multilingual-Translator

The Multilingual Translator is a real-time multilingual translation app that allows users to input text in one language and receive instant translations in another. It supports over 20 languages and enables smooth conversational interaction through a clean Streamlit interface. The backend is built with Flask and utilizes OpenAI's LLMs for high-quality translation and text-to-speech synthesis.

GitHub Stars

0

User Rating

Not Rated

Favorites

0

Views

22

Forks

0

Issues

0

README
🌐 Multilingual Translator

Multilingual Translator a real-time multilingual translation application that allows users to speak or type in one language and receive an instant translation in another, optionally with audio output. It supports 20+ languages and enables smooth, conversational interaction through a clean Streamlit interface. The backend is built with Flask and uses OpenAI's LLMs for high-quality translation and text-to-speech synthesis.

I split frontend and backend to keep roles clean and reliable: Streamlit handles UX, while Flask exposes APIs, runs model calls, and serves files. Flask is better for binary uploads and static MP3s, and it avoids Streamlit’s rerun issues during long ops. Keeping logic in Flask stabilizes state, centralizes secrets, and keeps credentials out of the UI. The same API can power other clients later. HTTP GET/POST also handles large inputs and file uploads cleanly.

Index

🎯 Features
  • πŸŽ™οΈ Voice Input (STT): Record from mic and auto-fill the input box on stop.
  • πŸ”€ Text-to-Text Translation: Deterministic translations between major languages.
  • πŸ”Š Text-to-Speech Output: Generate MP3 audio for the translated text.
  • 🌍 20+ Languages: Quick source/target selection via side-by-side dropdowns.
  • ⚑ Real-time UI: Immediate transcript update; mic and Translate on one line.
  • πŸ–₯️ Streamlit Frontend: Clean, responsive interface.
  • πŸ”— Flask Backend API: /stt for speechβ†’text, /translate for textβ†’translation+MP3, /audio/<file> for playback.
Model Used:
  1. Speech-to-Text: Wishper-1
  2. Text-to-Text: gpt-4o-mini
  3. Text-to-Speech: gpt-4o-mini-tts (voice: alloy)
Architecture Overview
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚          Streamlit UI        β”‚
                 β”‚  - Textarea (key="inp")      β”‚
 User speaks     β”‚  - ⏺️/⏹️ mic button         β”‚
 ──stop────────▢│  - Source/Target dropdowns   β”‚
                 β”‚  - Translate button          β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚           β”‚
             POST /stt   β”‚           β”‚   GET /translate?input_text
           (audio bytes) β”‚           └──────────────────────────────────────────────┐
                         β”‚                                                          β”‚
                         β–Ό                                                          β–Ό
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                 β”‚   Flask API       β”‚                                   β”‚      Flask API          β”‚
                 β”‚   /stt            β”‚                                   β”‚     /translate          β”‚
                 β”‚ - Whisper STT     β”‚                                   β”‚ - GPT-4o-mini translate β”‚
                 β”‚   β†’ {text}        β”‚                                   β”‚ - gpt-4o-mini-tts MP3   β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                   β”‚ - save β†’ /audio/*.mp3   β”‚
                          β”‚                                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚                                                          β”‚
        set st.session_state["inp"] ◀────────────── JSON { text }                   β”‚
                          β”‚                                                          β”‚
                          β–Ό                                                          β–Ό
                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       JSON { translated_text,
                 β”‚      Streamlit Output        β”‚                            audio_url:/audio/… }
                 β”‚  - Translated textarea ◀──────────────────────────────────────────┐
                 β”‚  - st.audio player     ◀─────────────┐                            β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β”‚                            β”‚
                                                         β–Ό                            β–Ό
                                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                               β”‚  Flask /audio/<id> │◀───── MP3 files on disk     β”‚
                                               β”‚  serves audio/mpeg β”‚      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
πŸ“Έ Model Outcome

Index

Author

πŸ‘€ Vetrivel Maheswaran

Connect With Me 🌐

LinkedIn

PortFolio

Β© Created by Vetrivel Maheswaran