FastAPI backend for Nigerian language speech recognition and translation
# Naija ASR & Translation API
A FastAPI backend that powers speech recognition and translation for three Nigerian languages — **Hausa, Yoruba, and Igbo** — plus English. It transcribes voice to text with fine-tuned Whisper models and translates between languages with Meta's NLLB-200. Deployed on Hugging Face Spaces with a permanent public endpoint.
> **Mobile app:** This backend serves the Naija Translator mobile app. See that repo for the React Native client.
## Features
### Speech Recognition (ASR)
- **Nigerian language transcription** — Hausa, Yoruba, and Igbo via a fine-tuned Whisper model (`codeLumi/whisper-naija-v3b`, ~10% WER)
- **English transcription** — high-accuracy English voice via `openai/whisper-base`
- **Automatic model routing** — the API picks the right model based on the requested language
- **Multi-format audio** — accepts m4a, mp3, wav, and webm (decoded via ffmpeg)
### Translation
- **Bidirectional translation** — between English and any of the three Nigerian languages
- **Nigerian-to-Nigerian** — e.g. Hausa to Yoruba
- Powered by **NLLB-200** with FLORES language codes
### Pipeline
- **One-shot voice translation** — audio in, translated text out (ASR + translation chained)
## Tech Stack
| Layer | Technology |
| ---------------- | -------------------------------------------- |
| API framework | FastAPI |
| ASR models | Whisper (fine-tuned + base) via Transformers |
| Translation | NLLB-200 (distilled 1.3B) |
| Audio processing | librosa, soundfile, ffmpeg |
| ML runtime | PyTorch |
| Server | Uvicorn |
| Container | Docker |
| Hosting | Hugging Face Spaces |
## Models
All models are hosted on Hugging Face:
| Model …