TArtx commited on
Commit
e231341
·
verified ·
1 Parent(s): cbc35da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -62,13 +62,15 @@ def gen_tts(text, description):
62
  do_sample=True,
63
  temperature=1.0,
64
  )
65
-
66
- # Extract the generated audio
67
- audio_arr = generation.cpu().numpy().squeeze()
68
 
69
- # Check for NaN or Inf values and handle them
70
- if np.any(np.isnan(audio_arr)) or np.any(np.isinf(audio_arr)):
71
- raise ValueError("Generated audio contains invalid values (NaN or Inf).")
 
 
 
 
 
72
 
73
  # Normalize the audio array to the range [-1, 1]
74
  audio_arr = audio_arr / np.max(np.abs(audio_arr))
 
62
  do_sample=True,
63
  temperature=1.0,
64
  )
 
 
 
65
 
66
+ # Inspect the raw audio generation output
67
+ print(f"Generated audio shape: {generation.shape}")
68
+ print(f"Generated audio values: {generation.cpu().numpy().squeeze()}")
69
+
70
+ # Check if there are any meaningful values in the audio output
71
+ audio_arr = generation.cpu().numpy().squeeze()
72
+ if np.all(audio_arr == 0):
73
+ raise ValueError("Generated audio is empty or silent.")
74
 
75
  # Normalize the audio array to the range [-1, 1]
76
  audio_arr = audio_arr / np.max(np.abs(audio_arr))