Spaces:
Sleeping
Sleeping
Commit
·
b89d1a0
1
Parent(s):
780f607
Updated app.py: added radio checkbox for model branch selection
Browse files
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
import os
|
2 |
import gradio as gr
|
3 |
from transformers import pipeline, Wav2Vec2ProcessorWithLM
|
|
|
4 |
|
5 |
-
def transcribe(audio, model_id):
|
6 |
# load processor
|
7 |
-
p = Wav2Vec2ProcessorWithLM.from_pretrained(model_id, revision=
|
8 |
# load eval pipeline
|
9 |
asr = pipeline("automatic-speech-recognition", model=model_id, tokenizer=p.tokenizer, feature_extractor=p.feature_extractor, decoder=p.decoder, token=os.getenv('HF_TOKEN'))
|
10 |
|
@@ -21,11 +21,12 @@ asr_app = gr.Interface(
|
|
21 |
"asr-africa/wav2vec2-xls-r-1b-naijavoices-igbo-500hr-v0",
|
22 |
"asr-africa/wav2vec2-xls-r-1b-naijavoices-yoruba-500hr-v0"
|
23 |
]
|
24 |
-
)
|
|
|
25 |
],
|
26 |
outputs="text",
|
27 |
title="NaijaVoices ASR",
|
28 |
-
description="Realtime demo for Hausa, Igbo and Yoruba speech recognition using a fine-tuned
|
29 |
)
|
30 |
|
31 |
asr_app.launch(share=True)
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline, Wav2Vec2ProcessorWithLM
|
3 |
+
import os
|
4 |
|
5 |
+
def transcribe(audio, model_id, model_revison):
|
6 |
# load processor
|
7 |
+
p = Wav2Vec2ProcessorWithLM.from_pretrained(model_id, revision=model_revison)
|
8 |
# load eval pipeline
|
9 |
asr = pipeline("automatic-speech-recognition", model=model_id, tokenizer=p.tokenizer, feature_extractor=p.feature_extractor, decoder=p.decoder, token=os.getenv('HF_TOKEN'))
|
10 |
|
|
|
21 |
"asr-africa/wav2vec2-xls-r-1b-naijavoices-igbo-500hr-v0",
|
22 |
"asr-africa/wav2vec2-xls-r-1b-naijavoices-yoruba-500hr-v0"
|
23 |
]
|
24 |
+
),
|
25 |
+
gr.Radio(["main","lm"])
|
26 |
],
|
27 |
outputs="text",
|
28 |
title="NaijaVoices ASR",
|
29 |
+
description="Realtime demo for Hausa, Igbo and Yoruba speech recognition using a fine-tuned Wav2Vec2-XLS-R 1B model.",
|
30 |
)
|
31 |
|
32 |
asr_app.launch(share=True)
|