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

fix key error

Browse files
Files changed (2) hide show
  1. css/advanced.py +3 -0
  2. css/preset.py +3 -2
css/advanced.py CHANGED
@@ -8,7 +8,9 @@ from css.utils import *
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)
@@ -16,6 +18,7 @@ def advanced():
16
  @spaces.GPU
17
  def generate_audio(_sound_radio, _speech_status_textbox,
18
  _synthetic_input_textbox, _seed):
 
19
  print(_sound_radio, _speech_status_textbox, _synthetic_input_textbox, _seed)
20
  if _synthetic_input_textbox == '':
21
  #gr.Warning('合成文本为空,您是否忘记输入合成文本?')
 
8
  # 高级语音生成
9
  def advanced():
10
 
11
+ sound_choices_values = ['中文女', '中文男', '英文女', '英文男', '日语男', '粤语女', '韩语女']
12
  sound_choices = ['Chinese Female', 'Chinese Male', 'Japanese Male', 'English Female', 'English Male', 'Cantonese Female', 'Korean Female']
13
+ sound_choices_dict = {k:v for k, v in zip(sound_choices, sound_choices_values)}
14
 
15
  def random_seed():
16
  return random.randint(1, 100000000)
 
18
  @spaces.GPU
19
  def generate_audio(_sound_radio, _speech_status_textbox,
20
  _synthetic_input_textbox, _seed):
21
+ _sound_radio = sound_choices_dict[_sound_radio]
22
  print(_sound_radio, _speech_status_textbox, _synthetic_input_textbox, _seed)
23
  if _synthetic_input_textbox == '':
24
  #gr.Warning('合成文本为空,您是否忘记输入合成文本?')
css/preset.py CHANGED
@@ -8,14 +8,15 @@ from css.utils import *
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)
16
 
17
  @spaces.GPU
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('合成文本为空,您是否忘记输入合成文本?')
 
8
  # 预置语音生成
9
  def preset():
10
 
11
+ sound_choices_values = ['中文女', '中文男', '英文女', '英文男', '日语男', '粤语女', '韩语女']
12
  sound_choices = ['Chinese Female', 'Chinese Male', 'Japanese Male', 'English Female', 'English Male', 'Cantonese Female', 'Korean Female']
13
+ sound_choices_dict = {k:v for k, v in zip(sound_choices, sound_choices_values)}
14
  def random_seed():
15
  return random.randint(1, 100000000)
16
 
17
  @spaces.GPU
18
  def generate_audio(_sound_radio, _synthetic_input_textbox, _seed):
19
+ _sound_radio = sound_choices_dict[_sound_radio]
20
  print(_sound_radio, _synthetic_input_textbox, _seed)
21
  if _synthetic_input_textbox == '':
22
  # gr.Warning('合成文本为空,您是否忘记输入合成文本?')