Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -114,6 +114,10 @@ def to_symbol_fn(is_symbol_input, input_text, temp_text):
|
|
114 |
else (temp_text, temp_text)
|
115 |
|
116 |
def infer(text_raw, character, language, duration, noise_scale, noise_scale_w, is_symbol):
|
|
|
|
|
|
|
|
|
117 |
# check character & duraction parameter
|
118 |
if language not in languages:
|
119 |
print("Error: No such language\n")
|
@@ -185,6 +189,10 @@ def infer(text_raw, character, language, duration, noise_scale, noise_scale_w, i
|
|
185 |
return (text,(22050, audio), jp2phoneme, duration_info_str)
|
186 |
|
187 |
def infer_from_phoneme_dur(duration_info_str, character, duration, noise_scale, noise_scale_w):
|
|
|
|
|
|
|
|
|
188 |
try:
|
189 |
phonemes = duration_info_str.split(", ")
|
190 |
recons_durs = []
|
@@ -318,7 +326,7 @@ if __name__ == "__main__":
|
|
318 |
"注意这些数字只能是整数。 \n\n(1 代表 0.01161 秒的长度)\n\n"
|
319 |
)
|
320 |
btn.click(infer, inputs=[textbox, char_dropdown, language_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider, symbol_input],
|
321 |
-
outputs=[text_output, audio_output, phoneme_output, duration_output])
|
322 |
cus_dur_gn_btn.click(infer_from_phoneme_dur, inputs=[duration_output, char_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider],
|
323 |
outputs=[phoneme_output, audio_output], api_name="custom_duration")
|
324 |
|
|
|
114 |
else (temp_text, temp_text)
|
115 |
|
116 |
def infer(text_raw, character, language, duration, noise_scale, noise_scale_w, is_symbol):
|
117 |
+
"""
|
118 |
+
infer
|
119 |
+
"""
|
120 |
+
|
121 |
# check character & duraction parameter
|
122 |
if language not in languages:
|
123 |
print("Error: No such language\n")
|
|
|
189 |
return (text,(22050, audio), jp2phoneme, duration_info_str)
|
190 |
|
191 |
def infer_from_phoneme_dur(duration_info_str, character, duration, noise_scale, noise_scale_w):
|
192 |
+
"""
|
193 |
+
infer from phoneme dur
|
194 |
+
"""
|
195 |
+
|
196 |
try:
|
197 |
phonemes = duration_info_str.split(", ")
|
198 |
recons_durs = []
|
|
|
326 |
"注意这些数字只能是整数。 \n\n(1 代表 0.01161 秒的长度)\n\n"
|
327 |
)
|
328 |
btn.click(infer, inputs=[textbox, char_dropdown, language_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider, symbol_input],
|
329 |
+
outputs=[text_output, audio_output, phoneme_output, duration_output], api_name="generate")
|
330 |
cus_dur_gn_btn.click(infer_from_phoneme_dur, inputs=[duration_output, char_dropdown, duration_slider, noise_scale_slider, noise_scale_w_slider],
|
331 |
outputs=[phoneme_output, audio_output], api_name="custom_duration")
|
332 |
|