Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,10 @@ for file_name in file_names:
|
|
34 |
emotion[emotion_name] = os.path.join("./wavs", file_name)
|
35 |
import random
|
36 |
def tts(txt, emotion):
|
37 |
-
|
|
|
|
|
|
|
38 |
randsample = None
|
39 |
with torch.no_grad():
|
40 |
x_tst = stn_tst.unsqueeze(0)
|
@@ -81,21 +84,21 @@ def tts3(text, sample):
|
|
81 |
except:
|
82 |
return "输入参数不为整数或其他错误", None
|
83 |
app = gr.Blocks()
|
84 |
-
with app:
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
|
100 |
with gr.TabItem("使用指定情感样本作为情感参数"):
|
101 |
|
@@ -108,5 +111,5 @@ with app:
|
|
108 |
|
109 |
with gr.TabItem("使用参考音频作为情感参数"):
|
110 |
tts_input1 = gr.TextArea(label="text", value="暂未实现")
|
111 |
-
|
112 |
app.launch()
|
|
|
34 |
emotion[emotion_name] = os.path.join("./wavs", file_name)
|
35 |
import random
|
36 |
def tts(txt, emotion):
|
37 |
+
if roma:
|
38 |
+
stn_tst = get_text_byroma(txt, hps)
|
39 |
+
else:
|
40 |
+
stn_tst = get_text(txt, hps)
|
41 |
randsample = None
|
42 |
with torch.no_grad():
|
43 |
x_tst = stn_tst.unsqueeze(0)
|
|
|
84 |
except:
|
85 |
return "输入参数不为整数或其他错误", None
|
86 |
app = gr.Blocks()
|
87 |
+
#with app:
|
88 |
+
# with gr.Tabs():
|
89 |
+
# with gr.TabItem("使用预制情感合成"):
|
90 |
+
# tts_input1 = gr.TextArea(label="日语文本", value="こんにちは。私わあやちねねです。")
|
91 |
+
# tts_input2 = gr.Dropdown(label="情感", choices=list(emotion_dict.keys()), value="平静1")
|
92 |
+
# tts_submit = gr.Button("合成音频", variant="primary")
|
93 |
+
# tts_output1 = gr.Textbox(label="Message")
|
94 |
+
# tts_output2 = gr.Audio(label="Output")
|
95 |
+
# tts_submit.click(tts1, [tts_input1, tts_input2], [tts_output1, tts_output2])
|
96 |
+
# with gr.TabItem("随机抽取训练集样本作为情感参数"):
|
97 |
+
# tts_input1 = gr.TextArea(label="日语文本", value="こんにちは。私わあやちねねです。")
|
98 |
+
# tts_submit = gr.Button("合成音频", variant="primary")
|
99 |
+
# tts_output1 = gr.Textbox(label="随机样本id(可用于第三个tab中合成)")
|
100 |
+
# tts_output2 = gr.Audio(label="Output")
|
101 |
+
# tts_submit.click(tts2, [tts_input1], [tts_output1, tts_output2])
|
102 |
|
103 |
with gr.TabItem("使用指定情感样本作为情感参数"):
|
104 |
|
|
|
111 |
|
112 |
with gr.TabItem("使用参考音频作为情感参数"):
|
113 |
tts_input1 = gr.TextArea(label="text", value="暂未实现")
|
114 |
+
tts(txt, emotion)
|
115 |
app.launch()
|