mrfakename commited on
Commit
e27b102
1 Parent(s): b21342c
Files changed (1) hide show
  1. app.py +14 -15
app.py CHANGED
@@ -30,21 +30,20 @@ for v in voicelist:
30
  # # return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=7, embedding_scale=1))
31
  # return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=multispeakersteps, embedding_scale=1))
32
  def synthesize(text, voice, lngsteps, password, progress=gr.Progress()):
33
- if password == os.environ['ACCESS_CODE']:
34
- if text.strip() == "":
35
- raise gr.Error("You must enter some text")
36
- if lngsteps > 25:
37
- raise gr.Error("Max 25 steps")
38
- if lngsteps < 5:
39
- raise gr.Error("Min 5 steps")
40
- texts = split_and_recombine_text(text)
41
- v = voice.lower()
42
- audios = []
43
- for t in progress.tqdm(texts):
44
- audios.append(styletts2importable.inference(t, voices[v], alpha=0.3, beta=0.7, diffusion_steps=lngsteps, embedding_scale=1))
45
- return (24000, np.concatenate(audios))
46
- else:
47
- raise gr.Error('Wrong access code')
48
  # def longsynthesize(text, voice, lngsteps, password, progress=gr.Progress()):
49
  # if password == os.environ['ACCESS_CODE']:
50
  # if text.strip() == "":
 
30
  # # return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=7, embedding_scale=1))
31
  # return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=multispeakersteps, embedding_scale=1))
32
  def synthesize(text, voice, lngsteps, password, progress=gr.Progress()):
33
+ if text.strip() == "":
34
+ raise gr.Error("You must enter some text")
35
+ if lngsteps > 25:
36
+ raise gr.Error("Max 25 steps")
37
+ if lngsteps < 5:
38
+ raise gr.Error("Min 5 steps")
39
+ if len(text) > 5000:
40
+ raise gr.Error("Text must be <5k characters")
41
+ texts = split_and_recombine_text(text)
42
+ v = voice.lower()
43
+ audios = []
44
+ for t in progress.tqdm(texts):
45
+ audios.append(styletts2importable.inference(t, voices[v], alpha=0.3, beta=0.7, diffusion_steps=lngsteps, embedding_scale=1))
46
+ return (24000, np.concatenate(audios))
 
47
  # def longsynthesize(text, voice, lngsteps, password, progress=gr.Progress()):
48
  # if password == os.environ['ACCESS_CODE']:
49
  # if text.strip() == "":