wenmeng.zwm commited on
Commit
4905c07
1 Parent(s): fa47fc6

chinese to english

Browse files
Files changed (3) hide show
  1. css/advanced.py +12 -11
  2. css/custom.py +17 -16
  3. css/preset.py +12 -9
css/advanced.py CHANGED
@@ -8,7 +8,7 @@ from css.utils import *
8
  # 高级语音生成
9
  def advanced():
10
 
11
- sound_choices = ['中文女', '中文男', '日语男', '英文女', '英文男', '粤语女', '韩语女']
12
 
13
  def random_seed():
14
  return random.randint(1, 100000000)
@@ -18,7 +18,8 @@ def advanced():
18
  _synthetic_input_textbox, _seed):
19
  print(_sound_radio, _speech_status_textbox, _synthetic_input_textbox, _seed)
20
  if _synthetic_input_textbox == '':
21
- gr.Warning('合成文本为空,您是否忘记输入合成文本?')
 
22
  return (target_sr, default_data)
23
  set_all_random_seed(_seed)
24
  model = cosyvoice_instruct
@@ -29,27 +30,27 @@ def advanced():
29
  with gr.Column():
30
  sound_radio = gr.Radio(choices=sound_choices,
31
  value=sound_choices[0],
32
- label="选择预置音色")
33
  with gr.Column():
34
- speech_status_textbox = gr.Textbox(label="描述语音状态")
35
  gr.Examples(
36
- label="示例控制文本",
37
  examples=[
38
  ["Selene 'Moonshade', is a mysterious, elegant dancer with a connection to the night. Her movements are both mesmerizing and deadly. "],
39
  ["A female speaker with normal pitch, slow speaking rate, and sad emotion."],
40
  ],
41
  inputs=[speech_status_textbox])
42
  with gr.Column():
43
- synthetic_input_textbox = gr.Textbox(label="输入合成文本")
44
  gr.Examples(
45
- label="示例文本",
46
  examples=example_tts_text,
47
  inputs=[synthetic_input_textbox])
48
 
49
- with gr.Accordion(label="随机种子"):
50
  with gr.Row():
51
  with gr.Column(scale=1, min_width=180):
52
- seed_button = gr.Button(value="\U0001F3B2 随机换一换",
53
  elem_classes="full-height")
54
  with gr.Column(scale=10):
55
  seed = gr.Number(show_label=False,
@@ -57,10 +58,10 @@ def advanced():
57
  container=False,
58
  elem_classes="full-height")
59
  with gr.Column():
60
- generate_button = gr.Button("生成音频", variant="primary", size="lg")
61
 
62
  with gr.Column():
63
- output_audio = gr.Audio(label="合成音频")
64
 
65
  seed_button.click(fn=random_seed, outputs=[seed])
66
  generate_button.click(fn=generate_audio,
 
8
  # 高级语音生成
9
  def advanced():
10
 
11
+ sound_choices = ['Chinese Female', 'Chinese Male', 'Japanese Male', 'English Female', 'English Male', 'Cantonese Female', 'Korean Female']
12
 
13
  def random_seed():
14
  return random.randint(1, 100000000)
 
18
  _synthetic_input_textbox, _seed):
19
  print(_sound_radio, _speech_status_textbox, _synthetic_input_textbox, _seed)
20
  if _synthetic_input_textbox == '':
21
+ #gr.Warning('合成文本为空,您是否忘记输入合成文本?')
22
+ gr.Warning('The synthesis text is empty, did you forget to input the synthesis text?')
23
  return (target_sr, default_data)
24
  set_all_random_seed(_seed)
25
  model = cosyvoice_instruct
 
30
  with gr.Column():
31
  sound_radio = gr.Radio(choices=sound_choices,
32
  value=sound_choices[0],
33
+ label="Select Preset Voice")
34
  with gr.Column():
35
+ speech_status_textbox = gr.Textbox(label="Describe Voice Status")
36
  gr.Examples(
37
+ label="Example of control text",
38
  examples=[
39
  ["Selene 'Moonshade', is a mysterious, elegant dancer with a connection to the night. Her movements are both mesmerizing and deadly. "],
40
  ["A female speaker with normal pitch, slow speaking rate, and sad emotion."],
41
  ],
42
  inputs=[speech_status_textbox])
43
  with gr.Column():
44
+ synthetic_input_textbox = gr.Textbox(label="Input Synthesis Text")
45
  gr.Examples(
46
+ label="example",
47
  examples=example_tts_text,
48
  inputs=[synthetic_input_textbox])
49
 
50
+ with gr.Accordion(label="Random Seed"):
51
  with gr.Row():
52
  with gr.Column(scale=1, min_width=180):
53
+ seed_button = gr.Button(value="\U0001F3B2 Shuffle Randomly",
54
  elem_classes="full-height")
