ysharma's picture
ysharma HF staff
k
006d225
import os
import numpy as np
import gradio as gr
import whisper
model = whisper.load_model("base")
def fun(audio) : #, state=''):
text = model.transcribe(audio)["text"]
#state += text + " "
return text
def fun1(audio, state=''):
text = model.transcribe(audio)["text"]
state += text + " "
return state, state
# Set the starting state to an empty string
#gr.Interface(
# fn=transcribe,
# inputs=[
# gr.Audio(source="microphone", type="filepath", streaming=True),
# "state"
# ],
# outputs=[
# "textbox",
# "state"
# ],
# live=True).launch()
gr.Interface(
title = 'Testing Whisper',
fn=fun,
inputs=[
gr.Audio(source="microphone", type="filepath"), #streaming = True,
# "state"
],
outputs=[
"textbox", # "state"
],
live=True).launch()