Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
from inference import *
|
3 |
from script import *
|
4 |
-
import librosa
|
5 |
import soundfile as sf
|
6 |
|
7 |
|
8 |
def preprocess_audio(audio_array):
|
9 |
try:
|
10 |
-
|
11 |
-
|
12 |
-
y, sr = librosa.load(audio_array, sr=48000)
|
13 |
-
sf.write('audio.wav', y, samplerate=48000, subtype='PCM_16')
|
14 |
return 'audio.wav'
|
15 |
except TypeError as e:
|
16 |
pass
|
@@ -41,7 +38,7 @@ def interface(Language, Audio_Inp):
|
|
41 |
demo = gr.Interface(
|
42 |
fn=interface,
|
43 |
inputs=[gr.Dropdown(['Hausa', 'English', 'Yoruba'],
|
44 |
-
value = 'Hausa', label='Select Your Prefered Language'), gr.Audio(source ='microphone', type='
|
45 |
outputs="text",
|
46 |
live=True
|
47 |
)
|
|
|
1 |
import gradio as gr
|
2 |
from inference import *
|
3 |
from script import *
|
|
|
4 |
import soundfile as sf
|
5 |
|
6 |
|
7 |
def preprocess_audio(audio_array):
|
8 |
try:
|
9 |
+
_, array = audio_array
|
10 |
+
sf.write('audio.wav', array, samplerate=48000, subtype='PCM_16')
|
|
|
|
|
11 |
return 'audio.wav'
|
12 |
except TypeError as e:
|
13 |
pass
|
|
|
38 |
demo = gr.Interface(
|
39 |
fn=interface,
|
40 |
inputs=[gr.Dropdown(['Hausa', 'English', 'Yoruba'],
|
41 |
+
value = 'Hausa', label='Select Your Prefered Language'), gr.Audio(source ='microphone', type='numpy')],
|
42 |
outputs="text",
|
43 |
live=True
|
44 |
)
|