Views
No views yet
src/transcribers/badrex.py. Native Tigrinya ASR that beat MMS in the
2026-06-14 eval.BADREX_MODEL environment variable
(default badrex/Ethio-ASR-multilingual-1B). The handler holds no weights —
they're pulled from the Hub on cold start, same as the MMS endpoint.chunk_length_s=30,
stride_length_s=5), so a full broadcast goes through in one request — no
client-side splitting, and no OOM on hour-long audio.badrex-endpoint.1cd endpoint-badrex/
2git init
3git remote add origin https://huggingface.co/YOUR_USERNAME/badrex-endpoint
4git add handler.py requirements.txt config.json
5git commit -m "add badrex custom handler"
6git push origin main| Setting | Value |
|---|---|
| Model repository | YOUR_USERNAME/badrex-endpoint |
| Task | Custom |
| Hardware | GPU · T4 · 1x |
| Min replicas | 0 (scale to zero) |
| Max replicas | 1 |
| Variable | Value |
|---|---|
BADREX_MODEL | badrex/Ethio-ASR-multilingual-1B (default; auto-detects am/ti, robust to Amharic-leakage on bilingual ti channels) |
or badrex/Ethio-ASR-tigrinya (lighter, monolingual, slightly cleaner on pure Tigrinya) |
channels.yaml:1settings:
2 asr_routing: {ti: badrex} # send Tigrinya to badrex; everything else stays on MMS
3
4badrex:
5 device: api
6 api_url: https://YOUR-ENDPOINT-ID.endpoints.huggingface.cloud
7 api_token: null # set HF_TOKEN environment variable insteadapi mode the endpoint is the model, so badrex.models /
badrex.default_model are ignored — the served checkpoint is whatever
BADREX_MODEL selects.handler.py, then Settings → Revision
(pin a commit SHA, or track main) → Update Endpoint. The URL is unchanged,
so channels.yaml needs no edit. Switching the served model is just an env-var
change (BADREX_MODEL) + endpoint restart — no code push.1import base64, requests
2
3with open("audio.webm", "rb") as f:
4 b64 = base64.b64encode(f.read()).decode()
5
6r = requests.post(
7 "https://YOUR-ENDPOINT-ID.endpoints.huggingface.cloud",
8 headers={"Authorization": "Bearer hf_...", "Content-Type": "application/json"},
9 json={"inputs": b64},
10)
11print(r.json()["text"]) # the multilingual model's leading [TIR] tag is stripped client-sidelanguage parameter — the deployed model is the language selector. The
multilingual model emits a leading [TIR]/[AMH] tag; the newsgrab client
(src/transcribers/badrex.py) strips it. If you call the endpoint directly,
strip ^\s*\[[A-Za-z]{2,4}\]\s* yourself.min replicas: 0) means no idle cost; cold start (model load)
is ~60–90 s. HF Endpoints accept up to ~100 MB per request — fine for full
broadcasts as base64.torch/torchaudio are pre-installed in the HF endpoint base image; only
transformers>=4.44.0 is declared (wav2vec2-bert + pipeline support).Source: badrex-api on the newsgrab side — distinct from
mms/gcp, so recheck-captions and prefer_mms are untouched.