learningai's picture
Update app.py
85c7303
raw
history blame
440 Bytes
import whisper
import config
import gradio as gr
def get_text(audio_path):
if not audio_path:
return "No audio file chosen..."
model = whisper.load_model(name='base', download_root=config.MODEL_DIR)
results = model.transcribe(audio_path)
return results['text']
label = gr.components.Text()
vd = gr.components.Audio(type="filepath")
iface = gr.Interface(fn=get_text, inputs=vd, outputs=label)
iface.launch()