MAZALA2024 commited on
Commit
4f3f829
·
verified ·
1 Parent(s): 5ea43b2

Update voice_processing.py

Browse files
Files changed (1) hide show
  1. voice_processing.py +4 -1
voice_processing.py CHANGED
@@ -224,6 +224,9 @@ async def tts(
224
  None,
225
  )
226
 
 
 
 
227
  if tgt_sr != resample_sr and resample_sr >= 16000:
228
  tgt_sr = resample_sr
229
 
@@ -241,7 +244,7 @@ async def tts(
241
  return info, None, None
242
  except Exception as e:
243
  logger.exception("Error in TTS processing")
244
- return str(e), None, None
245
 
246
  voice_mapping = {
247
  "Mongolian Male": "mn-MN-BataaNeural",
 
224
  None,
225
  )
226
 
227
+ if audio_opt is None or len(audio_opt) == 0:
228
+ raise ValueError("No audio was generated")
229
+
230
  if tgt_sr != resample_sr and resample_sr >= 16000:
231
  tgt_sr = resample_sr
232
 
 
244
  return info, None, None
245
  except Exception as e:
246
  logger.exception("Error in TTS processing")
247
+ return str(e), None, (None, None) # Return a tuple with None values instead of None
248
 
249
  voice_mapping = {
250
  "Mongolian Male": "mn-MN-BataaNeural",