Spaces:
Runtime error
Runtime error
File size: 789 Bytes
0b45694 |
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 29 30 31 32 33 34 35 36 37 38 |
import whisper
import gradio as gr
import time
# You can choose your model from - see it on readme file and update the modelname
modelname = "large-v2"
model = whisper.load_model(modelname)
def SpeechToText(audio):
if audio == None : return ""
time.sleep(1)
audio = whisper.load_audio(audio)
audio = whisper.pad_or_trim(audio)
# Decode audio to Text
# options = whisper.DecodingOptions(fp16 = False)
result = model.transcribe(audio, language="hy")
return result["text"]
gr.Interface(
title = 'OpenAI Whisper implementation on Gradio Web UI',
fn=SpeechToText,
inputs=[
gr.Audio(source="microphone", type="filepath")
],
outputs=[
"textbox",
],
live=True
).launch(
debug=False,
share=True
) |