import gradio as gr from transformers import pipeline # Load Whisper ASR pipeline asr = pipeline("automatic-speech-recognition", model="openai/whisper-base") # Transcription function def transcribe(audio): return asr(audio)["text"] # Gradio interface interface = gr.Interface( fn=transcribe, inputs=gr.Audio(type="filepath", label="Upload or Record Audio"), outputs="text", title="Whisper ASR Voice Recognition", description="Transcribe speech using OpenAI's Whisper model." ) # Launch the app interface.launch()