Googlefan
commited on
Commit
โข
575cef2
1
Parent(s):
afe64a4
refactor(app.py): update default UID and add concurrency limit
Browse files
app.py
CHANGED
@@ -1,15 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import hf_hub_download
|
3 |
from sbv2_bindings import TTSModel
|
4 |
-
from uuid import uuid4
|
5 |
|
6 |
bert = hf_hub_download("googlefan/sbv2_onnx_models", "deberta.onnx")
|
7 |
tokenizer = hf_hub_download("googlefan/sbv2_onnx_models", "tokenizer.json")
|
8 |
model = TTSModel.from_path(bert, tokenizer)
|
|
|
9 |
|
10 |
|
11 |
def load_and_synthesize(text: str, path: str, sdp: float = 0.0, speed: float = 1.0):
|
12 |
-
uid = str(uuid4())
|
13 |
path = path.split("/")
|
14 |
filename = path[-1]
|
15 |
repo_id = "/".join(path[:-1])
|
@@ -19,16 +18,13 @@ def load_and_synthesize(text: str, path: str, sdp: float = 0.0, speed: float = 1
|
|
19 |
|
20 |
|
21 |
iface = gr.Interface(
|
22 |
-
fn=load_and_synthesize,
|
|
|
23 |
inputs=[
|
24 |
-
gr.Textbox(lines=2, placeholder="ใใญในใ"),
|
25 |
-
gr.Textbox(lines=1, max_lines=1, placeholder="ใใน"),
|
26 |
-
gr.Slider(
|
27 |
-
|
28 |
-
), # SDP input
|
29 |
-
gr.Slider(
|
30 |
-
minimum=0.5, maximum=2.0, step=0.1, value=1.0, label="Speed"
|
31 |
-
), # Speed input
|
32 |
],
|
33 |
outputs="audio",
|
34 |
title="SBV2้ณๅฃฐๅๆ",
|
@@ -36,12 +32,17 @@ iface = gr.Interface(
|
|
36 |
examples=[
|
37 |
[
|
38 |
"ใใฏใใใใใใพใใ",
|
39 |
-
"googlefan/sbv2_personal_models/
|
40 |
0.0,
|
41 |
1.0,
|
42 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
],
|
44 |
)
|
45 |
|
46 |
-
# Launch the Gradio app
|
47 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import hf_hub_download
|
3 |
from sbv2_bindings import TTSModel
|
|
|
4 |
|
5 |
bert = hf_hub_download("googlefan/sbv2_onnx_models", "deberta.onnx")
|
6 |
tokenizer = hf_hub_download("googlefan/sbv2_onnx_models", "tokenizer.json")
|
7 |
model = TTSModel.from_path(bert, tokenizer)
|
8 |
+
uid = "default"
|
9 |
|
10 |
|
11 |
def load_and_synthesize(text: str, path: str, sdp: float = 0.0, speed: float = 1.0):
|
|
|
12 |
path = path.split("/")
|
13 |
filename = path[-1]
|
14 |
repo_id = "/".join(path[:-1])
|
|
|
18 |
|
19 |
|
20 |
iface = gr.Interface(
|
21 |
+
fn=load_and_synthesize,
|
22 |
+
concurrency_limit=1,
|
23 |
inputs=[
|
24 |
+
gr.Textbox(lines=2, placeholder="ใใญในใ"),
|
25 |
+
gr.Textbox(lines=1, max_lines=1, placeholder="ใใน"),
|
26 |
+
gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.0, label="SDP"),
|
27 |
+
gr.Slider(minimum=0.5, maximum=2.0, step=0.1, value=1.0, label="Speed"),
|
|
|
|
|
|
|
|
|
28 |
],
|
29 |
outputs="audio",
|
30 |
title="SBV2้ณๅฃฐๅๆ",
|
|
|
32 |
examples=[
|
33 |
[
|
34 |
"ใใฏใใใใใใพใใ",
|
35 |
+
"googlefan/sbv2_personal_models/tsukuyomi.sbv2",
|
36 |
0.0,
|
37 |
1.0,
|
38 |
+
],
|
39 |
+
[
|
40 |
+
"ไปๆฅใฎๅคฉๆฐใฏๆดใใงใใๅ ดๆใซใใฃใฆใฏ้จใ้ใใงใใใใ",
|
41 |
+
"googlefan/sbv2_personal_models/iroha.sbv2",
|
42 |
+
0.0,
|
43 |
+
1.1,
|
44 |
+
],
|
45 |
],
|
46 |
)
|
47 |
|
|
|
48 |
iface.launch()
|