import gradio as gr from transformers import pipeline import soundfile as sf asr_model = pipeline("automatic-speech-recognition", model="openai/whisper-small") def transcribe(audio_file): with audio_file as f: data, samplerate = sf.read(f.name) transcription = asr_model(data, samplerate=samplerate) return transcription["text"] iface = gr.Interface( fn=transcribe, inputs="audio", outputs="text" ) iface.launch()