Plachta commited on
Commit
5d2aa5c
β€’
1 Parent(s): a36cbf2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -140,10 +140,14 @@ def infer(text_raw, character, language, duration, noise_scale, noise_scale_w, i
140
  durations = net_g.predict_duration(x_tst, x_tst_lengths, sid=sid, noise_scale=noise_scale,
141
  noise_scale_w=noise_scale_w, length_scale=duration)
142
  char_dur_list = []
143
- for i, char in enumerate(jp2phoneme):
144
- char_pos = i * 2 + 1
145
- char_dur = durations[char_pos]
146
- char_dur_list.append(char_dur)
 
 
 
 
147
  char_spacing_dur_list = []
148
  char_spacings = []
149
  for i in range(len(durations)):
 
140
  durations = net_g.predict_duration(x_tst, x_tst_lengths, sid=sid, noise_scale=noise_scale,
141
  noise_scale_w=noise_scale_w, length_scale=duration)
142
  char_dur_list = []
143
+ try:
144
+ for i, char in enumerate(jp2phoneme):
145
+ char_pos = i * 2 + 1
146
+ char_dur = durations[char_pos]
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)):