papasega's picture
Update app.py
89d2839 verified
raw
history blame
1.36 kB
# from speechbrain.inference.ASR import EncoderASR
# import gradio as gr
# model = EncoderASR.from_hparams("speechbrain/asr-wav2vec2-dvoice-wolof")
# def transcribe(audio):
# return model.transcribe_file(audio.name)
# demo = gr.Interface(fn=transcribe, inputs="file", outputs="text",
# title="Transcription automatique du wolof",
# description="Ce modèle transcrit un fichier audio en wolof en texte en utilisant l'alphabet latin.",
# input_label="Audio en wolof",
# output_label="Transcription alphabet latin"
# )
# demo.launch()
from speechbrain.inference.ASR import EncoderASR
import gradio as gr
model = EncoderASR.from_hparams("speechbrain/asr-wav2vec2-dvoice-wolof")
def transcribe(audio):
return model.transcribe_file(audio.name)
def transcribe_microphone(audio):
return model.transcribe_array(audio)
demo = gr.Interface(
fn=[transcribe, transcribe_microphone],
inputs=["file", gr.inputs.Microphone(audio=False)],
outputs="text",
title="Transcription automatique du wolof",
description="Ce modèle transcrit un fichier audio en wolof en texte en utilisant l'alphabet latin.",
input_labels=["Audio en wolof", "Microphone (parlez en wolof)"],
output_label="Transcription alphabet latin"
)
demo.launch()