Spaces:
Running
Running
Commit
·
e27b102
1
Parent(s):
b21342c
Fix
Browse files
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
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 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() == "":
|