Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,8 +3,14 @@ import gradio as gr
|
|
3 |
|
4 |
model = EncoderASR.from_hparams("speechbrain/asr-wav2vec2-dvoice-wolof")
|
5 |
|
|
|
|
|
|
|
6 |
def transcribe(audio):
|
7 |
-
|
|
|
|
|
|
|
8 |
|
9 |
|
10 |
demo = gr.Interface(fn=transcribe, inputs=["file", "microphone"], outputs="text",
|
|
|
3 |
|
4 |
model = EncoderASR.from_hparams("speechbrain/asr-wav2vec2-dvoice-wolof")
|
5 |
|
6 |
+
# def transcribe(audio):
|
7 |
+
# return model.transcribe_file(audio.name)
|
8 |
+
|
9 |
def transcribe(audio):
|
10 |
+
if isinstance(audio, str): # If input is a file path
|
11 |
+
return model.transcribe_file(audio.name)
|
12 |
+
else: # If input is audio data from microphone
|
13 |
+
return model.transcribe_array(audio)
|
14 |
|
15 |
|
16 |
demo = gr.Interface(fn=transcribe, inputs=["file", "microphone"], outputs="text",
|