Spaces:
Runtime error
Runtime error
mrfakename
commited on
Commit
•
4751254
1
Parent(s):
437bd90
Update app.py
Browse files
app.py
CHANGED
@@ -7,26 +7,27 @@ theme = gr.themes.Base(
|
|
7 |
)
|
8 |
voicelist = ['f-us-1', 'f-us-2', 'f-us-3', 'f-us-4', 'm-us-1', 'm-us-2', 'm-us-3', 'm-us-4']
|
9 |
voices = {}
|
|
|
10 |
for v in voicelist:
|
11 |
voices[v] = styletts2importable.compute_style(f'voices/{v}.wav')
|
12 |
def synthesize(text, voice):
|
13 |
if text.strip() == "":
|
14 |
raise gr.Error("You must enter some text")
|
15 |
-
if len(text) >
|
16 |
-
raise gr.Error("Text must be under
|
17 |
v = voice.lower()
|
18 |
return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=7, embedding_scale=1))
|
19 |
def clsynthesize(text, voice):
|
20 |
if text.strip() == "":
|
21 |
raise gr.Error("You must enter some text")
|
22 |
-
if len(text) >
|
23 |
-
raise gr.Error("Text must be under
|
24 |
return (24000, styletts2importable.inference(text, styletts2importable.compute_style(voice), alpha=0.3, beta=0.7, diffusion_steps=20, embedding_scale=1))
|
25 |
def ljsynthesize(text):
|
26 |
if text.strip() == "":
|
27 |
raise gr.Error("You must enter some text")
|
28 |
-
if len(text) >
|
29 |
-
raise gr.Error("Text must be under
|
30 |
noise = torch.randn(1,1,256).to('cuda' if torch.cuda.is_available() else 'cpu')
|
31 |
return (24000, ljspeechimportable.inference(text, noise, diffusion_steps=7, embedding_scale=1))
|
32 |
|
|
|
7 |
)
|
8 |
voicelist = ['f-us-1', 'f-us-2', 'f-us-3', 'f-us-4', 'm-us-1', 'm-us-2', 'm-us-3', 'm-us-4']
|
9 |
voices = {}
|
10 |
+
// todo cache computed style
|
11 |
for v in voicelist:
|
12 |
voices[v] = styletts2importable.compute_style(f'voices/{v}.wav')
|
13 |
def synthesize(text, voice):
|
14 |
if text.strip() == "":
|
15 |
raise gr.Error("You must enter some text")
|
16 |
+
if len(text) > 300:
|
17 |
+
raise gr.Error("Text must be under 300 characters")
|
18 |
v = voice.lower()
|
19 |
return (24000, styletts2importable.inference(text, voices[v], alpha=0.3, beta=0.7, diffusion_steps=7, embedding_scale=1))
|
20 |
def clsynthesize(text, voice):
|
21 |
if text.strip() == "":
|
22 |
raise gr.Error("You must enter some text")
|
23 |
+
if len(text) > 300:
|
24 |
+
raise gr.Error("Text must be under 300 characters")
|
25 |
return (24000, styletts2importable.inference(text, styletts2importable.compute_style(voice), alpha=0.3, beta=0.7, diffusion_steps=20, embedding_scale=1))
|
26 |
def ljsynthesize(text):
|
27 |
if text.strip() == "":
|
28 |
raise gr.Error("You must enter some text")
|
29 |
+
if len(text) > 300:
|
30 |
+
raise gr.Error("Text must be under 300 characters")
|
31 |
noise = torch.randn(1,1,256).to('cuda' if torch.cuda.is_available() else 'cpu')
|
32 |
return (24000, ljspeechimportable.inference(text, noise, diffusion_steps=7, embedding_scale=1))
|
33 |
|