Spaces:
Runtime error
Runtime error
File size: 3,880 Bytes
160bc06 b97b788 4879a5b 160bc06 b97b788 4879a5b b97b788 4879a5b b97b788 4879a5b b97b788 4879a5b b97b788 4879a5b b97b788 4879a5b b97b788 4879a5b b97b788 4879a5b b97b788 4879a5b b97b788 4879a5b b97b788 4879a5b b97b788 4879a5b b97b788 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | ---
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.*
|