import gradio as gr from transformers import pipeline # Load the Whisper model using the Transformers pipeline pipe = pipeline( "automatic-speech-recognition", model="openai/whisper-small", chunk_length_s=30, ) def transcribe(audio): # Run ASR on the audio input result = pipe(audio)["text"] return result # Gradio interface for audio input interface = gr.Interface( fn=transcribe, inputs=gr.Audio(type="filepath"), outputs="text", title="Part 3 - Hugging face spaces", description="OpenAI Whisper Small model - Transcribe speech to text" ) # Launch the Gradio app interface.launch()