Spaces:
Runtime error
Runtime error
| import os | |
| os.environ["TRANSFORMERS_NO_TF"] = "1" | |
| from transformers import pipeline | |
| import gradio as gr | |
| # Explicitly define the task so HF knows it's ASR | |
| pipe = pipeline( | |
| task="automatic-speech-recognition", | |
| model="Sammau/wav2vec2-large-xls-r-300m-dv-ng" | |
| ) | |
| def transcribe(audio): | |
| return pipe(audio)["text"] | |
| demo = gr.Interface( | |
| fn=transcribe, | |
| inputs=gr.Audio(sources=["microphone", "upload"], type="filepath"), | |
| outputs="text", | |
| title="Wav2Vec2 ASR Demo", | |
| description="Realtime demo for English speech recognition using Sammau/wav2vec2-large-xls-r-300m-dv-ng." | |
| ) | |
| if name == "main": | |
| demo.launch() |