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): data, samplerate = sf.read(audio_file.name) transcription = asr_model(data, sampling_rate=samplerate) return transcription["text"] iface = gr.Interface( fn=transcribe, inputs="audio", outputs="text" ) iface.launch()