Spaces:
Build error
Build error
Update app.py
Browse files45 unmodified lines4647484950515253545556575859606162636465666768697071727374757677787980818283843 unmodified lines888990919293949596979845 unmodified linesdef synthesize(text, voice, lngsteps, password, progress=gr.Progress()):if text.strip() == "":raise gr.Error("You must enter some text")if len(text) > 50000:raise gr.Error("Text must be <50k characters")texts = split_and_recombine_text(text)v = voice.lower()audios = []for t in progress.tqdm(texts):audios.append(styletts2importable.inference(t, voices[v], alpha=0.3, beta=0.7, diffusion_steps=lngsteps, embedding_scale=1))return (24000, np.concatenate(audios))# def longsynthesize(text, voice, lngsteps, password, progress=gr.Progress()):# if password == os.environ['ACCESS_CODE']:# if text.strip() == "":# raise gr.Error("You must enter some text")# if lngsteps > 25:# raise gr.Error("Max 25 steps")# if lngsteps < 5:# raise gr.Error("Min 5 steps")# texts = split_and_recombine_text(text)# v = voice.lower()# audios = []# for t in progress.tqdm(texts):# audios.append(styletts2importable.inference(t, voices[v], alpha=0.3, beta=0.7, diffusion_steps=lngsteps, embedding_scale=1))# return (24000, np.concatenate(audios))# else:# raise gr.Error('Wrong access code')def clsynthesize(text, voice, vcsteps, progress=gr.Progress()):# if text.strip() == "":# raise gr.Error("You must enter some text")# # if global_phonemizer.phonemize([text]) > 300:# if len(text) > 400:# raise gr.Error("Text must be under 400 characters")# # return (24000, styletts2importable.inference(text, styletts2importable.compute_style(voice), alpha=0.3, beta=0.7, diffusion_steps=20, embedding_scale=1))# return (24000, styletts2importable.inference(text, styletts2importable.compute_style(voice), alpha=0.3, beta=0.7, diffusion_steps=vcsteps, embedding_scale=1))if text.strip() == "":raise gr.Error("You must enter some text")if len(text) > 50000:raise gr.Error("Text must be <50k characters")3 unmodified linesaudios.append(styletts2importable.inference(t, styletts2importable.compute_style(voice), alpha=0.3, beta=0.7, diffusion_steps=vcsteps, embedding_scale=1))return (24000, np.concatenate(audios))def ljsynthesize(text, steps, progress=gr.Progress()):# if text.strip() == "":# raise gr.Error("You must enter some text")# # if global_phonemizer.phonemize([text]) > 300:# if len(text) > 400:# raise gr.Error("Text must be under 400 characters")noise = torch.randn(1,1,256).to('cuda' if torch.cuda.is_available() else 'cpu')# return (24000, ljspeechimportable.inference(text, noise, diffusion_steps=7, embedding_scale=1))if text.strip() == "":45 unmodified lines464748495051525354555657585960613 unmodified lines65666768697045 unmodified linesdef synthesize(text, voice, lngsteps, password, progress=gr.Progress()):if text.strip() == "":raise gr.Error("You must enter some text")texts = split_and_recombine_text(text)v = voice.lower()audios = []for t in progress.tqdm(texts):audios.append(styletts2importable.inference(t, voices[v], alpha=0.3, beta=0.7, diffusion_steps=lngsteps, embedding_scale=1))return (24000, np.concatenate(audios))def clsynthesize(text, voice, vcsteps, progress=gr.Progress()):if text.strip() == "":raise gr.Error("You must enter some text")if len(text) > 50000:raise gr.Error("Text must be <50k characters")3 unmodified linesaudios.append(styletts2importable.inference(t, styletts2importable.compute_style(voice), alpha=0.3, beta=0.7, diffusion_steps=vcsteps, embedding_scale=1))return (24000, np.concatenate(audios))def ljsynthesize(text, steps, progress=gr.Progress()):noise = torch.randn(1,1,256).to('cuda' if torch.cuda.is_available() else 'cpu')# return (24000, ljspeechimportable.inference(text, noise, diffusion_steps=7, embedding_scale=1))if text.strip() == "":
app.py+3-31