Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from speechbrain.inference.ASR import EncoderASR
|
| 2 |
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(
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
demo.launch()
|
|
|
|
| 1 |
+
# from speechbrain.inference.ASR import EncoderASR
|
| 2 |
+
# import gradio as gr
|
| 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 |
+
|
| 10 |
+
# demo = gr.Interface(fn=transcribe, inputs="file", outputs="text",
|
| 11 |
+
# title="Transcription automatique du wolof",
|
| 12 |
+
# description="Ce modèle transcrit un fichier audio en wolof en texte en utilisant l'alphabet latin.",
|
| 13 |
+
# input_label="Audio en wolof",
|
| 14 |
+
# output_label="Transcription alphabet latin"
|
| 15 |
+
# )
|
| 16 |
+
|
| 17 |
+
# demo.launch()
|
| 18 |
+
|
| 19 |
+
|
| 20 |
from speechbrain.inference.ASR import EncoderASR
|
| 21 |
import gradio as gr
|
| 22 |
|
| 23 |
model = EncoderASR.from_hparams("speechbrain/asr-wav2vec2-dvoice-wolof")
|
| 24 |
|
| 25 |
def transcribe(audio):
|
| 26 |
+
return model.transcribe_file(audio.name)
|
| 27 |
|
| 28 |
+
def transcribe_microphone(audio):
|
| 29 |
+
return model.transcribe_array(audio)
|
| 30 |
|
| 31 |
+
demo = gr.Interface(
|
| 32 |
+
fn=[transcribe, transcribe_microphone],
|
| 33 |
+
inputs=["file", gr.inputs.Microphone(audio=False)],
|
| 34 |
+
outputs="text",
|
| 35 |
+
title="Transcription automatique du wolof",
|
| 36 |
+
description="Ce modèle transcrit un fichier audio en wolof en texte en utilisant l'alphabet latin.",
|
| 37 |
+
input_labels=["Audio en wolof", "Microphone (parlez en wolof)"],
|
| 38 |
+
output_label="Transcription alphabet latin"
|
| 39 |
+
)
|
| 40 |
|
| 41 |
+
demo.launch()
|