Spaces:
Running
Running
import gradio as gr | |
import whisper | |
# define function for transcription | |
def whisper_transcript(model_size, audio_file): | |
source = audio_file | |
language = "english" | |
loaded_model = whisper.load_model(model_size) | |
transcript = loaded_model.transcribe(source, language=language) | |
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 modelos, subir un audio 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() |