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 lines456789101 unmodified line121314153 unmodified linescolorFrom: indigocolorTo: graysdk: gradiosdk_version: 4.21.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.3 unmodified lines456789101 unmodified line121314153 unmodified linescolorFrom: indigocolorTo: graysdk: gradiosdk_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.
72 unmodified lines7374757677787972 unmodified linesreturn (16000, audio.squeeze().cpu().numpy())@spaces.GPU(duration=200)def edit(# cache_dir,input_audio,72 unmodified lines73747576777879808182838485868788899091929394959697989910010110210372 unmodified linesreturn (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.8elif model_id == LDM2_LARGE:factor = 1.5else: # MUSICfactor = 1mult = 0if do_inversion or randomize_seed:mult = stepsif 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.2print('expected time:', time_per_iter_of_full / 30 * duration)return time_per_iter_of_full / 30 * duration@spaces.GPU(duration=get_duration)def edit(# cache_dir,input_audio,
1234torchtorchaudiodiffusersaccelerate12345torchnumpy<2torchaudiodiffusersaccelerate
1 unmodified line2345678 unmodified lines161718192021221 unmodified lineimport torchfrom typing import Optional, List, Tuple, NamedTuple, Unionfrom models import PipelineWrapperclass PromptEmbeddings(NamedTuple):8 unmodified linesimport audioldmimport audioldm.audioduration = min(audioldm.utils.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)1 unmodified line23456788 unmodified lines171819202122231 unmodified lineimport torchfrom typing import Optional, List, Tuple, NamedTuple, Unionfrom models import PipelineWrapperfrom audioldm.utils import get_durationclass PromptEmbeddings(NamedTuple):8 unmodified linesimport audioldmimport audioldm.audioduration = 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