import gradio as gr from transformers import pipeline pipeline = pipeline(model="openai/whisper-medium.en") def transcribe(file): options = dict(task="transcribe", best_of=5) text = model.transcribe(file, **options)["text"] return text.strip() block = gr.Blocks() with block: with gr.Group(): audio = gr.Audio( show_label=False, source="microphone", type="filepath" ) with gr.Box(): with gr.Row().style(equal_height=True): transcribe_button = gr.Button("Transcribe") textbox = gr.Textbox(show_label=False) transcribe_button.click(transcribe, inputs=[audio], outputs=[textbox]) block.launch(share=True)