Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,22 +22,18 @@ import gradio as gr
|
|
| 22 |
|
| 23 |
model = EncoderASR.from_hparams("speechbrain/asr-wav2vec2-dvoice-wolof")
|
| 24 |
|
| 25 |
-
def transcribe(
|
| 26 |
-
sr, y =
|
| 27 |
y = y.astype(np.float32)
|
| 28 |
y /= np.max(np.abs(y))
|
| 29 |
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
else:
|
| 33 |
-
stream = y
|
| 34 |
-
return stream, transcriber({"sampling_rate": sr, "raw": stream})["text"]
|
| 35 |
|
| 36 |
demo = gr.Interface(
|
| 37 |
transcribe,
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
live=True,
|
| 41 |
)
|
| 42 |
|
| 43 |
demo.launch()
|
|
|
|
| 22 |
|
| 23 |
model = EncoderASR.from_hparams("speechbrain/asr-wav2vec2-dvoice-wolof")
|
| 24 |
|
| 25 |
+
def transcribe(audio):
|
| 26 |
+
sr, y = audio
|
| 27 |
y = y.astype(np.float32)
|
| 28 |
y /= np.max(np.abs(y))
|
| 29 |
|
| 30 |
+
return transcriber({"sampling_rate": sr, "raw": y})["text"]
|
| 31 |
+
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
demo = gr.Interface(
|
| 34 |
transcribe,
|
| 35 |
+
gr.Audio(sources=["microphone"]),
|
| 36 |
+
"text",
|
|
|
|
| 37 |
)
|
| 38 |
|
| 39 |
demo.launch()
|