kevinwang676 commited on
Commit
c0b6e11
1 Parent(s): bb0955a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -7
app.py CHANGED
@@ -31,6 +31,7 @@ from cosyvoice.cli.cosyvoice import CosyVoice
31
  from cosyvoice.utils.file_utils import load_wav
32
 
33
  import spaces
 
34
 
35
  logging.basicConfig(level=logging.WARNING,
36
  format='%(asctime)s %(levelname)s %(message)s')
@@ -152,15 +153,26 @@ default_data = np.zeros(target_sr)
152
 
153
  app = gr.Blocks(theme="JohnSmith9982/small_and_pretty")
154
  with app:
155
- gr.Markdown("# <center>🌊💕🎶 [CosyVoice](https://www.bilibili.com/video/BV1vz421q7ir/) 3秒音频,开启最强声音复刻</center>")
156
- gr.Markdown("## <center>🌟 只需3秒参考音频,一键开启超拟人真实声音复刻,支持中日英韩粤语,无需任何训练!</center>")
157
  gr.Markdown("### <center>🤗 更多精彩,尽在[滔滔AI](https://www.talktalkai.com/);滔滔AI,为爱滔滔!💕</center>")
158
-
 
 
 
 
 
 
 
 
 
 
 
159
  with gr.Row():
160
- tts_text = gr.Textbox(label="请填写您希望声音复刻的文本内容", lines=3, info="中文文本建议不超过100个字,英文文本不超过100个单词", placeholder="想说却还没说的,还很多...")
161
  mode_checkbox_group = gr.Radio(choices=inference_mode_list, label='请选择声音复刻类型', value=inference_mode_list[0], info="如果声音复刻的文本和参考音频对应的文本是同一种语言,请选择“3s极速复刻”;不同语言,请选“跨语种复刻”", visible=False)
162
  instruction_text = gr.Text(label="📔 操作指南", value=instruct_dict[inference_mode_list[0]], scale=0.5, visible=False)
163
- sft_dropdown = gr.Dropdown(choices=sft_spk, label='选择预训练音色', value=sft_spk[0], scale=0.25)
164
  with gr.Column(scale=0.25):
165
  seed_button = gr.Button(value="\U0001F3B2", visible=True)
166
  seed = gr.Number(value=0, label="随机推理种子", info="若数值保持不变,则每次生成结果一致", visible=True)
@@ -169,8 +181,8 @@ with app:
169
  prompt_text = gr.Textbox(label="请填写参考音频对应的文本内容", lines=3, placeholder="告诉我参考音频说了些什么吧...", visible=False)
170
  prompt_wav_upload = gr.Audio(type='filepath', label='请从本地上传您喜欢的参考音频,注意采样率不低于16kHz,时长不超过30s', visible=False)
171
  #prompt_wav_record = gr.Audio(type='filepath', label='通过麦克风录制参考音频,程序会优先使用本地上传的参考音频', visible=False)
172
- generate_button = gr.Button("一键开启声音复刻💕", variant="primary")
173
- instruct_text = gr.Textbox(label="输入instruct文本", lines=1, placeholder="请输入instruct文本.", value='')
174
 
175
 
176
  audio_output = gr.Audio(label="为您生成的专属音频🎶")
 
31
  from cosyvoice.utils.file_utils import load_wav
32
 
33
  import spaces
34
+ from textwrap import dedent
35
 
36
  logging.basicConfig(level=logging.WARNING,
37
  format='%(asctime)s %(levelname)s %(message)s')
 
153
 
154
  app = gr.Blocks(theme="JohnSmith9982/small_and_pretty")
155
  with app:
156
+ gr.Markdown("# <center>🌊💕🎶 [CosyVoice](https://www.bilibili.com/video/BV1vz421q7ir/) Instruct 一句话实现声音定制,听你想听</center>")
157
+ gr.Markdown("## <center>🌟 只需自然语言,就可以控制说话人的音色、语调、情感!</center>")
158
  gr.Markdown("### <center>🤗 更多精彩,尽在[滔滔AI](https://www.talktalkai.com/);滔滔AI,为爱滔滔!💕</center>")
159
+ with gr.Accordion("💡 一些AI歌手模型链接及使用说明(建议阅读)", open=False):
160
+ _ = f""" 查看自然语言定制声音的例子(您只需要复制英文部分的内容):
161
+ * 义愤填膺: Theo 'Crimson', is a fiery, passionate rebel leader. Fights with fervor for justice, but struggles with impulsiveness.
162
+ * 冷静安抚: Kai 'Torrent', is a cool-headed, tactical water mage who plans his moves carefully. A soothing presence with hidden depths.
163
+ * 活力鲁莽: Zara 'Wildfire', is an impulsive, fearless firebrand who loves a challenge. Her bravery inspires others, though she often acts recklessly.
164
+ * 神秘优雅: Selene 'Moonshade', is a mysterious, elegant dancer with a connection to the night. Her movements are both mesmerizing and deadly.
165
+ * 友善亲切: Priya, the humanitarian doctor, heals wounds of the world with her boundless empathy and skill.
166
+ * 智慧善良: Ivan, the old sea captain, navigates life's storms with timeless wisdom and a heart of gold.
167
+ * 诗词朗诵: A male voice with very slow pace and very sad emotion that is perfect for reciting poems.\n
168
+ 您也可以这样控制说话人: A [male/female] speaker with [normal/high/low] pitch, [normal/fast/slow] speaking rate, and [happy/sad/angry] emotion.
169
+ """
170
+ gr.Markdown(dedent(_))
171
  with gr.Row():
172
+ tts_text = gr.Textbox(label="请填写您希望声音定制的文本内容", lines=3, info="中文文本建议不超过100个字,英文文本不超过100个单词", placeholder="想说却还没说的,还很多...")
173
  mode_checkbox_group = gr.Radio(choices=inference_mode_list, label='请选择声音复刻类型', value=inference_mode_list[0], info="如果声音复刻的文本和参考音频对应的文本是同一种语言,请选择“3s极速复刻”;不同语言,请选“跨语种复刻”", visible=False)
174
  instruction_text = gr.Text(label="📔 操作指南", value=instruct_dict[inference_mode_list[0]], scale=0.5, visible=False)
175
+ sft_dropdown = gr.Dropdown(choices=sft_spk, label='选择预训练音色', info="会在一定程度上影响生成结果", value=sft_spk[1], scale=0.25)
176
  with gr.Column(scale=0.25):
177
  seed_button = gr.Button(value="\U0001F3B2", visible=True)
178
  seed = gr.Number(value=0, label="随机推理种子", info="若数值保持不变,则每次生成结果一致", visible=True)
 
181
  prompt_text = gr.Textbox(label="请填写参考音频对应的文本内容", lines=3, placeholder="告诉我参考音频说了些什么吧...", visible=False)
182
  prompt_wav_upload = gr.Audio(type='filepath', label='请从本地上传您喜欢的参考音频,注意采样率不低于16kHz,时长不超过30s', visible=False)
183
  #prompt_wav_record = gr.Audio(type='filepath', label='通过麦克风录制参考音频,程序会优先使用本地上传的参考音频', visible=False)
184
+ instruct_text = gr.Textbox(label="请用自然语言定制您的说话人,仅限英文。您可以参考我们在上方提供的例子", lines=1, value="", placeholder="A male voice with very slow pace and very sad emotion that is perfect for reciting poems.")
185
+ generate_button = gr.Button("一键开启声音定制💕", variant="primary")
186
 
187
 
188
  audio_output = gr.Audio(label="为您生成的专属音频🎶")