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.*