import gradio as gr from gradio_client import Client import time def transcribe(audio, state=""): client = Client( "abidlabs/whisper") time.sleep(2) text = client.predict(audio, api_name = '/predict') state += text + " " return state, state with gr.Blocks() as demo: state = gr.State(value="") with gr.Row(): with gr.Column(): audio = gr.Audio(source="microphone", type="filepath") with gr.Column(): textbox = gr.Textbox() audio.stream(fn=transcribe, inputs=[audio, state], outputs=[textbox, state]) demo.launch(debug=True)