import gradio as gr | |
import whisper | |
model = whisper.load_model("medium") | |
def transcribe_audio(file): | |
return model.transcribe(file)['text'] | |
def main(): | |
audio_input = gr.inputs.Audio(source="microphone", type="filepath") | |
output = gr.outputs.Textbox() | |
iface = gr.Interface(fn=transcribe_audio, inputs=audio_input, outputs=output, | |
title="ASR Whisper") | |
iface.queue().launch(debug=True, inline=False) | |
if __name__ == '__main__': | |
main() |