Spaces:
Runtime error
Runtime error
| 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.* | |