Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -66,7 +66,7 @@ def convert_accented_text(text):
|
|
66 |
result += unicodedata.normalize('NFC', char)
|
67 |
return result
|
68 |
|
69 |
-
def
|
70 |
text = text.replace(':', ':::')
|
71 |
text = text.replace(',', ',:::')
|
72 |
text = text.replace(';', ';:::')
|
@@ -87,13 +87,13 @@ with open('dict.txt', 'r', encoding='utf-8') as f:
|
|
87 |
base_word = remove_combining_chars(line_normalized.replace('+', '').lower())
|
88 |
custom_dict[base_word] = line_normalized
|
89 |
|
90 |
-
def transform_text(text, apply_custom_dict,
|
91 |
text = normalize_text(text)
|
92 |
if apply_custom_dict:
|
93 |
text = replace_with_custom_dict(text, custom_dict)
|
94 |
text = convert_accented_text(text)
|
95 |
-
if
|
96 |
-
text =
|
97 |
return text
|
98 |
|
99 |
def synthesise(transformed_text, speed, steps, progress=gr.Progress()):
|
@@ -123,8 +123,8 @@ if __name__ == "__main__":
|
|
123 |
generate_button = gr.Button('Згенерувати аудіо')
|
124 |
audio_output = gr.Audio(label="Audio:", autoplay=False, streaming=False, type="numpy")
|
125 |
|
126 |
-
def update_transformed_text(text, apply_custom_dict,
|
127 |
-
transformed_text = transform_text(text, apply_custom_dict,
|
128 |
return transformed_text
|
129 |
|
130 |
# Set up live update of transformed text
|
|
|
66 |
result += unicodedata.normalize('NFC', char)
|
67 |
return result
|
68 |
|
69 |
+
def add_pauses_to_text(text):
|
70 |
text = text.replace(':', ':::')
|
71 |
text = text.replace(',', ',:::')
|
72 |
text = text.replace(';', ';:::')
|
|
|
87 |
base_word = remove_combining_chars(line_normalized.replace('+', '').lower())
|
88 |
custom_dict[base_word] = line_normalized
|
89 |
|
90 |
+
def transform_text(text, apply_custom_dict, add_pauses_flag):
|
91 |
text = normalize_text(text)
|
92 |
if apply_custom_dict:
|
93 |
text = replace_with_custom_dict(text, custom_dict)
|
94 |
text = convert_accented_text(text)
|
95 |
+
if add_pauses_flag:
|
96 |
+
text = add_pauses_to_text(text)
|
97 |
return text
|
98 |
|
99 |
def synthesise(transformed_text, speed, steps, progress=gr.Progress()):
|
|
|
123 |
generate_button = gr.Button('Згенерувати аудіо')
|
124 |
audio_output = gr.Audio(label="Audio:", autoplay=False, streaming=False, type="numpy")
|
125 |
|
126 |
+
def update_transformed_text(text, apply_custom_dict, add_pauses_flag):
|
127 |
+
transformed_text = transform_text(text, apply_custom_dict, add_pauses_flag)
|
128 |
return transformed_text
|
129 |
|
130 |
# Set up live update of transformed text
|