radames commited on
Commit
7432d1f
·
1 Parent(s): 5475c9a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -8,10 +8,15 @@ def transcribe(audio, state=""):
8
  text = client.predict(audio, api_name = '/predict')
9
  state += text + " "
10
  return state, state
11
-
12
- # Set the starting state to an empty string
13
- iface = gr. Interface(fn=transcribe,
14
- inputs=[gr.Audio(source="microphone", type="filepath", streaming=True), "state"],
15
- outputs=["textbox","state" ],
16
- live=True)
17
- iface.launch()
 
 
 
 
 
 
8
  text = client.predict(audio, api_name = '/predict')
9
  state += text + " "
10
  return state, state
11
+
12
+
13
+ with gr.Blocks() as demo:
14
+ state = gr.State(value="")
15
+ with gr.Row():
16
+ with gr.Column():
17
+ audio = gr.Audio(source="microphone", type="filepath")
18
+ with gr.Column():
19
+ textbox = gr.Textbox()
20
+ audio.stream(fn=transcribe, inputs=[audio, state], outputs=[textbox, state])
21
+
22
+ demo.launch(debug=True)