gorkemgoknar commited on
Commit
e6a1ae3
1 Parent(s): fee4147

Update app.py

Browse files

add exception handling for audio

Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -359,15 +359,20 @@ async def add_text(WITH_AUDIO,char1,char2,runs,context,initial_question,history,
359
  print("You have reached voiced limit, try with voice later.. running without voice")
360
  gr.Warning("You have reached voiced limit.. running without voice")
361
  use_voice=False
 
 
 
 
 
 
 
 
 
 
 
 
 
362
 
363
- if use_voice:
364
- char1_audio_url= get_audio_url(initial_question,char1)
365
- VOICE_COUNTER+=1
366
- get_per_run_voice_counter(increase=True)
367
-
368
- char2_audio_url= get_audio_url(last_answer,char2)
369
- VOICE_COUNTER+=1
370
- get_per_run_voice_counter(increase=True)
371
 
372
  print("Voice Counter:",VOICE_COUNTER)
373
  if use_voice:
 
359
  print("You have reached voiced limit, try with voice later.. running without voice")
360
  gr.Warning("You have reached voiced limit.. running without voice")
361
  use_voice=False
362
+
363
+ try:
364
+ if use_voice:
365
+ char1_audio_url= get_audio_url(initial_question,char1)
366
+ VOICE_COUNTER+=1
367
+ get_per_run_voice_counter(increase=True)
368
+
369
+ char2_audio_url= get_audio_url(last_answer,char2)
370
+ VOICE_COUNTER+=1
371
+ get_per_run_voice_counter(increase=True)
372
+ except:
373
+ gr.Warning("Something wrong with getting audio.. ")
374
+ use_voice=False
375
 
 
 
 
 
 
 
 
 
376
 
377
  print("Voice Counter:",VOICE_COUNTER)
378
  if use_voice: