A Kinyarwanda voice assistant
# 🗣️ Kinyarwanda Voice Assistant
A bilingual voice interaction tool utilizing Whisper for transcribing speech and TTS for generating speech from text. It includes an intuitive Gradio interface featuring two functional tabs: voice-based Q&A and custom TTS synthesis.
---
## 🔧 Key Functionalities
- 🎙️ **Automatic Speech Recognition** powered by Whisper.
- 💬 **Kinyarwanda-based Question Answering** from preset responses.
- 🔊 **Text-to-Speech Synthesis** using models from Hugging Face.
- 🖥️ **Interactive Web UI** built with Gradio.
- 🔁 **Speaker Cloning** using reference audio files.
- 🌍 **Launchable Web Interface** with optional public sharing.
---
## 🛠️ Installation Guide
### ⚙️ Python Dependencies
Ensure your Python environment is ready by installing the required libraries:
```bash
pip install -q openai-whisper
pip install numpy==1.24.3 --force-reinstall
pip install gradio
pip install transformers
pip install torchaudio
pip install TTS
pip install nemo-toolkit
Alternatively, install from the requirements file:
bash
Copy
Edit
pip install --no-cache-dir -r /content/drive/MyDrive/kinya-assistant/stt/requirements.txt
🧰 Required System Packages
Install sox for audio manipulation:
bash
Copy
Edit
apt-get update && apt-get install -y sox libsox-fmt-all
🚀 Getting Started
🎤 Using the Voice Assistant
Record your voice or upload an audio file.
Workflow:
Audio is transcribed using Whisper.
Text is matched to predefined Kinyarwanda inputs.
Audio response is generated and played.
📢 Text-to-Speech Module
Input your custom text.
Upload a .wav file as a voice sample.
Select the target language.
The assistant will generate speech and play it.
🧠 Behind the Scenes
Loading the Models
python
Copy
Edit
whisper_model = whisper.load_model("small")
hf_model = TTS(model_name="tts_models/en/ljspeech/tacotron2-DDC")
Audio Transcription Process
python
Copy
Edit
def transcribe_audio(audio_path):
waveform, sample_rate = torchaudio.load(audio_path)
...
result = whisper_model.transc …