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(audio): if isinstance(audio, str): # If input is a file path return model.transcribe_file(audio.name) else: # If input is audio data from microphone return model.transcribe_array(audio) demo = gr.Interface(fn=transcribe, inputs=["file", "microphone"], outputs="text", title="Transcription audio en wolof latin by Papa Séga", 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()