Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
#
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
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))
|