Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -3,29 +3,25 @@ import torch.cuda
|
|
3 |
|
4 |
from InferenceInterfaces.ControllableInterface import ControllableInterface
|
5 |
from Utility.utils import float2pcm
|
|
|
6 |
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
def read(self, prompt):
|
26 |
-
sr, wav = self.controllable_ui.read(prompt, -24.)
|
27 |
-
return sr, float2pcm(wav)
|
28 |
-
|
29 |
-
|
30 |
-
if __name__ == '__main__':
|
31 |
-
TTSWebUI(gpu_id="cuda" if torch.cuda.is_available() else "cpu")
|
|
|
3 |
|
4 |
from InferenceInterfaces.ControllableInterface import ControllableInterface
|
5 |
from Utility.utils import float2pcm
|
6 |
+
import spaces
|
7 |
|
8 |
+
gpu_id="cuda"
|
9 |
+
controllable_ui = ControllableInterface(gpu_id=gpu_id)
|
10 |
|
11 |
+
@spaces.GPU
|
12 |
+
def read(self, prompt):
|
13 |
+
sr, wav = controllable_ui.read(prompt, -24.)
|
14 |
+
return sr, float2pcm(wav)
|
15 |
+
|
16 |
+
iface = gr.Interface(fn=read,
|
17 |
+
inputs=[gr.Textbox(lines=2,
|
18 |
+
placeholder="write what you want the synthesis to read here...",
|
19 |
+
value="What I cannot create, I do not understand.",
|
20 |
+
label="Text input"),
|
21 |
+
max_length=400],
|
22 |
+
outputs=[gr.Audio(type="numpy", label="Speech")],
|
23 |
+
title="Simplistic Stochastic Speech Synthesis with ToucanTTS",
|
24 |
+
theme="default",
|
25 |
+
allow_flagging="never",
|
26 |
+
article="This space is purely optimized for English. For a multilingual version, have a look at https://huggingface.co/spaces/Flux9665/MassivelyMultilingualTTS")
|
27 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|