Jofthomas HF staff commited on
Commit
9434313
1 Parent(s): 3f22226

Update coqui.py

Browse files
Files changed (1) hide show
  1. coqui.py +11 -11
coqui.py CHANGED
@@ -135,7 +135,7 @@ def predict(
135
  ):
136
  if agree == True:
137
  if language not in supported_languages:
138
- gr.Warning(
139
  f"Language you put {language} in is not in is not in our Supported Languages, please choose from dropdown"
140
  )
141
 
@@ -162,7 +162,7 @@ def predict(
162
  if language_predicted != language and not no_lang_auto_detect:
163
  # Please duplicate and remove this check if you really want this
164
  # Or auto-detector fails to identify language (which it can on pretty short text or mixed text)
165
- gr.Warning(
166
  f"It looks like your text isn’t the language you chose , if you’re sure the text is the same language you chose, please check disable language auto-detection checkbox"
167
  )
168
 
@@ -174,7 +174,7 @@ def predict(
174
  if mic_file_path is not None:
175
  speaker_wav = mic_file_path
176
  else:
177
- gr.Warning(
178
  "Please record your voice with Microphone, or uncheck Use Microphone to use reference audios"
179
  )
180
  return (
@@ -227,12 +227,12 @@ def predict(
227
  speaker_wav = speaker_wav
228
 
229
  if len(prompt) < 2:
230
- gr.Warning("Please give a longer prompt text")
231
  return (
232
  None,
233
  )
234
  if len(prompt) > 1000:
235
- gr.Warning(
236
  "Text length limited to 200 characters for this demo, please try shorter text. You can clone this space and edit code for your own usage"
237
  )
238
  return (
@@ -266,7 +266,7 @@ def predict(
266
  ) = model.get_conditioning_latents(audio_path=speaker_wav, gpt_cond_len=30, gpt_cond_chunk_len=4, max_ref_length=60)
267
  except Exception as e:
268
  print("Speaker encoding error", str(e))
269
- gr.Warning(
270
  "It appears something wrong with reference, did you unmute your microphone?"
271
  )
272
  return (
@@ -340,7 +340,7 @@ def predict(
340
  f"Exit due to: Unrecoverable exception caused by language:{language} prompt:{prompt}",
341
  flush=True,
342
  )
343
- gr.Warning("Unhandled Exception encounter, please retry in a minute")
344
  print("Cuda device-assert Runtime encountered need restart")
345
  if not DEVICE_ASSERT_DETECTED:
346
  DEVICE_ASSERT_DETECTED = 1
@@ -401,18 +401,18 @@ def predict(
401
  else:
402
  if "Failed to decode" in str(e):
403
  print("Speaker encoding error", str(e))
404
- gr.Warning(
405
  "It appears something wrong with reference, did you unmute your microphone?"
406
  )
407
  else:
408
  print("RuntimeError: non device-side assert error:", str(e))
409
- gr.Warning("Something unexpected happened please retry again.")
410
  return (
411
  None,
412
  )
413
 
414
  else:
415
- gr.Warning("Please accept the Terms & Condition!")
416
  return (
417
  None,
418
- )
 
135
  ):
136
  if agree == True:
137
  if language not in supported_languages:
138
+ print(
139
  f"Language you put {language} in is not in is not in our Supported Languages, please choose from dropdown"
140
  )
141
 
 
162
  if language_predicted != language and not no_lang_auto_detect:
163
  # Please duplicate and remove this check if you really want this
164
  # Or auto-detector fails to identify language (which it can on pretty short text or mixed text)
165
+ print(
166
  f"It looks like your text isn’t the language you chose , if you’re sure the text is the same language you chose, please check disable language auto-detection checkbox"
167
  )
168
 
 
174
  if mic_file_path is not None:
175
  speaker_wav = mic_file_path
176
  else:
177
+ print(
178
  "Please record your voice with Microphone, or uncheck Use Microphone to use reference audios"
179
  )
180
  return (
 
227
  speaker_wav = speaker_wav
228
 
229
  if len(prompt) < 2:
230
+ print("Please give a longer prompt text")
231
  return (
232
  None,
233
  )
234
  if len(prompt) > 1000:
235
+ print(
236
  "Text length limited to 200 characters for this demo, please try shorter text. You can clone this space and edit code for your own usage"
237
  )
238
  return (
 
266
  ) = model.get_conditioning_latents(audio_path=speaker_wav, gpt_cond_len=30, gpt_cond_chunk_len=4, max_ref_length=60)
267
  except Exception as e:
268
  print("Speaker encoding error", str(e))
269
+ print(
270
  "It appears something wrong with reference, did you unmute your microphone?"
271
  )
272
  return (
 
340
  f"Exit due to: Unrecoverable exception caused by language:{language} prompt:{prompt}",
341
  flush=True,
342
  )
343
+ print("Unhandled Exception encounter, please retry in a minute")
344
  print("Cuda device-assert Runtime encountered need restart")
345
  if not DEVICE_ASSERT_DETECTED:
346
  DEVICE_ASSERT_DETECTED = 1
 
401
  else:
402
  if "Failed to decode" in str(e):
403
  print("Speaker encoding error", str(e))
404
+ print(
405
  "It appears something wrong with reference, did you unmute your microphone?"
406
  )
407
  else:
408
  print("RuntimeError: non device-side assert error:", str(e))
409
+ print("Something unexpected happened please retry again.")
410
  return (
411
  None,
412
  )
413
 
414
  else:
415
+ print("Please accept the Terms & Condition!")
416
  return (
417
  None,
418
+ )