KingNish commited on
Commit
580b358
·
verified ·
1 Parent(s): f631e7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -104,6 +104,9 @@ def translate_and_transcribe(inputs, previous_transcription, target_language):
104
  def clear():
105
  return ""
106
 
 
 
 
107
  with gr.Blocks() as microphone:
108
  with gr.Column():
109
  gr.Markdown(f"# Realtime Whisper Large V3 Turbo: \n Transcribe Audio in Realtime. This Demo uses the Checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers.\n Note: The first token takes about 5 seconds. After that, it works flawlessly.")
@@ -115,7 +118,7 @@ with gr.Blocks() as microphone:
115
  clear_button = gr.Button("Clear Output")
116
  state = gr.State()
117
  input_audio_microphone.stream(stream_transcribe, [state, input_audio_microphone], [state, output, latency_textbox], time_limit=30, stream_every=1, concurrency_limit=None)
118
- clear_button.click(clear, outputs=[output])
119
 
120
  with gr.Blocks() as file:
121
  with gr.Column():
 
104
  def clear():
105
  return ""
106
 
107
+ def clear_state():
108
+ return None
109
+
110
  with gr.Blocks() as microphone:
111
  with gr.Column():
112
  gr.Markdown(f"# Realtime Whisper Large V3 Turbo: \n Transcribe Audio in Realtime. This Demo uses the Checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers.\n Note: The first token takes about 5 seconds. After that, it works flawlessly.")
 
118
  clear_button = gr.Button("Clear Output")
119
  state = gr.State()
120
  input_audio_microphone.stream(stream_transcribe, [state, input_audio_microphone], [state, output, latency_textbox], time_limit=30, stream_every=1, concurrency_limit=None)
121
+ clear_button.click(clear_state, outputs=[state]).then(clear, outputs=[output])
122
 
123
  with gr.Blocks() as file:
124
  with gr.Column():