Ethio-ASR Medical API
Long-form, multi-speaker transcription for Ethiopian languages, packaged for Hugging Face Inference Endpoints.
Pipeline: silero-VAD (chunking) β pyannote/speaker-diarization-3.1 (speaker labels) β boazsew/Ethio-ASR-w2v-bert-2.0-uf (ASR for 5 Ethiopian languages: Amharic, Tigrinya, Oromo, Sidaama, Wolaytta).
Built for a mobile app that records doctorβpatient consultations and returns speaker-labelled transcripts.
Two deployment paths
Path A β Python handler (simpler, sync only)
Use the Inference Endpoint UI:
- Go to https://ui.endpoints.huggingface.co
- Click New Endpoint β pick this repo (
boazsew/Ethio-ASR-medical-api). - Container type: Default.
- Task: Custom.
- Hardware: GPU Β· NVIDIA L4 Β· ~$0.80/hr (good starting point).
- Environment variables:
HF_TOKEN= a read token from https://huggingface.co/settings/tokens (needed to download the gated diarizer).
- Click Create Endpoint. First boot takes ~5 min (model downloads).
Request format:
curl https://<your-id>.endpoints.huggingface.cloud \
-H "Authorization: Bearer $HF_TOKEN" \
-H "Content-Type: audio/wav" \
--data-binary @visit.wav
Returns the full transcript JSON when done. Suitable for clips up to ~15 minutes (longer than that, HF's request timeout may fire).
Path B β Custom Docker (full FastAPI, supports SSE streaming)
Use this when you want /transcribe/stream (live transcript turns
arriving as they're produced) or multiple endpoints.
- Build & push the image (one-time, from your laptop):
docker build -f Dockerfile -t boazsew/ethio-asr-api:0.1 . docker push boazsew/ethio-asr-api:0.1 - Inference Endpoints UI β New Endpoint β Container type: Custom.
- Container URL:
docker.io/boazsew/ethio-asr-api:0.1 - Container port:
80 - Health check path:
/health - Environment variables:
HF_TOKEN(for the diarizer download)API_TOKEN(bearer token your mobile app must present β generate withopenssl rand -hex 24)
- Hardware: GPU Β· NVIDIA L4 (or A10G for faster long-form).
Request format:
# Sync
curl https://<your-id>.endpoints.huggingface.cloud/transcribe \
-H "Authorization: Bearer $API_TOKEN" \
-F audio=@visit.wav
# Streaming (Server-Sent Events)
curl -N https://<your-id>.endpoints.huggingface.cloud/transcribe/stream \
-H "Authorization: Bearer $API_TOKEN" \
-F audio=@visit.wav
Response shape
{
"duration_s": 480.3,
"languages": ["amh", "tir"],
"num_speakers": 2,
"turns": [
{"speaker": "SPEAKER_00", "start_s": 0.0, "end_s": 4.2,
"text": "α°αα αααα", "language": "amh"},
{"speaker": "SPEAKER_01", "start_s": 4.5, "end_s": 9.1,
"text": "selam le alem", "language": "amh"}
],
"processing_time_s": 42.3
}
For streaming (Path B /transcribe/stream):
event: meta
data: {"duration_s": 480.3, "num_chunks": 32, "num_speakers_initial": 2}
event: turn
data: {"speaker": "SPEAKER_00", "start_s": 0.0, "end_s": 4.2, ...}
event: done
data: {"languages": ["amh", "tir"], "num_speakers": 2, "num_turns_final": 18}
Notes
- First request after deploy / scale-up takes ~30 s extra for model load.
Set
min_replicas=1if you want always-on (costs more). - Audio limits: 50 MB upload, ~45 min duration. Longer audio should be chunked client-side.
- Server does not retain audio β files are deleted from the temp dir immediately after the response is returned.
- No medical-vocabulary patch. Drug names and Latin terms transcribe phonetically. Fine for v1; future work could add an LM rescorer.