Katock commited on
Commit
c0c81a2
·
1 Parent(s): dd829c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -26
app.py CHANGED
@@ -84,30 +84,26 @@ if __name__ == '__main__':
84
  with gr.Tabs():
85
  for (name, cover, (svc_fn, tts_fn)) in models:
86
  with gr.TabItem(name):
87
- svc_input = tts_input = gender = tts_rate = svc_submit = tts_submit = None
88
  with gr.Row():
89
  with gr.Column():
90
- mode = gr.Radio(label='模式', value='音频转音频', choices=['文字转音频', '音频转音频'])
91
- if mode == '音频转音频':
92
- svc_input = gr.Audio(label="上传干声 (已支持无限长音频,处理时间约为原音频时间的5倍)")
93
- with gr.Row():
94
- vc_transform = gr.Number(label="音高调整 (正负半音,12为一个八度)", value=0)
95
- auto_f0 = gr.Checkbox(label="自动音高预测 (正常说话可选)", value=False)
96
- f0_predictor = gr.Radio(label="f0预测器 (对电音有影响)",
97
- choices=['crepe', 'harvest', 'dio', 'pm'], value='crepe')
98
- svc_submit = gr.Button("生成", variant="primary")
99
- else:
100
- tts_input = gr.Textbox(label='说话内容', value='',
101
- placeholder='请输入说话内容,(已支持无限长内容,处理时间约为说完原内容时间的5倍)')
102
- with gr.Row():
103
- gender = gr.Radio(label='说话人性别', value='男', choices=['男', '女'])
104
- tts_rate = gr.Number(label='语速 (正负百分比)', value=0)
105
- with gr.Row():
106
- vc_transform = gr.Number(label="音高调整 (正负半音,12为一个八度)", value=0)
107
- auto_f0 = gr.Checkbox(label="自动音高预测 (正常说话可选)", value=False)
108
- f0_predictor = gr.Radio(label="f0预测器 (对电音有影响)",
109
- choices=['crepe', 'harvest', 'dio', 'pm'], value='crepe')
110
- tts_submit = gr.Button("生成", variant="primary")
111
 
112
  with gr.Column():
113
  gr.Markdown(
@@ -116,8 +112,10 @@ if __name__ == '__main__':
116
  '</div>'
117
  )
118
  vc_output = gr.Audio(label="输出音频")
119
- svc_submit.click(svc_fn, [svc_input, vc_transform, auto_f0, f0_predictor], vc_output)
120
- tts_submit.click(tts_fn,
121
- [tts_input, gender, tts_rate, vc_transform, auto_f0, f0_predictor],
122
- vc_output)
 
 
123
  app.queue(concurrency_count=1, api_open=args.api).launch(share=args.share)
 
84
  with gr.Tabs():
85
  for (name, cover, (svc_fn, tts_fn)) in models:
86
  with gr.TabItem(name):
 
87
  with gr.Row():
88
  with gr.Column():
89
+ with gr.Row():
90
+ vc_transform = gr.Number(label="音高调整 (正负半音,12为一个八度)", value=0)
91
+ auto_f0 = gr.Checkbox(label="自动音高预测 (正常说话可选)", value=False)
92
+ f0_predictor = gr.Radio(label="f0预测器 (对电音有影响)",
93
+ choices=['crepe', 'harvest', 'dio', 'pm'], value='crepe')
94
+ with gr.Tabs():
95
+ with gr.TabItem('语音转语音'):
96
+ svc_input = gr.Audio(
97
+ label="上传干声 (已支持无限长音频,处理时间约为原音频时间的5倍)")
98
+ svc_submit = gr.Button("生成", variant="primary")
99
+
100
+ with gr.TabItem('文本转语音'):
101
+ tts_input = gr.Textbox(label='说话内容', value='',
102
+ placeholder='请输入说话内容,(已支持无限长内容,处理时间约为说完原内容时间的5倍)')
103
+ with gr.Row():
104
+ gender = gr.Radio(label='说话人性别', value='男', choices=['男', '女'])
105
+ tts_rate = gr.Number(label='语速 (正负百分比)', value=0)
106
+ tts_submit = gr.Button("生成", variant="primary")
 
 
 
107
 
108
  with gr.Column():
109
  gr.Markdown(
 
112
  '</div>'
113
  )
114
  vc_output = gr.Audio(label="输出音频")
115
+ svc_submit.click(svc_fn, [svc_input, vc_transform, auto_f0, f0_predictor],
116
+ vc_output)
117
+ tts_submit.click(tts_fn,
118
+ [tts_input, gender, tts_rate, vc_transform, auto_f0,
119
+ f0_predictor],
120
+ vc_output)
121
  app.queue(concurrency_count=1, api_open=args.api).launch(share=args.share)