Nigeria English accent and pidgin speech to Text
# ToriType — Nigerian English & Pidgin Speech‑to‑Text
Professional, inclusive STT built for Nigerian voices. Fine‑tuned Whisper model, modern UX, and scalable cloud deployment.
Built during the AltSchool Africa Hackathon.
## Highlights
- Accurate transcription for Nigerian English and Pidgin (Whisper + LoRA)
- Modern, responsive dashboard (Next.js + Tailwind)
- Browser recording and audio upload
- Pidgin‑aware post‑processing that preserves culture
- Split, scalable architecture: ML on Hugging Face Spaces, API on Render
## Architecture
- Frontend: `Frontend/` (Next.js 15, React 19, Tailwind)
- Backend API: `Backend/app/` (FastAPI, MongoDB Atlas)
- ML Inference Service: `Backend/hf_space/` (FastAPI on Hugging Face Spaces)
- Training scripts: `Backend/ml/scripts/`
Data flow:
1) Browser records or uploads audio
2) Frontend calls Backend `/transcription/transcribe`
3) Backend forwards file to Hugging Face Space `/transcribe`
4) Result is post‑processed and stored in MongoDB
## Live/Deploy Targets
- ML Service: Hugging Face Space (URL set via `ML_SERVICE_URL`)
- API: Render service (FastAPI) with CORS for the Vercel URL
- Frontend: Vercel
## Quick Start
Frontend
```bash
cd Frontend
npm install
npm run dev
```
Backend
```bash
cd Backend
python -m venv .venv
source .venv/Scripts/activate
pip install -r requirements.txt
cp .env.sample .env # fill values
uvicorn app.main:app --reload --port 8000
```
Key env vars (see `Backend/.env.sample`):
- `MONGO_URI, MONGO_DB_NAME, MONGO_COLLECTION_NAME`
- `SECRET_KEY, ALGORITHM, ACCESS_TOKEN_EXPIRE_MINUTES`
- `ML_SERVICE_URL` (HF Space base URL)
## API Overview
- `POST /transcription/transcribe` — form‑data `file=@audio.wav`
- `GET /transcription/{id}` — fetch stored transcript
- `POST /transcription/sentiment` — `{ text }`
The Backend internally calls the Space endpoints:
- `POST {ML_SERVICE_URL}/transcribe`
- `POST {ML_SERVICE_URL}/sentiment`
## Data Sources & Citations
- Whisper: Radford et al., “Robust Speech …