Spaces:
Sleeping
Sleeping
Drop the length cap on the original mix, keeping the reservation sized to it
Browse filesThe model works through it in segments or chunks, so its length costs time rather than memory. ZeroGPU already refuses a request that the caller's tier or remaining allowance cannot cover, before reserving anything, and tells a free account how to get more. A cap set so that a free account could afford every request therefore only turned away callers who could. The only request refused here now is one whose reservation would outlast PyHARP's 15 minute timeout, which would stop it anyway.
143 unmodified lines14414514614714814915015115215315415515614 unmodified lines171172173174175176177178179180143 unmodified linesreturn "\n".join(lines)# The whole original mix is separated and processed, so the cost grows with its length. Only the# first 10 s of the reference are used.MAX_INPUT_SECONDS = 360def gpu_seconds(original_path, reference_path, normalize_loudness, target_lufs):# Measured at about 18 s for a 30 s mix and 27 s for 60 s, building both models included, paddedreturn 15 + 0.5 * sf.info(original_path).duration14 unmodified linessf.info(reference_path)except Exception as exc:raise gr.Error(f"Could not read the audio file: {exc}") from excif duration > MAX_INPUT_SECONDS:raise gr.Error(f"The original mix is {duration:.1f} s long. Trim it to {MAX_INPUT_SECONDS // 60} ""minutes or less.")return restyle(original_path, reference_path, normalize_loudness, target_lufs)143 unmodified lines14414514614714814915015115215315415515615715815916014 unmodified lines175176177178179180181182183184185143 unmodified linesreturn "\n".join(lines)# The whole original mix is separated, in chunks, and processed, so the cost grows with its# length. Only the first 10 s of the reference are used.# PyHARP stops a job that runs past its timeout_s, 15 minutes by default, so a request whose# reservation would exceed that is refused rather than started. A shorter one is left to# ZeroGPU, which admits it when the caller's own allowance covers it.MAX_GPU_SECONDS = 900def gpu_seconds(original_path, reference_path, normalize_loudness, target_lufs):# Measured at about 18 s for a 30 s mix, 27 s for 60 s and 37 s for 300 s, building both models# included, paddedreturn 15 + 0.5 * sf.info(original_path).duration14 unmodified linessf.info(reference_path)except Exception as exc:raise gr.Error(f"Could not read the audio file: {exc}") from excif gpu_seconds(original_path, reference_path, normalize_loudness,target_lufs) > MAX_GPU_SECONDS:raise gr.Error(f"The original mix is {duration:.0f} s long, more than one request can restyle in "f"the {MAX_GPU_SECONDS // 60} minutes it may run. Trim it.")return restyle(original_path, reference_path, normalize_loudness, target_lufs)
app.py+12-7