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
|
@@ -84,9 +84,11 @@ def process_fn(audio_duration, prompt, lyrics, infer_step, guidance_scale, omega
|
|
| 84 |
if not ref_audio_input:
|
| 85 |
raise gr.Error("Audio2Audio needs a reference recording.")
|
| 86 |
try:
|
| 87 |
-
sf.info(ref_audio_input)
|
| 88 |
except Exception as exc:
|
| 89 |
raise gr.Error(f"Could not read the reference recording: {exc}") from exc
|
|
|
|
|
|
|
| 90 |
if gpu_seconds(audio_duration, prompt, lyrics, infer_step) > MAX_GPU_SECONDS:
|
| 91 |
raise gr.Error(
|
| 92 |
f"{int(infer_step)} steps on "
|
|
|
|
| 84 |
if not ref_audio_input:
|
| 85 |
raise gr.Error("Audio2Audio needs a reference recording.")
|
| 86 |
try:
|
| 87 |
+
reference = sf.info(ref_audio_input)
|
| 88 |
except Exception as exc:
|
| 89 |
raise gr.Error(f"Could not read the reference recording: {exc}") from exc
|
| 90 |
+
if reference.frames == 0:
|
| 91 |
+
raise gr.Error("The reference recording is empty.")
|
| 92 |
if gpu_seconds(audio_duration, prompt, lyrics, infer_step) > MAX_GPU_SECONDS:
|
| 93 |
raise gr.Error(
|
| 94 |
f"{int(infer_step)} steps on "
|