juliuserictuliao commited on
Commit
1998cc5
·
verified ·
1 Parent(s): f83c1dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -30,9 +30,7 @@ def asr_transcript(audio):
30
  transcription = correct_casing(transcription.lower())
31
  return transcription
32
 
33
- def real_time_asr(audio, state=None):
34
- if state is None:
35
- state = ""
36
  audio = np.array(audio)
37
  transcription = asr_transcript(audio)
38
  state += " " + transcription
@@ -41,8 +39,8 @@ def real_time_asr(audio, state=None):
41
  # Create the Gradio interface
42
  iface = gr.Interface(
43
  fn=real_time_asr,
44
- inputs=[gr.Audio(streaming=True), "state"],
45
- outputs="text",
46
  live=True,
47
  title="Real-Time ASR using Wav2Vec 2.0",
48
  description="This application displays transcribed text in real-time for given audio input"
 
30
  transcription = correct_casing(transcription.lower())
31
  return transcription
32
 
33
+ def real_time_asr(audio, state=""):
 
 
34
  audio = np.array(audio)
35
  transcription = asr_transcript(audio)
36
  state += " " + transcription
 
39
  # Create the Gradio interface
40
  iface = gr.Interface(
41
  fn=real_time_asr,
42
+ inputs=[gr.Audio(source="microphone", streaming=True), gr.State()],
43
+ outputs=[gr.Textbox(), gr.State()],
44
  live=True,
45
  title="Real-Time ASR using Wav2Vec 2.0",
46
  description="This application displays transcribed text in real-time for given audio input"