harp-dev Claude Opus 5.5 commited on
Commit
c5fdae8
·
verified ·
1 Parent(s): c8a9ea9

Check the optional recording before the GPU is reserved

Browse files

An unreadable or empty style reference, 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
@@ -103,6 +103,13 @@ def process_fn(lyrics, style_audio, style_text, steps, guidance_strength,
103
  raise gr.Error("Enter the lyrics to sing, with an [mm:ss.xx] stamp per line.")
104
  if not style_audio and not (style_text or "").strip():
105
  raise gr.Error("Describe the style, or supply a reference recording.")
 
 
 
 
 
 
 
106
 
107
  return compose(lyrics, style_audio, style_text, steps, guidance_strength, solver, seed)
108
 
 
103
  raise gr.Error("Enter the lyrics to sing, with an [mm:ss.xx] stamp per line.")
104
  if not style_audio and not (style_text or "").strip():
105
  raise gr.Error("Describe the style, or supply a reference recording.")
106
+ if style_audio:
107
+ try:
108
+ info = sf.info(style_audio)
109
+ except Exception as exc:
110
+ raise gr.Error(f"Could not read the style reference recording: {exc}") from exc
111
+ if info.frames == 0:
112
+ raise gr.Error("The style reference recording is empty.")
113
 
114
  return compose(lyrics, style_audio, style_text, steps, guidance_strength, solver, seed)
115