Plachta commited on
Commit
4ff2b18
1 Parent(s): 7916677

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -103,10 +103,10 @@ def infer(text_raw, character, language, duration, noise_scale, noise_scale_w, i
103
  # check character & duraction parameter
104
  if language not in languages:
105
  print("Error: No such language\n")
106
- return "Error: No such language", None
107
  if character not in characters:
108
  print("Error: No such character\n")
109
- return "Error: No such character", None
110
  # check text length
111
  if limitation:
112
  text_len = len(text_raw) if is_symbol else len(re.sub("\[([A-Z]{2})\]", "", text_raw))
@@ -115,10 +115,10 @@ def infer(text_raw, character, language, duration, noise_scale, noise_scale_w, i
115
  max_len *= 3
116
  if text_len > max_len:
117
  print(f"Refused: Text too long ({text_len}).")
118
- return "Error: Text is too long", None
119
  if text_len == 0:
120
  print("Refused: Text length is zero.")
121
- return "Error: Please input text!", None
122
  if is_symbol:
123
  text = text_raw
124
  elif language == '日本語':
@@ -147,7 +147,7 @@ def infer(text_raw, character, language, duration, noise_scale, noise_scale_w, i
147
  char_dur_list.append(char_dur)
148
  except IndexError:
149
  print("Refused: Phoneme input contains non-phoneme character.")
150
- return "Error: You can only input phoneme under phoneme input model", None
151
  char_spacing_dur_list = []
152
  char_spacings = []
153
  for i in range(len(durations)):
 
103
  # check character & duraction parameter
104
  if language not in languages:
105
  print("Error: No such language\n")
106
+ return "Error: No such language", None, None, None
107
  if character not in characters:
108
  print("Error: No such character\n")
109
+ return "Error: No such character", None, None, None
110
  # check text length
111
  if limitation:
112
  text_len = len(text_raw) if is_symbol else len(re.sub("\[([A-Z]{2})\]", "", text_raw))
 
115
  max_len *= 3
116
  if text_len > max_len:
117
  print(f"Refused: Text too long ({text_len}).")
118
+ return "Error: Text is too long", None, None, None
119
  if text_len == 0:
120
  print("Refused: Text length is zero.")
121
+ return "Error: Please input text!", None, None, None
122
  if is_symbol:
123
  text = text_raw
124
  elif language == '日本語':
 
147
  char_dur_list.append(char_dur)
148
  except IndexError:
149
  print("Refused: Phoneme input contains non-phoneme character.")
150
+ return "Error: You can only input phoneme under phoneme input model", None, None, None
151
  char_spacing_dur_list = []
152
  char_spacings = []
153
  for i in range(len(durations)):