Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- .gitattributes +2 -0
- README.md +14 -7
- app.py +59 -0
- examples/call_sample_1.wav +3 -0
- examples/call_sample_2.wav +3 -0
- requirements.txt +4 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
examples/call_sample_1.wav filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
examples/call_sample_2.wav filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,13 +1,20 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
python_version: '3.13'
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: NepaliConformer
|
| 3 |
+
emoji: 🏔️
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: gray
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: "5.44.1"
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
license: cc-by-nc-4.0
|
| 11 |
+
short_description: Nepali ASR built for real telephone calls, not read speech
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# NepaliConformer
|
| 15 |
+
|
| 16 |
+
Transcribe Nepali speech with a model trained for **real telephone audio**. On the NepTel
|
| 17 |
+
real-call benchmark it scores 33.8% WER where Whisper-large-v3 zero-shot scores ~99%.
|
| 18 |
+
|
| 19 |
+
Full release — models, benchmark, honest results including every measured limitation:
|
| 20 |
+
**https://github.com/Ampixa/nepaliconformer**
|
app.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""NepaliConformer demo — transcribe Nepali speech, tuned for real telephone audio."""
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
import gradio as gr
|
| 5 |
+
import torch
|
| 6 |
+
|
| 7 |
+
MODEL = None
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def get_model():
|
| 11 |
+
global MODEL
|
| 12 |
+
if MODEL is None:
|
| 13 |
+
from huggingface_hub import hf_hub_download
|
| 14 |
+
from nemo.collections.asr.models import EncDecHybridRNNTCTCBPEModel
|
| 15 |
+
path = hf_hub_download("ampixa/nepali-conformer-offline",
|
| 16 |
+
"nepali_conformer_offline.nemo")
|
| 17 |
+
torch.set_num_threads(2)
|
| 18 |
+
MODEL = EncDecHybridRNNTCTCBPEModel.restore_from(path, map_location="cpu")
|
| 19 |
+
MODEL.eval()
|
| 20 |
+
return MODEL
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def transcribe(audio_path):
|
| 24 |
+
if not audio_path:
|
| 25 |
+
return "(no audio)"
|
| 26 |
+
import soundfile as sf
|
| 27 |
+
info = sf.info(audio_path)
|
| 28 |
+
if info.duration > 60:
|
| 29 |
+
return "Please keep clips under 60 seconds for this CPU demo."
|
| 30 |
+
model = get_model()
|
| 31 |
+
out = model.transcribe([audio_path], batch_size=1, verbose=False)[0]
|
| 32 |
+
text = out.text if hasattr(out, "text") else str(out)
|
| 33 |
+
return " ".join(t for t in text.split() if t != "<breath>") or "(no speech detected)"
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
examples = [[f"examples/{f}"] for f in sorted(os.listdir("examples"))] \
|
| 37 |
+
if os.path.isdir("examples") else None
|
| 38 |
+
|
| 39 |
+
demo = gr.Interface(
|
| 40 |
+
fn=transcribe,
|
| 41 |
+
inputs=gr.Audio(sources=["microphone", "upload"], type="filepath",
|
| 42 |
+
label="Nepali speech (mic or file, ≤60 s)"),
|
| 43 |
+
outputs=gr.Textbox(label="Transcript (Devanagari)", rtl=False),
|
| 44 |
+
title="NepaliConformer — Nepali ASR for real telephone calls",
|
| 45 |
+
description=(
|
| 46 |
+
"121M Conformer trained on ~1,655 h of conversational Nepali. "
|
| 47 |
+
"**33.8% WER on real call-center audio** (NepTel benchmark) where Whisper-large-v3 "
|
| 48 |
+
"zero-shot scores ~99%. Honest limitations and the full benchmark: "
|
| 49 |
+
"[github.com/Ampixa/nepaliconformer](https://github.com/Ampixa/nepaliconformer). "
|
| 50 |
+
"CPU demo — a 30 s clip takes roughly 10-20 s. Example clips are real call-center "
|
| 51 |
+
"audio (CC-BY-4.0, © InfoBayAI)."
|
| 52 |
+
),
|
| 53 |
+
examples=examples,
|
| 54 |
+
cache_examples=False,
|
| 55 |
+
flagging_mode="never",
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
if __name__ == "__main__":
|
| 59 |
+
demo.launch()
|
examples/call_sample_1.wav
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e300320ba159319392cdae2b0f6c0573a1a4ee4498dc41486f8ef49a2617e84f
|
| 3 |
+
size 798764
|
examples/call_sample_2.wav
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:29cb08bbb62b5dcfd3d5aa454fc535652a338d7aaedd998bab35308f8f24d6d2
|
| 3 |
+
size 796844
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
nemo_toolkit[asr]==2.3.1
|
| 2 |
+
torch>=2.3,<2.6
|
| 3 |
+
soundfile
|
| 4 |
+
huggingface_hub
|