Update app.py
Browse files
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 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
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)):
|