ggoknar commited on
Commit
d346a71
1 Parent(s): 3f2e1a8

add a silence instead of none

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -466,6 +466,11 @@ def generate_speech(history):
466
  wait_time = AUDIO_WAIT_MODIFIER * wait_time
467
  print("Sleeping till audio end")
468
  time.sleep(wait_time)
 
 
 
 
 
469
 
470
  except RuntimeError as e:
471
  if "device-side assert" in str(e):
 
466
  wait_time = AUDIO_WAIT_MODIFIER * wait_time
467
  print("Sleeping till audio end")
468
  time.sleep(wait_time)
469
+ else:
470
+ # Either too much text or some programming, give a silence so stream continues
471
+ second_of_silence = AudioSegment.silent() # use default
472
+ second_of_silence.export("sil.wav", format="wav")
473
+ yield (gr.Audio.update(value="sil.wav", autoplay=True), history)
474
 
475
  except RuntimeError as e:
476
  if "device-side assert" in str(e):