MIC-Off / README.md
VethaNarayananG's picture
Add Gradio metadata frontmatter to README for free Hugging Face Spaces hosting
160bc06
|
Raw
History Blame Contribute Delete
3.88 kB

A newer version of the Gradio SDK is available: 6.24.0

Upgrade
metadata
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):

install.bat

Step 2 β€” Start the Translation Dashboard

Launch the server:

run_dashboard.bat

Then open your web browser at: 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) 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 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:

python tests/test_all.py

Built for high-performance offline voice and text translation.