File size: 582 Bytes
b9555e4
d10b0e3
5475c9a
aee9f3b
d10b0e3
 
 
 
 
 
7432d1f
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)