A comprehensive and powerful application that provides seamless voice and audio translation into various major Indian languages.
This project offers two different interfaces to suit your needs:
- Modern Web Application (
main.py): A sleek, high-aesthetic Glassmorphism-styled web application powered by FastAPI. It runs locally in your browser and accesses your microphone natively! - Desktop GUI Application (
app.py): A native Python desktop application built withTkinterfor a traditional windowed experience.
Both applications use speech_recognition via Google APIs for robust Speech-to-Text (STT), deep-translator for accurate text translation, and gTTS for natural Text-to-Speech (TTS) synthesis.
Before starting, make sure you have the following installed on your system:
- Python 3.10+: Make sure Python is installed and added to your system PATH.
- uv (Recommended): An extremely fast Python package and environment manager. A standard
pipsetup can also be used. - FFmpeg (Optional but highly recommended): Required by
pydubto process non-WAV media uploads (like.mp3or.webmfrom browsers and phones).- Windows: Download from the official website and add it to your PATH variables.
- Mac:
brew install ffmpeg - Linux:
sudo apt install ffmpeg
Follow these steps to get the app running:
Open a terminal (Command Prompt, PowerShell, or bash) and run: bash git clone cd indian-language-translator
This project uses uv for lightning-fast package management to ensure you don't run into dependency issues.
To sync and install all required packages listed in pyproject.toml and uv.lock, simply run:
bash uv sync
(If you don't use uv, you can manually spawn a virtual environment and run pip install -r requirements.txt or install the packages defined in the pyproject.toml file).
This launches a beautiful, browser-based user interface with animated glassmorphism design.
-
Start the Backend Server: From your project directory, launch FastAPI using
uv: bash uv run python main.pyYou should see a message indicating the server is running on
http://127.0.0.1:8000. -
Open the Application: Open your preferred web browser and go to: http://127.0.0.1:8000
-
How to Use the Web App:
- Language Configuration: Select your spoken language (Source) and the Indian language you want to translate to (Target) from the dropdown menus.
- Upload Audio File: Click Upload Audio to choose an audio file from your computer. (Accepts
.wav, and other formats if FFmpeg is installed). - Record directly: Click and hold 🎙️ Record from Mic to speak directly into your computer's microphone. Your browser will prompt you for microphone permissions the first time.
- Listen & Read: The app will display your transcribed input text, the translated text, and an audio player will dynamically load at the bottom so you can listen to the resulting translation!
This launches a native OS window with traditional UI elements.
-
Start the Desktop App: From your terminal, execute the following command: bash uv run python app.py
A traditional software window titled "Indian Language Voice Translator" will appear.
-
How to Use the Desktop App:
- Use the dropdowns at the top to select your Input Language and Output Language.
- Click 📁 Upload Audio File to browse your PC for an audio file to translate.
- Click 🎙️ Record from Mic to capture live voice using your desktop microphone. Ensure you wait for the console prompt saying "Listening..." before you speak.
- Wait for the processing to finish. The app explicitly updates its status letting you know what it is doing (transcribing, translating, etc.).
- The original text, translated text will populate the text boxes, and the resulting speech output will automatically play on your system media player!
main.py: The FastAPI server. It exposes a single endpoint/api/processthat accepts audio blobs, usesspeech_recognitionto resolve STT, processes it withGoogleTranslator, builds an MP3 buffer viagTTS, and returns it as a Base64 string for immediate in-browser playback. It also serves the frontend.app.py: The Tkinter GUI desktop version. Everything runs synchronously within thread wrappers, using your default OS handlers to manage outputs.static/index.html: The entire frontend interface for the web app uses pure Vanilla JS without any bulky node dependencies.