OnyxMunk commited on
Commit
84525fb
·
1 Parent(s): 88a32e8

Enhance error handling in audio generation

Browse files

Updated 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.

Files changed (1) hide show
  1. app.py +2 -2
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