harp-dev Claude Opus 5.5 commited on
Commit
76d3050
·
verified ·
1 Parent(s): 02451a9

Check the optional recording before the GPU is reserved

Browse files

An unreadable or empty input audio, when one is given, went unread until the GPU call, where it failed after spending the caller's ZeroGPU allowance. It is refused with a message first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -259,6 +259,13 @@ def process_fn(
259
  raise gr.Error("Edit mode requires an input audio track.")
260
  if mode == "Clone Voice" and not input_audio_path:
261
  raise gr.Error("Clone Voice mode requires a reference audio track.")
 
 
 
 
 
 
 
262
  return run(input_audio_path, mode, sound_type, voice, prompt, background, ref_text,
263
  model_variant, steps, guidance, duration)
264
 
 
259
  raise gr.Error("Edit mode requires an input audio track.")
260
  if mode == "Clone Voice" and not input_audio_path:
261
  raise gr.Error("Clone Voice mode requires a reference audio track.")
262
+ if input_audio_path:
263
+ try:
264
+ info = sf.info(input_audio_path)
265
+ except Exception as exc:
266
+ raise gr.Error(f"Could not read the input audio file: {exc}") from exc
267
+ if info.frames == 0:
268
+ raise gr.Error("The input audio file is empty.")
269
  return run(input_audio_path, mode, sound_type, voice, prompt, background, ref_text,
270
  model_variant, steps, guidance, duration)
271