Spaces:
Runtime error
Runtime error
jaekookang
commited on
Commit
Β·
bee682c
1
Parent(s):
1b88848
change to scipy
Browse files- gradio_asr_en_libri100.py +9 -7
- requirements.txt +1 -1
gradio_asr_en_libri100.py
CHANGED
@@ -13,7 +13,8 @@ import os
|
|
13 |
from glob import glob
|
14 |
from loguru import logger
|
15 |
# import soundfile as sf
|
16 |
-
import librosa
|
|
|
17 |
import gradio as gr
|
18 |
|
19 |
from espnet_model_zoo.downloader import ModelDownloader
|
@@ -53,7 +54,8 @@ logger.info('model loaded')
|
|
53 |
def predict(wav_file):
|
54 |
logger.info('wav file loaded')
|
55 |
# speech, rate = sf.read(wav_file)
|
56 |
-
speech, rate = librosa.load(wav_file, sr=16000)
|
|
|
57 |
nbests = model(speech)
|
58 |
text, *_ = nbests[0]
|
59 |
logger.info('predicted')
|
@@ -61,16 +63,16 @@ def predict(wav_file):
|
|
61 |
|
62 |
iface = gr.Interface(
|
63 |
predict,
|
64 |
-
title='
|
65 |
-
description='
|
66 |
inputs=[
|
67 |
-
gr.inputs.Audio(label='
|
68 |
],
|
69 |
outputs=[
|
70 |
-
gr.outputs.Textbox(label='
|
71 |
],
|
72 |
examples=examples,
|
73 |
-
article='<p style="text-align:center">
|
74 |
)
|
75 |
|
76 |
if __name__ == '__main__':
|
|
|
13 |
from glob import glob
|
14 |
from loguru import logger
|
15 |
# import soundfile as sf
|
16 |
+
# import librosa
|
17 |
+
from scipy.io import wavfile
|
18 |
import gradio as gr
|
19 |
|
20 |
from espnet_model_zoo.downloader import ModelDownloader
|
|
|
54 |
def predict(wav_file):
|
55 |
logger.info('wav file loaded')
|
56 |
# speech, rate = sf.read(wav_file)
|
57 |
+
# speech, rate = librosa.load(wav_file, sr=16000)
|
58 |
+
rate, speech = wavfile.read(wav_file)
|
59 |
nbests = model(speech)
|
60 |
text, *_ = nbests[0]
|
61 |
logger.info('predicted')
|
|
|
63 |
|
64 |
iface = gr.Interface(
|
65 |
predict,
|
66 |
+
title='ESPNet2 ASR Librispeech Conformer (trained on clean-100h)',
|
67 |
+
description='Upload your wav file to test the model',
|
68 |
inputs=[
|
69 |
+
gr.inputs.Audio(label='wav file', source='upload', type='filepath')
|
70 |
],
|
71 |
outputs=[
|
72 |
+
gr.outputs.Textbox(label='decoding result'),
|
73 |
],
|
74 |
examples=examples,
|
75 |
+
article='<p style="text-align:center">Model URL<a href="https://huggingface.co/jkang/espnet2_librispeech_100_conformer">π€</a></p>',
|
76 |
)
|
77 |
|
78 |
if __name__ == '__main__':
|
requirements.txt
CHANGED
@@ -3,4 +3,4 @@ espnet_model_zoo==0.1.7
|
|
3 |
gradio==2.7.5.2
|
4 |
loguru==0.6.0
|
5 |
librosa
|
6 |
-
|
|
|
3 |
gradio==2.7.5.2
|
4 |
loguru==0.6.0
|
5 |
librosa
|
6 |
+
scipy==1.7.3
|