Googlefan commited on
Commit
575cef2
โ€ข
1 Parent(s): afe64a4

refactor(app.py): update default UID and add concurrency limit

Browse files
Files changed (1) hide show
  1. app.py +15 -14
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, # The function to call
 
23
  inputs=[
24
- gr.Textbox(lines=2, placeholder="ใƒ†ใ‚ญใ‚นใƒˆ"), # Text input
25
- gr.Textbox(lines=1, max_lines=1, placeholder="ใƒ‘ใ‚น"), # Path input
26
- gr.Slider(
27
- minimum=0.0, maximum=1.0, step=0.01, value=0.0, label="SDP"
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/tenkas.sbv2",
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()