Serverless Moroccan Darija speech-to-text API on Modal
# Darija ASR on Modal
Deploy a serverless Moroccan Darija speech-to-text API on Modal using a Whisper Large v3 Turbo base model and a Darija LoRA adapter.
The deployed service exposes:
```text
POST /transcribe
```
Request body:
```json
{
"filename": "sample.m4a",
"audio_base64": "..."
}
```
Response body:
```json
{
"text": "دارجة مكتوبة بالعربية",
"model": "anaszil/whisper-large-v3-turbo-darija",
"base_model": "openai/whisper-large-v3-turbo",
"filename": "sample.m4a",
"audio_bytes": 123456,
"duration_seconds": 2.345
}
```
## Model
- Base model: `openai/whisper-large-v3-turbo`
- Darija LoRA adapter: `anaszil/whisper-large-v3-turbo-darija`
- Runtime: Modal serverless GPU, default `L4`
- Supported audio formats: WAV, MP3, M4A, OGG, and other formats supported by `ffmpeg`
The Darija adapter model card lists the adapter as MIT licensed and reports WER around 24.88% and CER around 8.28% on its evaluation set. Review the upstream model cards before using this in production.
## Prerequisites
Install:
- Python `3.11+`
- `uv`
- A Modal account
Install `uv` if needed:
```bash
curl -LsSf
astral.sh | sh
```
Authenticate Modal:
```bash
uv run modal setup
```
## Setup
Clone the repository and install local tooling:
```bash
git clone
cd darija-model-speech-to-text
uv sync
```
Create your local environment file:
```bash
cp .env.example .env
```
Generate a test API key and put it in `.env`:
```bash
python - --transcribe.modal.run
```
Check the deployed service:
```bash
curl https:// --transcribe.modal.run/healthz
```
Expected response:
```json
{
"status": "ok",
"model": "anaszil/whisper-large-v3-turbo-darija",
"base_model": "openai/whisper-large-v3-turbo"
}
```
## Test With Audio
Put local test audio files in:
```text
entry-point-audio-files/
```
This directory is ignored by git so private audio is not committed.
Run a transcription test:
```bash
uv run python scripts/test_endpoint.py \
--url "https:// --transcribe.modal.run" \ …