Spaces:
Runtime error
Runtime error
swap to gradio 4.44 & add adaptive duration
Browse filesFiles changed (4)
- README.md+2-2
- app.py+25-1
- requirements.txt+1
- utils.py+2-1
3 unmodified lines4567789101 unmodified line12131415153 unmodified linescolorFrom: indigocolorTo: graysdk: gradiosdk_version: 4.21.0sdk_version: 4.44.0app_file: app.pypinned: falselicense: cc-by-sa-4.01 unmodified line---
The 30-second limit was introduced to ensure that queue wait times remain reasonable, especially when there are a lot of users.For that reason pull-requests that change this limit will not be merged. Please clone or duplicate the space to work locally without limits.For that reason pull-requests that change this limit will not be merged. Please clone or duplicate the space to work locally without limits.72 unmodified lines7374757677787980818283848586878889909192939495969798997610010110210372 unmodified lines
return (16000, audio.squeeze().cpu().numpy())
def get_duration(input_audio, model_id: str, do_inversion: bool, wts: Optional[torch.Tensor], zs: Optional[torch.Tensor], saved_inv_model: str, source_prompt="", target_prompt="", steps=200, cfg_scale_src=3.5, cfg_scale_tar=12, t_start=45, randomize_seed=True): if model_id == LDM2: factor = 0.8 elif model_id == LDM2_LARGE: factor = 1.5 else: # MUSIC factor = 1
mult = 0 if do_inversion or randomize_seed: mult = steps
if input_audio is None: raise gr.Error('Input audio missing!') duration = min(utils.get_duration(input_audio), 30)
time_per_iter_of_full = factor * ((t_start /100 * steps)*2 + mult) * 0.2 print('expected time:', time_per_iter_of_full / 30 * duration) return time_per_iter_of_full / 30 * duration
@spaces.GPU(duration=200)@spaces.GPU(duration=get_duration)def edit( # cache_dir, input_audio,12345torchnumpy<2torchaudiodiffusersaccelerate1 unmodified line23456788 unmodified lines17181919202122231 unmodified lineimport torchfrom typing import Optional, List, Tuple, NamedTuple, Unionfrom models import PipelineWrapperfrom audioldm.utils import get_duration
class PromptEmbeddings(NamedTuple):8 unmodified lines import audioldm import audioldm.audio
duration = min(audioldm.utils.get_duration(audio_path), 30) duration = min(get_duration(audio_path), 30)
mel, _, _ = audioldm.audio.wav_to_fbank(audio_path, target_length=int(duration * 102.4), fn_STFT=fn_STFT) mel = mel.unsqueeze(0)README.md+2-2
app.py+25-1
requirements.txt+1
utils.py+2-1