--- title: Mic Translator emoji: ๐ŸŒ colorFrom: indigo colorTo: purple sdk: gradio sdk_version: 4.19.2 app_file: app.py pinned: false --- # MIC Translator โ€“ Offline AI-Powered Real-Time Multilingual Voice Translation System MIC Translator v3.0 is a production-grade, modular translation system. It performs high-precision voice transcription, text correction, automatic source language detection, offline/online hybrid text-to-speech synthesis, and multi-language translation entirely on your local machine. --- ## ๐Ÿš€ Quick Start ### Step 1 โ€” Install Dependencies Run the install batch script to set up packages (Flask, Whisper, NLLB-200, Piper support, and dependencies): ```bat install.bat ``` ### Step 2 โ€” Start the Translation Dashboard Launch the server: ```bat run_dashboard.bat ``` Then open your web browser at: **[http://localhost:5000](http://localhost:5000)** --- ## ๐Ÿ“ Modular Project Structure ``` MIC dashboard/ โ”œโ”€โ”€ app.py โ† Clean Flask router (routes & endpoints) โ”œโ”€โ”€ config.py โ† App configuration & NLLB-200 language mapping โ”œโ”€โ”€ speech.py โ† Offline Speech-to-Text (OpenAI Whisper) โ”œโ”€โ”€ translator.py โ† Offline Translation Engine (Meta NLLB-200) โ”œโ”€โ”€ language_detector.py โ† Offline language script analysis โ”œโ”€โ”€ correction_engine.py โ† Real-time slang/short-form/spoken-word correction pipeline โ”œโ”€โ”€ dataset_loader.py โ† FLORES, OPUS, Tatoeba, and custom dataset manager โ”œโ”€โ”€ history.py โ† Saved translations, favorites, CSV/JSON exports, and analytics โ”œโ”€โ”€ tts.py โ† Hybrid TTS (Offline Piper + Online gTTS fallback) โ”œโ”€โ”€ static/ โ”‚ โ”œโ”€โ”€ app.js โ† Searchable selection, recorder, history, & status polling โ”‚ โ””โ”€โ”€ style.css โ† Premium dark mode user interface โ”œโ”€โ”€ templates/ โ”‚ โ””โ”€โ”€ index.html โ† Main dashboard markup โ”œโ”€โ”€ datasets/ โ”‚ โ”œโ”€โ”€ custom/ โ† Directory for custom parallel translation files (JSON/CSV) โ”‚ โ””โ”€โ”€ corrections.json โ† 180+ pre & post-translation correction dictionary rules โ”œโ”€โ”€ tests/ โ”‚ โ””โ”€โ”€ test_all.py โ† 80-test verification suite โ””โ”€โ”€ README.md ``` --- ## ๐ŸŽ™๏ธ Core Pipelines ``` Voice Speech โ†“ OpenAI Whisper (Offline STT) โ†“ Correction Engine (Pre-translation cleanup: slang, abbreviations) โ†“ Language Detector (Script/Heuristic auto-detection) โ†“ Meta NLLB-200 (Offline Translation) โ†“ Correction Engine (Post-translation refinement) โ†“ TTS Engine (Offline Piper Voice -> fall back to gTTS Online) ``` --- ## โš™๏ธ Requirements & Offline Compatibility * **Python:** Version 3.9 or higher * **FFmpeg:** Required for offline Whisper audio processing ([Download FFmpeg](https://ffmpeg.org/download.html)) and added to your system's `PATH`. * **Microphone:** Built-in or external mic. * **Fully Offline Support:** * **Speech Recognition:** 100% Offline (Whisper base model). * **Translation:** 100% Offline (NLLB-Distilled-600M). * **Text-to-Speech:** Offline voice synthesis is configured for **English (`en`)** and **Hindi (`hi`)** using local Piper ONNX files. * **Adding Offline Voices:** To speak other languages offline, download `.onnx` and `.json` model files from the [Piper Repository](https://huggingface.co/rhasspy/piper-voices/tree/main) and drop them inside the `voices/` directory. If a local model is not present, the system automatically uses the online `gTTS` fallback to speak. --- ## ๐Ÿงช Verification Run the automated test suite to verify configuration, translation, history caching, script detection, and corrector pipeline components: ```bash python tests/test_all.py ``` *Built for high-performance offline voice and text translation.*