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="Devion333/wav2vec2-xls-r-300m-dv" ) 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 Devion333/wav2vec2-xls-r-300m-dv." ) if __name__ == "__main__": demo.launch()