Dupaja commited on
Commit
c00de09
·
1 Parent(s): 609b399

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -31
app.py CHANGED
@@ -46,39 +46,16 @@ for v in voicelist:
46
  def synthesize(text, voice, lngsteps, password, progress=gr.Progress()):
47
  if text.strip() == "":
48
  raise gr.Error("You must enter some text")
49
- if len(text) > 50000:
50
- raise gr.Error("Text must be <50k characters")
51
  texts = split_and_recombine_text(text)
52
  v = voice.lower()
53
  audios = []
54
  for t in progress.tqdm(texts):
55
  audios.append(styletts2importable.inference(t, voices[v], alpha=0.3, beta=0.7, diffusion_steps=lngsteps, embedding_scale=1))
56
  return (24000, np.concatenate(audios))
57
- # def longsynthesize(text, voice, lngsteps, password, progress=gr.Progress()):
58
- # if password == os.environ['ACCESS_CODE']:
59
- # if text.strip() == "":
60
- # raise gr.Error("You must enter some text")
61
- # if lngsteps > 25:
62
- # raise gr.Error("Max 25 steps")
63
- # if lngsteps < 5:
64
- # raise gr.Error("Min 5 steps")
65
- # texts = split_and_recombine_text(text)
66
- # v = voice.lower()
67
- # audios = []
68
- # for t in progress.tqdm(texts):
69
- # audios.append(styletts2importable.inference(t, voices[v], alpha=0.3, beta=0.7, diffusion_steps=lngsteps, embedding_scale=1))
70
- # return (24000, np.concatenate(audios))
71
- # else:
72
- # raise gr.Error('Wrong access code')
73
  def clsynthesize(text, voice, vcsteps, progress=gr.Progress()):
74
- # if text.strip() == "":
75
- # raise gr.Error("You must enter some text")
76
- # # if global_phonemizer.phonemize([text]) > 300:
77
- # if len(text) > 400:
78
- # raise gr.Error("Text must be under 400 characters")
79
- # # return (24000, styletts2importable.inference(text, styletts2importable.compute_style(voice), alpha=0.3, beta=0.7, diffusion_steps=20, embedding_scale=1))
80
- # return (24000, styletts2importable.inference(text, styletts2importable.compute_style(voice), alpha=0.3, beta=0.7, diffusion_steps=vcsteps, embedding_scale=1))
81
- if text.strip() == "":
82
  raise gr.Error("You must enter some text")
83
  if len(text) > 50000:
84
  raise gr.Error("Text must be <50k characters")
@@ -88,11 +65,6 @@ def clsynthesize(text, voice, vcsteps, progress=gr.Progress()):
88
  audios.append(styletts2importable.inference(t, styletts2importable.compute_style(voice), alpha=0.3, beta=0.7, diffusion_steps=vcsteps, embedding_scale=1))
89
  return (24000, np.concatenate(audios))
90
  def ljsynthesize(text, steps, progress=gr.Progress()):
91
- # if text.strip() == "":
92
- # raise gr.Error("You must enter some text")
93
- # # if global_phonemizer.phonemize([text]) > 300:
94
- # if len(text) > 400:
95
- # raise gr.Error("Text must be under 400 characters")
96
  noise = torch.randn(1,1,256).to('cuda' if torch.cuda.is_available() else 'cpu')
97
  # return (24000, ljspeechimportable.inference(text, noise, diffusion_steps=7, embedding_scale=1))
98
  if text.strip() == "":
 
46
  def synthesize(text, voice, lngsteps, password, progress=gr.Progress()):
47
  if text.strip() == "":
48
  raise gr.Error("You must enter some text")
49
+
 
50
  texts = split_and_recombine_text(text)
51
  v = voice.lower()
52
  audios = []
53
  for t in progress.tqdm(texts):
54
  audios.append(styletts2importable.inference(t, voices[v], alpha=0.3, beta=0.7, diffusion_steps=lngsteps, embedding_scale=1))
55
  return (24000, np.concatenate(audios))
56
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  def clsynthesize(text, voice, vcsteps, progress=gr.Progress()):
58
+ if text.strip() == "":
 
 
 
 
 
 
 
59
  raise gr.Error("You must enter some text")
60
  if len(text) > 50000:
61
  raise gr.Error("Text must be <50k characters")
 
65
  audios.append(styletts2importable.inference(t, styletts2importable.compute_style(voice), alpha=0.3, beta=0.7, diffusion_steps=vcsteps, embedding_scale=1))
66
  return (24000, np.concatenate(audios))
67
  def ljsynthesize(text, steps, progress=gr.Progress()):
 
 
 
 
 
68
  noise = torch.randn(1,1,256).to('cuda' if torch.cuda.is_available() else 'cpu')
69
  # return (24000, ljspeechimportable.inference(text, noise, diffusion_steps=7, embedding_scale=1))
70
  if text.strip() == "":