55
  with gr.Column(scale=10):
56
  seed = gr.Number(show_label=False,
 
58
  container=False,
59
  elem_classes="full-height")
60
  with gr.Column():
61
+ generate_button = gr.Button("Generate Audio", variant="primary", size="lg")
62
 
63
  with gr.Column():
64
+ output_audio = gr.Audio(label="Synthesize Audio")
65
 
66
  seed_button.click(fn=random_seed, outputs=[seed])
67
  generate_button.click(fn=generate_audio,
css/custom.py CHANGED
@@ -18,7 +18,8 @@ def custom():
18
  t1 = time.time()
19
  print(_recorded_audio, _prompt_input_textbox, _language_radio, _synthetic_input_textbox, _seed)
20
  if _synthetic_input_textbox == '':
21
- gr.Warning('合成文本为空,您是否忘记输入合成文本?')
 
22
  return (target_sr, default_data)
23
  set_all_random_seed(_seed)
24
  if use_instruct(_synthetic_input_textbox):
@@ -45,33 +46,33 @@ def custom():
45
  with gr.Column(scale=1, min_width=400):
46
  with gr.Group():
47
  recorded_audio = gr.Audio(sources=['microphone'],
48
- label="录制音频文件",
49
  type='filepath')
50
- gr.Text("请点击录制,并朗读右方文字(中文或英文)完成录入",
51
  max_lines=1,
52
  container=False,
53
  interactive=False)
54
  with gr.Column(scale=10):
55
- prompt_input_textbox = gr.Textbox(label="输入待录制文本")
56
  gr.Examples(
57
- label="示例待录制文本",
58
  examples=example_prompt_text,
59
  inputs=[prompt_input_textbox])
60
-
61
  with gr.Column():
62
- language_radio = gr.Radio(choices=[('同语种', 'same'), ('跨语种', 'cross')],
63
  value='same',
64
- label="输入合成文本")
65
  synthetic_input_textbox = gr.Textbox(show_label=False)
66
  gr.Examples(
67
- label="示例文本",
68
  examples=example_tts_text,
69
  inputs=[synthetic_input_textbox])
70
-
71
- with gr.Accordion(label="随机种子"):
72
  with gr.Row():
73
  with gr.Column(scale=1, min_width=180):
74
- seed_button = gr.Button(value="\U0001F3B2 随机换一换",
75
  elem_classes="full-height")
76
  with gr.Column(scale=10):
77
  seed = gr.Number(show_label=False,
@@ -79,11 +80,11 @@ def custom():
79
  container=False,
80
  elem_classes="full-height")
81
  with gr.Column():
82
- generate_button = gr.Button("生成音频", variant="primary", size="lg")
83
-
84
  with gr.Column():
85
- output_audio = gr.Audio(label="合成音频")
86
-
87
  seed_button.click(fn=random_seed, outputs=[seed])
88
  generate_button.click(
89
  fn=generate_audio,
 
18
  t1 = time.time()
19
  print(_recorded_audio, _prompt_input_textbox, _language_radio, _synthetic_input_textbox, _seed)
20
  if _synthetic_input_textbox == '':
21
+ # gr.Warning('合成文本为空,您是否忘记输入合成文本?')
22
+ gr.Warning('The synthesis text is empty, did you forget to input the synthesis text?')
23
  return (target_sr, default_data)
24
  set_all_random_seed(_seed)
25
  if use_instruct(_synthetic_input_textbox):
 
46
  with gr.Column(scale=1, min_width=400):
47
  with gr.Group():
48
  recorded_audio = gr.Audio(sources=['microphone'],
49
+ label="Record Audio File",
50
  type='filepath')
51
+ gr.Text("Please click to record and read the text on the right (Chinese or English) to complete the input",
52
  max_lines=1,
53
  container=False,
54
  interactive=False)
55
  with gr.Column(scale=10):
56
+ prompt_input_textbox = gr.Textbox(label="Input Text for Recording")
57
  gr.Examples(
58
+ label="Example Recording Texts",
59
  examples=example_prompt_text,
60
  inputs=[prompt_input_textbox])
61
+
62
  with gr.Column():
63
+ language_radio = gr.Radio(choices=[('Same Language', 'same'), ('Cross Language', 'cross')],
64
  value='same',
65
+ label="Input Synthesis Text")
66
  synthetic_input_textbox = gr.Textbox(show_label=False)
67
  gr.Examples(
68
+ label="Example Texts",
69
  examples=example_tts_text,
70
  inputs=[synthetic_input_textbox])
71
+
72
+ with gr.Accordion(label="Random Seed"):
73
  with gr.Row():
74
  with gr.Column(scale=1, min_width=180):
75
+ seed_button = gr.Button(value="\U0001F3B2 Shuffle Randomly",
76
  elem_classes="full-height")
77
  with gr.Column(scale=10):
78
  seed = gr.Number(show_label=False,
 
80
  container=False,
81
  elem_classes="full-height")
82
  with gr.Column():
83
+ generate_button = gr.Button("Generate Audio", variant="primary", size="lg")
84
+
85
  with gr.Column():
86
+ output_audio = gr.Audio(label="Synthesized Audio")
87
+
88
  seed_button.click(fn=random_seed, outputs=[seed])
89
  generate_button.click(
90
  fn=generate_audio,
css/preset.py CHANGED
@@ -8,7 +8,8 @@ from css.utils import *
8
  # 预置语音生成
9
  def preset():
10
 
11
- sound_choices = ['中文女', '中文男', '英文女', '英文男', '日语男', '粤语女', '韩语女']
 
12
 
13
  def random_seed():
14
  return random.randint(1, 100000000)
@@ -17,7 +18,8 @@ def preset():
17
  def generate_audio(_sound_radio, _synthetic_input_textbox, _seed):
18
  print(_sound_radio, _synthetic_input_textbox, _seed)
19
  if _synthetic_input_textbox == '':
20
- gr.Warning('合成文本为空,您是否忘记输入合成文本?')
 
21
  return (target_sr, default_data)
22
  set_all_random_seed(_seed)
23
  if use_instruct(_synthetic_input_textbox):
@@ -31,18 +33,19 @@ def preset():
31
  with gr.Column():
32
  sound_radio = gr.Radio(choices=sound_choices,
33
  value=sound_choices[0],
34
- label="选择预置音色")
 
35
  with gr.Column():
36
- synthetic_input_textbox = gr.Textbox(label="输入合成文本")
37
  gr.Examples(
38
- label="示例文本",
39
  examples=example_tts_text,
40
  inputs=[synthetic_input_textbox])
41
 
42
- with gr.Accordion(label="随机种子"):
43
  with gr.Row():
44
  with gr.Column(scale=1, min_width=180):
45
- seed_button = gr.Button(value="\U0001F3B2 随机换一换",
46
  elem_classes="full-height")
47
  with gr.Column(scale=10):
48
  seed = gr.Number(show_label=False,
@@ -50,10 +53,10 @@ def preset():
50
  container=False,
51
  elem_classes="full-height")
52
  with gr.Column():
53
- generate_button = gr.Button("生成音频", variant="primary", size="lg")
54
 
55
  with gr.Column():
56
- output_audio = gr.Audio(label="合成音频")
57
 
58
  seed_button.click(fn=random_seed, outputs=[seed])
59
  generate_button.click(fn=generate_audio,
 
8
  # 预置语音生成
9
  def preset():
10
 
11
+ #sound_choices = ['中文女', '中文男', '英文女', '英文男', '日语男', '粤语女', '韩语女']
12
+ sound_choices = ['Chinese Female', 'Chinese Male', 'Japanese Male', 'English Female', 'English Male', 'Cantonese Female', 'Korean Female']
13
 
14
  def random_seed():
15
  return random.randint(1, 100000000)
 
18
  def generate_audio(_sound_radio, _synthetic_input_textbox, _seed):
19
  print(_sound_radio, _synthetic_input_textbox, _seed)
20
  if _synthetic_input_textbox == '':
21
+ # gr.Warning('合成文本为空,您是否忘记输入合成文本?')
22
+ gr.Warning('The synthesis text is empty, did you forget to input the synthesis text?')
23
  return (target_sr, default_data)
24
  set_all_random_seed(_seed)
25
  if use_instruct(_synthetic_input_textbox):
 
33
  with gr.Column():
34
  sound_radio = gr.Radio(choices=sound_choices,
35
  value=sound_choices[0],
36
+ label="Select Preset Voice")
37
+ #label="选择预置音色")
38
  with gr.Column():
39
+ synthetic_input_textbox = gr.Textbox(label="Input Synthesis Text")
40
  gr.Examples(
41
+ label="Example Text",
42
  examples=example_tts_text,
43
  inputs=[synthetic_input_textbox])
44
 
45
+ with gr.Accordion(label="Random Seed"):
46
  with gr.Row():
47
  with gr.Column(scale=1, min_width=180):
48
+ seed_button = gr.Button(value="\U0001F3B2 Shuffle randomly",
49
  elem_classes="full-height")
50
  with gr.Column(scale=10):
51
  seed = gr.Number(show_label=False,
 
53
  container=False,
54
  elem_classes="full-height")
55
  with gr.Column():
56
+ generate_button = gr.Button("Generate audio", variant="primary", size="lg")
57
 
58
  with gr.Column():
59
+ output_audio = gr.Audio(label="Synthesize Audio")
60
 
61
  seed_button.click(fn=random_seed, outputs=[seed])
62
  generate_button.click(fn=generate_audio,