Spaces:
Running on Zero
Running on Zero
Refuse an empty file before the GPU is reserved
Browse filesAn audio file of no frames passed the checks in process_fn, since soundfile reads it without complaint and the limits checked are maximums, so it reached the GPU call and failed there, spending the caller's ZeroGPU allowance. It is refused with a message first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -189,6 +189,8 @@ def process_fn(input_audio, sampletemp, periodic_p, dropout, n_mask_codebooks, m
|
|
| 189 |
duration = sf.info(input_audio).duration
|
| 190 |
except Exception as exc:
|
| 191 |
raise gr.Error(f"Could not read the audio file: {exc}") from exc
|
|
|
|
|
|
|
| 192 |
output_seconds = duration * max(1, int(stretch_factor))
|
| 193 |
if gpu_seconds(input_audio, sampletemp, periodic_p, dropout, n_mask_codebooks, model_choice,
|
| 194 |
stretch_factor) > MAX_GPU_SECONDS:
|
|
|
|
| 189 |
duration = sf.info(input_audio).duration
|
| 190 |
except Exception as exc:
|
| 191 |
raise gr.Error(f"Could not read the audio file: {exc}") from exc
|
| 192 |
+
if duration == 0:
|
| 193 |
+
raise gr.Error("The audio file is empty.")
|
| 194 |
output_seconds = duration * max(1, int(stretch_factor))
|
| 195 |
if gpu_seconds(input_audio, sampletemp, periodic_p, dropout, n_mask_codebooks, model_choice,
|
| 196 |
stretch_factor) > MAX_GPU_SECONDS:
|