Spaces:
Runtime error
Runtime error
Enhance error handling in audio generation
Browse filesUpdated the seed input validation in the generate_audio_from_prompt function to include OverflowError, ensuring that cases like infinity are handled gracefully. This change improves the robustness of the audio generation process by providing a fallback to system entropy when the seed is invalid.
app.py
CHANGED
|
@@ -23,8 +23,8 @@ def generate_audio_from_prompt(prompt, duration, seed):
|
|
| 23 |
try:
|
| 24 |
seed_int = int(seed)
|
| 25 |
np.random.seed(seed_int)
|
| 26 |
-
except (ValueError, TypeError):
|
| 27 |
-
# If seed can't be converted to int, use system entropy
|
| 28 |
pass
|
| 29 |
|
| 30 |
# Extract features from prompt to influence audio
|
|
|
|
| 23 |
try:
|
| 24 |
seed_int = int(seed)
|
| 25 |
np.random.seed(seed_int)
|
| 26 |
+
except (ValueError, TypeError, OverflowError):
|
| 27 |
+
# If seed can't be converted to int (including overflow cases like infinity), use system entropy
|
| 28 |
pass
|
| 29 |
|
| 30 |
# Extract features from prompt to influence audio
|