IliaLarchenko commited on
Commit
4b088a0
1 Parent(s): 091f6f5

Updated progress options and waiting time

Browse files
Files changed (2) hide show
  1. app.py +0 -1
  2. ui/coding.py +5 -5
app.py CHANGED
@@ -62,7 +62,6 @@ def main():
62
  """
63
  config, llm, tts, stt = initialize_services()
64
  demo = create_interface(llm, tts, stt, default_audio_params)
65
- demo.config["dependencies"][0]["show_progress"] = "hidden"
66
 
67
  # Launch the Gradio interface
68
  demo.launch(show_api=False)
 
62
  """
63
  config, llm, tts, stt = initialize_services()
64
  demo = create_interface(llm, tts, stt, default_audio_params)
 
65
 
66
  # Launch the Gradio interface
67
  demo.launch(show_api=False)
ui/coding.py CHANGED
@@ -297,19 +297,18 @@ def get_problem_solving_ui(
297
  stt.process_audio_chunk,
298
  inputs=[audio_input, audio_buffer],
299
  outputs=[audio_buffer, audio_to_transcribe],
300
- show_progress="hidden",
301
  ).success(fn=lambda: True, outputs=[is_transcribing]).success(
302
- fn=stt.transcribe_audio, inputs=[audio_to_transcribe, hidden_text], outputs=[hidden_text], show_progress="hidden"
303
  ).success(
304
- fn=stt.add_to_chat, inputs=[hidden_text, chat], outputs=[chat], show_progress="hidden"
305
  ).success(
306
  fn=lambda: False, outputs=[is_transcribing]
307
  )
308
 
309
  # We need to wait until the last chunk of audio is transcribed before sending the request
310
  # I didn't find a native way of gradio to handle this, and used a workaround
311
- WAIT_TIME = 5
312
- TIME_STEP = 0.1
313
  STEPS = int(WAIT_TIME / TIME_STEP)
314
 
315
  stop_audio_recording = audio_input.stop_recording(fn=lambda: gr.update(visible=False), outputs=[audio_input])
@@ -320,6 +319,7 @@ def get_problem_solving_ui(
320
  fn=send_request_partial,
321
  inputs=[code, previous_code, chat_history, chat],
322
  outputs=[chat_history, chat, previous_code, audio_output],
 
323
  ).then(fn=lambda: (np.array([], dtype=np.int16), "", False), outputs=[audio_buffer, hidden_text, is_transcribing]).then(
324
  fn=lambda: gr.update(visible=True), outputs=[audio_input]
325
  )
 
297
  stt.process_audio_chunk,
298
  inputs=[audio_input, audio_buffer],
299
  outputs=[audio_buffer, audio_to_transcribe],
 
300
  ).success(fn=lambda: True, outputs=[is_transcribing]).success(
301
+ fn=stt.transcribe_audio, inputs=[audio_to_transcribe, hidden_text], outputs=[hidden_text]
302
  ).success(
303
+ fn=stt.add_to_chat, inputs=[hidden_text, chat], outputs=[chat]
304
  ).success(
305
  fn=lambda: False, outputs=[is_transcribing]
306
  )
307
 
308
  # We need to wait until the last chunk of audio is transcribed before sending the request
309
  # I didn't find a native way of gradio to handle this, and used a workaround
310
+ WAIT_TIME = 3
311
+ TIME_STEP = 0.3
312
  STEPS = int(WAIT_TIME / TIME_STEP)
313
 
314
  stop_audio_recording = audio_input.stop_recording(fn=lambda: gr.update(visible=False), outputs=[audio_input])
 
319
  fn=send_request_partial,
320
  inputs=[code, previous_code, chat_history, chat],
321
  outputs=[chat_history, chat, previous_code, audio_output],
322
+ show_progress="full",
323
  ).then(fn=lambda: (np.array([], dtype=np.int16), "", False), outputs=[audio_buffer, hidden_text, is_transcribing]).then(
324
  fn=lambda: gr.update(visible=True), outputs=[audio_input]
325
  )