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
|
@@ -144,6 +144,8 @@ def process_fn(
|
|
| 144 |
duration = sf.info(input_audio_path).duration
|
| 145 |
except Exception as exc:
|
| 146 |
raise gr.Error(f"Could not read the audio file: {exc}") from exc
|
|
|
|
|
|
|
| 147 |
if gpu_seconds(input_audio_path, variant, instruments_text, use_sampling,
|
| 148 |
temperature) > MAX_GPU_SECONDS:
|
| 149 |
raise gr.Error(
|
|
|
|
| 144 |
duration = sf.info(input_audio_path).duration
|
| 145 |
except Exception as exc:
|
| 146 |
raise gr.Error(f"Could not read the audio file: {exc}") from exc
|
| 147 |
+
if duration == 0:
|
| 148 |
+
raise gr.Error("The audio file is empty.")
|
| 149 |
if gpu_seconds(input_audio_path, variant, instruments_text, use_sampling,
|
| 150 |
temperature) > MAX_GPU_SECONDS:
|
| 151 |
raise gr.Error(
|