Spaces:
Build error
Build error
| # 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): | |
| sr, y = audio | |
| y = y.astype(np.float32) | |
| y /= np.max(np.abs(y)) | |
| return transcriber({"sampling_rate": sr, "raw": y})["text"] | |
| demo = gr.Interface( | |
| transcribe, | |
| gr.Audio(sources=["microphone"]), | |
| "text", | |
| ) | |
| demo.launch() | |