Spaces:
Runtime error
Runtime error
File size: 745 Bytes
a2fdb17 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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) |