chilge commited on
Commit
a15140f
1 Parent(s): ee430f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -17
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
- stn_tst = get_text(txt, hps)
 
 
 
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
- with gr.Tabs():
86
- with gr.TabItem("使用预制情感合成"):
87
- tts_input1 = gr.TextArea(label="日语文本", value="こんにちは。私わあやちねねです。")
88
- tts_input2 = gr.Dropdown(label="情感", choices=list(emotion_dict.keys()), value="平静1")
89
- tts_submit = gr.Button("合成音频", variant="primary")
90
- tts_output1 = gr.Textbox(label="Message")
91
- tts_output2 = gr.Audio(label="Output")
92
- tts_submit.click(tts1, [tts_input1, tts_input2], [tts_output1, tts_output2])
93
- with gr.TabItem("随机抽取训练集样本作为情感参数"):
94
- tts_input1 = gr.TextArea(label="日语文本", value="こんにちは。私わあやちねねです。")
95
- tts_submit = gr.Button("合成音频", variant="primary")
96
- tts_output1 = gr.Textbox(label="随机样本id(可用于第三个tab中合成)")
97
- tts_output2 = gr.Audio(label="Output")
98
- tts_submit.click(tts2, [tts_input1], [tts_output1, tts_output2])
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()