MarcoM003's picture
Update app.py
1ddeb08 verified
import gradio as gr
import whisper
# define function for transcription
def whisper_transcript(model_size, audio_file):
source = audio_file
loaded_model = whisper.load_model(model_size)
transcript = loaded_model.transcribe(source, language="english")
return transcript["text"]
# define Gradio app interface
gradio_ui = gr.Interface(
fn=whisper_transcript,
theme="Nymbo/Nymbo_Theme",
title="Transcribir audios en ingl茅s a texto",
description="**C贸mo usar**: Elegir uno de los 4 modelos, subir un audio o grabarlo y clicar el bot贸n de Submit.",
article="**Nota**: Exclusivo para audios en ingl茅s.",
inputs=[
gr.Dropdown(
label="Select Model",
choices=[
"tiny.en",
"base.en",
"small.en",
"medium.en",
],
value="base",
),
gr.Audio(label="Upload Audio File", sources=["upload", "microphone"], type="filepath"),
],
outputs=gr.Textbox(label="Whisper Transcript"),
)
gradio_ui.queue().launch()