theodotus commited on
Commit
b31fd8e
1 Parent(s): 056b612

Added base streaming example

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -8,12 +8,20 @@ asr_model = nemo_asr.models.EncDecCTCModelBPE. \
8
 
9
 
10
 
11
- def transcribe(audio):
12
  text = asr_model.transcribe([audio], batch_size=1)[0]
13
- return text
 
14
 
15
 
16
  gr.Interface(
17
  fn=transcribe,
18
- inputs=gr.Audio(source="microphone", type="filepath"),
19
- outputs="text").launch()
 
 
 
 
 
 
 
 
8
 
9
 
10
 
11
+ def transcribe(audio, state=""):
12
  text = asr_model.transcribe([audio], batch_size=1)[0]
13
+ state += text + " "
14
+ return state, state
15
 
16
 
17
  gr.Interface(
18
  fn=transcribe,
19
+ inputs=[
20
+ gr.Audio(source="microphone", type="filepath", streaming=True),
21
+ "state"
22
+ ],
23
+ outputs=[
24
+ "textbox",
25
+ "state"
26
+ ],
27
+ live=True).launch()