Spaces:
Runtime error
Runtime error
update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
import nemo.collections.asr as nemo_asr
|
3 |
from pydub import AudioSegment
|
4 |
import pyaudioconvert as pac
|
5 |
-
|
6 |
|
7 |
hf_model = nemo_asr.models.EncDecRNNTBPEModel.from_pretrained(
|
8 |
model_name="mbazaNLP/Kinyarwanda_nemo_stt_conformer_model")
|
@@ -23,16 +23,15 @@ def convert (audio):
|
|
23 |
|
24 |
def transcribe(audio, audio_microphone):
|
25 |
audio = audio_microphone if audio_microphone else audio
|
26 |
-
start = timeit.default_timer()
|
27 |
if convert(audio)== False:
|
28 |
return "The format must be mp3,wav and ogg"
|
29 |
|
30 |
files = [audio.name]
|
31 |
print(audio.name)
|
|
|
32 |
for fname, transcription in zip(files, hf_model.transcribe(paths2audio_files=files)):
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
gradio_ui = gr.Interface(
|
37 |
fn=transcribe,
|
38 |
title="Kinyarwanda Speech Recognition",
|
|
|
2 |
import nemo.collections.asr as nemo_asr
|
3 |
from pydub import AudioSegment
|
4 |
import pyaudioconvert as pac
|
5 |
+
|
6 |
|
7 |
hf_model = nemo_asr.models.EncDecRNNTBPEModel.from_pretrained(
|
8 |
model_name="mbazaNLP/Kinyarwanda_nemo_stt_conformer_model")
|
|
|
23 |
|
24 |
def transcribe(audio, audio_microphone):
|
25 |
audio = audio_microphone if audio_microphone else audio
|
|
|
26 |
if convert(audio)== False:
|
27 |
return "The format must be mp3,wav and ogg"
|
28 |
|
29 |
files = [audio.name]
|
30 |
print(audio.name)
|
31 |
+
result= "The format must be mp3,wav and ogg"
|
32 |
for fname, transcription in zip(files, hf_model.transcribe(paths2audio_files=files)):
|
33 |
+
result= transcription[0]
|
34 |
+
return result
|
|
|
35 |
gradio_ui = gr.Interface(
|
36 |
fn=transcribe,
|
37 |
title="Kinyarwanda Speech Recognition",
|