stefantaubert commited on
Commit
e3bcf30
1 Parent(s): a31f9ef
app.py CHANGED
@@ -1,309 +1,3 @@
1
- import shutil
2
- import sys
3
- import zipfile
4
- from datetime import datetime
5
- from functools import partial
6
- from pathlib import Path
7
- from tempfile import gettempdir
8
- from typing import Dict
9
 
10
- import gradio as gr
11
- from scipy.io.wavfile import read
12
-
13
- from en_tts_app import (get_log_path, get_work_dir, initialize_app, load_models_to_cache, run_main,
14
- synthesize_english)
15
-
16
-
17
- def run():
18
- exit_code = initialize_app()
19
- if exit_code > 0:
20
- sys.exit(exit_code)
21
-
22
- exit_code = run_main(launch_interface)
23
- sys.exit(exit_code)
24
-
25
-
26
- def launch_interface():
27
- cache = load_models_to_cache()
28
-
29
- fn = partial(synt, cache=cache)
30
-
31
- # iface = gr.Interface(
32
- # fn=fn,
33
- # inputs=[gr.Textbox(example_text, label="Text")],
34
- # outputs=[gr.Audio(type="numpy", label="Speech", autoplay=True)],
35
- # )
36
-
37
- with gr.Blocks(
38
- title="en-tts"
39
- ) as demo:
40
- gr.Markdown(
41
- """
42
- # English Speech Synthesis
43
-
44
- Enter or paste your text into the provided text box and click the **Synthesize** button to convert it into speech. You can adjust settings as desired before synthesizing.
45
- """
46
- )
47
-
48
- with gr.Tab("Synthesis"):
49
- with gr.Row():
50
- with gr.Column():
51
- with gr.Group():
52
- input_txt_box = gr.Textbox(
53
- None,
54
- label="Input",
55
- placeholder="Enter the text you want to synthesize (or load an example from below).",
56
- lines=10,
57
- max_lines=5000,
58
- )
59
-
60
- with gr.Accordion("Settings", open=False):
61
- sent_norm_check_box = gr.Checkbox(
62
- False,
63
- label="Skip normalization",
64
- info="Skip normalization of numbers, units and abbreviations."
65
- )
66
-
67
- sent_sep_check_box = gr.Checkbox(
68
- False,
69
- label="Skip sentence separation",
70
- info="Skip sentence separation after these characters: .?!"
71
- )
72
-
73
- sil_sent_txt_box = gr.Number(
74
- 0.4,
75
- minimum=0.0,
76
- maximum=60,
77
- step=0.1,
78
- label="Silence between sentences (s)",
79
- info="Insert silence between each sentence."
80
- )
81
-
82
- sil_para_txt_box = gr.Number(
83
- 1.0,
84
- minimum=0.0,
85
- maximum=60,
86
- step=0.1,
87
- label="Silence between paragraphs (s)",
88
- info="Insert silence between each paragraph."
89
- )
90
-
91
- seed_txt_box = gr.Number(
92
- 0,
93
- minimum=0,
94
- maximum=999999,
95
- label="Seed",
96
- info="Seed used for inference in order to be able to reproduce the results."
97
- )
98
-
99
- sigma_txt_box = gr.Number(
100
- 1.0,
101
- minimum=0.0,
102
- maximum=1.0,
103
- step=0.001,
104
- label="Sigma",
105
- info="Sigma used for inference in WaveGlow."
106
- )
107
-
108
- max_decoder_steps_txt_box = gr.Number(
109
- 5000,
110
- minimum=1,
111
- step=500,
112
- label="Maximum decoder steps",
113
- info="Stop the synthesis after this number of decoder steps at the latest."
114
- )
115
-
116
- denoiser_txt_box = gr.Number(
117
- 0.005,
118
- minimum=0.0,
119
- maximum=1.0,
120
- step=0.001,
121
- label="Denoiser strength",
122
- info="Level of noise reduction used to remove the noise bias from WaveGlow."
123
- )
124
-
125
- synt_btn = gr.Button("Synthesize", variant="primary")
126
-
127
- with gr.Column():
128
- with gr.Group():
129
-
130
- with gr.Row():
131
- with gr.Column():
132
- out_audio = gr.Audio(
133
- type="numpy",
134
- label="Output",
135
- autoplay=True,
136
- )
137
-
138
- with gr.Accordion(
139
- "Log",
140
- open=False,
141
- ):
142
- out_md = gr.Textbox(
143
- interactive=False,
144
- show_copy_button=True,
145
- lines=15,
146
- max_lines=10000,
147
- placeholder="Log will be displayed here.",
148
- show_label=False,
149
- )
150
-
151
- dl_btn = gr.DownloadButton(
152
- "Download working directory",
153
- variant="secondary",
154
- )
155
-
156
- with gr.Row():
157
- gr.Examples(
158
- examples=[
159
- [
160
- "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow.",
161
- 5000, 1.0, 0.0005, 0, 0.4, 1.0, False, False
162
- ],
163
- [
164
- "Please call Stella. Ask her to bring these things with her from the store: six spoons of fresh snow peas, five thick slabs of blue cheese, and maybe a snack for her brother Bob.\n\nWe also need a small plastic snake and a big toy frog for the kids. She can scoop these things into three red bags, and we will go meet her Wednesday at the train station.",
165
- 5000, 1.0, 0.0005, 0, 0.4, 1.0, False, False
166
- ],
167
- # [
168
- # "The North Wind and the Sun were disputing which was the stronger, when a traveler came along wrapped in a warm cloak. They agreed that the one who first succeeded in making the traveler take his cloak off should be considered stronger than the other. Then the North Wind blew as hard as he could, but the more he blew the more closely did the traveler fold his cloak around him; and at last the North Wind gave up the attempt. Then the Sun shined out warmly, and immediately the traveler took off his cloak. And so the North Wind was obliged to confess that the Sun was the stronger of the two.",
169
- # ],
170
- # [
171
- # "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow. The rainbow is a division of white light into many beautiful colors. These take the shape of a long round arch, with its path high above, and its two ends apparently beyond the horizon. There is, according to legend, a boiling pot of gold at one end. People look, but no one ever finds it. When a man looks for something beyond his reach, his friends say he is looking for the pot of gold at the end of the rainbow. Throughout the centuries people have explained the rainbow in various ways. Some have accepted it as a miracle without physical explanation. To the Hebrews it was a token that there would be no more universal floods. The Greeks used to imagine that it was a sign from the gods to foretell war or heavy rain. The Norsemen considered the rainbow as a bridge over which the gods passed from earth to their home in the sky. Others have tried to explain the phenomenon physically. Aristotle thought that the rainbow was caused by reflection of the sun's rays by the rain. Since then physicists have found that it is not reflection, but refraction by the raindrops which causes the rainbows. Many complicated ideas about the rainbow have been formed. The difference in the rainbow depends considerably upon the size of the drops, and the width of the colored band increases as the size of the rops increases. The actual primary rainbow observed is said to be the effect of superimposition of a number of bows. If the red of the second bow falls upon the green of the first, the result is to give a bow with an abnormally wide yellow band, since red and green light when mixed form yellow. This is a very common type of bow, one showing mainly red and yellow, with little or no green or blue."
172
- # ]
173
- ],
174
- fn=fn,
175
- inputs=[
176
- input_txt_box,
177
- max_decoder_steps_txt_box,
178
- sigma_txt_box,
179
- denoiser_txt_box,
180
- seed_txt_box,
181
- sil_sent_txt_box,
182
- sil_para_txt_box,
183
- sent_norm_check_box,
184
- sent_sep_check_box,
185
- ],
186
- outputs=[
187
- out_audio,
188
- out_md,
189
- dl_btn,
190
- ],
191
- label="Examples",
192
- cache_examples=False,
193
- )
194
-
195
- with gr.Tab("Info"):
196
- with gr.Column():
197
- gr.Markdown(
198
- """
199
- ### General information
200
-
201
- - Speaker: Linda Johnson
202
- - Language: English
203
- - Accent: North American
204
- - Supported special characters: `.?!,:;-—"'()[]`
205
-
206
- ### Evaluation results
207
-
208
- |Metric|Value|
209
- |---|---|
210
- |MOS naturalness|3.55 ± 0.28 (GT: 4.17 ± 0.23)|
211
- |MOS intelligibility|4.44 ± 0.24 (GT: 4.63 ± 0.19)|
212
- |Mean MCD-DTW|29.15|
213
- |Mean penalty|0.1018|
214
-
215
- ### Components
216
-
217
- |Component|Name|URLs|
218
- |---|---|---|
219
- |Acoustic model|Tacotron|[Checkpoint](https://zenodo.org/records/10107104), [Code](https://github.com/stefantaubert/tacotron)|
220
- |Vocoder|WaveGlow|[Checkpoint](https://catalog.ngc.nvidia.com/orgs/nvidia/models/waveglow_ljs_256channels/files?version=3), [Code](https://github.com/stefantaubert/waveglow)
221
- |Dataset|LJ Speech|[Link](https://keithito.com/LJ-Speech-Dataset), [Transcriptions](https://zenodo.org/records/7499098)|
222
-
223
- ### Citation
224
-
225
- Taubert, S. (2024). en-tts (Version 0.0.1) [Computer software]. https://doi.org/10.5281/zenodo.10479347
226
-
227
- ### Acknowledgments
228
-
229
- Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) – Project-ID 416228727 – [CRC 1410](https://gepris.dfg.de/gepris/projekt/416228727?context=projekt&task=showDetail&id=416228727)
230
-
231
- The authors gratefully acknowledge the GWK support for funding this project by providing computing time through the Center for Information Services and HPC (ZIH) at TU Dresden.
232
-
233
- The authors are grateful to the Center for Information Services and High Performance Computing [Zentrum fur Informationsdienste und Hochleistungsrechnen (ZIH)] at TU Dresden for providing its facilities for high throughput calculations.
234
-
235
- ### App information
236
-
237
- - Version: 0.0.1
238
- - License: [MIT](https://github.com/stefantaubert/en-tts?tab=MIT-1-ov-file#readme)
239
- - GitHub: [stefantaubert/en-tts](https://github.com/stefantaubert/en-tts)
240
- """
241
- )
242
-
243
- synt_btn.click(
244
- fn=fn,
245
- inputs=[
246
- input_txt_box,
247
- max_decoder_steps_txt_box,
248
- sigma_txt_box,
249
- denoiser_txt_box,
250
- seed_txt_box,
251
- sil_sent_txt_box,
252
- sil_para_txt_box,
253
- sent_norm_check_box,
254
- sent_sep_check_box,
255
- ],
256
- outputs=[
257
- out_audio,
258
- out_md,
259
- dl_btn,
260
- ],
261
- )
262
-
263
- demo.launch(
264
- share=False,
265
- debug=True,
266
- inbrowser=True,
267
- quiet=False,
268
- show_api=False,
269
- )
270
-
271
-
272
- def synt(text: str, max_decoder_steps: int, sigma: float, denoiser_strength: float, seed: int, silence_sentences: float, silence_paragraphs: float, skip_normalization: bool, skip_sentence_separation: bool, cache: Dict) -> str:
273
- result_path = synthesize_english(
274
- text, cache,
275
- max_decoder_steps=max_decoder_steps,
276
- seed=seed,
277
- sigma=sigma,
278
- denoiser_strength=denoiser_strength,
279
- silence_paragraphs=silence_paragraphs,
280
- silence_sentences=silence_sentences,
281
- skip_normalization=skip_normalization,
282
- skip_sentence_separation=skip_sentence_separation,
283
- )
284
-
285
- rate, audio_int = read(result_path)
286
- logs = get_log_path().read_text("utf-8")
287
- zip_dl_path = create_zip_file_of_output()
288
- return (rate, audio_int), logs, zip_dl_path
289
-
290
-
291
- def create_zip_file_of_output() -> Path:
292
- work_dir = get_work_dir()
293
-
294
- name = f"en-tts-{datetime.now().strftime('%Y-%m-%dT%H-%M-%S')}"
295
-
296
- res = shutil.make_archive(Path(gettempdir()) / name, 'zip', root_dir=work_dir)
297
-
298
- resulting_zip = Path(res)
299
-
300
- with zipfile.ZipFile(resulting_zip, "a", compression=zipfile.ZIP_DEFLATED) as zipf:
301
- source_path = get_log_path()
302
- destination = 'output.log'
303
- zipf.write(source_path, destination)
304
-
305
- return resulting_zip
306
-
307
-
308
- if __name__ == "__main__":
309
- run()
 
1
+ from en_tts_gr import run
 
 
 
 
 
 
 
2
 
3
+ run()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
en_tts_app/app.py CHANGED
@@ -1,5 +1,4 @@
1
  import logging
2
- import sys
3
  from logging import getLogger
4
  from time import perf_counter
5
  from typing import Callable
@@ -7,7 +6,6 @@ from typing import Callable
7
  from en_tts_app.globals import get_conf_dir, get_log_path
8
  from en_tts_app.logging_configuration import (configure_app_logger, configure_file_logger,
9
  configure_root_logger, get_file_logger)
10
- from en_tts_app.main import load_models_to_cache
11
 
12
  INITIALIZED = False
13
 
 
1
  import logging
 
2
  from logging import getLogger
3
  from time import perf_counter
4
  from typing import Callable
 
6
  from en_tts_app.globals import get_conf_dir, get_log_path
7
  from en_tts_app.logging_configuration import (configure_app_logger, configure_file_logger,
8
  configure_root_logger, get_file_logger)
 
9
 
10
  INITIALIZED = False
11
 
en_tts_app/logging_configuration.py CHANGED
@@ -4,7 +4,6 @@ import platform
4
  import sys
5
  from importlib.metadata import version
6
  from logging import Formatter, Handler, Logger, StreamHandler, getLogger
7
- from logging.handlers import MemoryHandler
8
  from pathlib import Path
9
  from pkgutil import iter_modules
10
 
 
4
  import sys
5
  from importlib.metadata import version
6
  from logging import Formatter, Handler, Logger, StreamHandler, getLogger
 
7
  from pathlib import Path
8
  from pkgutil import iter_modules
9
 
en_tts_gr/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from en_tts_gr.app import build_interface, run
en_tts_gr/app.py ADDED
@@ -0,0 +1,310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import shutil
2
+ import sys
3
+ import zipfile
4
+ from datetime import datetime
5
+ from functools import partial
6
+ from pathlib import Path
7
+ from tempfile import gettempdir
8
+ from typing import Dict
9
+
10
+ import gradio as gr
11
+ from scipy.io.wavfile import read
12
+
13
+ from en_tts_app import (get_log_path, get_work_dir, initialize_app,
14
+ load_models_to_cache, run_main, synthesize_english)
15
+
16
+
17
+ def run():
18
+ exit_code = initialize_app()
19
+ if exit_code > 0:
20
+ sys.exit(exit_code)
21
+
22
+ interface = build_interface()
23
+ interface.queue()
24
+
25
+ launch_method = partial(
26
+ interface.launch,
27
+ share=False,
28
+ debug=True,
29
+ inbrowser=True,
30
+ quiet=False,
31
+ show_api=False,
32
+ )
33
+
34
+ exit_code = run_main(launch_method)
35
+ sys.exit(exit_code)
36
+
37
+
38
+ def build_interface():
39
+ cache = load_models_to_cache()
40
+
41
+ fn = partial(synt, cache=cache)
42
+
43
+ # iface = gr.Interface(
44
+ # fn=fn,
45
+ # inputs=[gr.Textbox(example_text, label="Text")],
46
+ # outputs=[gr.Audio(type="numpy", label="Speech", autoplay=True)],
47
+ # )
48
+
49
+ with gr.Blocks(
50
+ title="en-tts"
51
+ ) as web_app:
52
+ gr.Markdown(
53
+ """
54
+ # English Speech Synthesis
55
+
56
+ Enter or paste your text into the provided text box and click the **Synthesize** button to convert it into speech. You can adjust settings as desired before synthesizing.
57
+ """
58
+ )
59
+
60
+ with gr.Tab("Synthesis"):
61
+ with gr.Row():
62
+ with gr.Column():
63
+ with gr.Group():
64
+ input_txt_box = gr.Textbox(
65
+ None,
66
+ label="Input",
67
+ placeholder="Enter the text you want to synthesize (or load an example from below).",
68
+ lines=10,
69
+ max_lines=5000,
70
+ )
71
+
72
+ with gr.Accordion("Settings", open=False):
73
+ sent_norm_check_box = gr.Checkbox(
74
+ False,
75
+ label="Skip normalization",
76
+ info="Skip normalization of numbers, units and abbreviations."
77
+ )
78
+
79
+ sent_sep_check_box = gr.Checkbox(
80
+ False,
81
+ label="Skip sentence separation",
82
+ info="Skip sentence separation after these characters: .?!"
83
+ )
84
+
85
+ sil_sent_txt_box = gr.Number(
86
+ 0.4,
87
+ minimum=0.0,
88
+ maximum=60,
89
+ step=0.1,
90
+ label="Silence between sentences (s)",
91
+ info="Insert silence between each sentence."
92
+ )
93
+
94
+ sil_para_txt_box = gr.Number(
95
+ 1.0,
96
+ minimum=0.0,
97
+ maximum=60,
98
+ step=0.1,
99
+ label="Silence between paragraphs (s)",
100
+ info="Insert silence between each paragraph."
101
+ )
102
+
103
+ seed_txt_box = gr.Number(
104
+ 0,
105
+ minimum=0,
106
+ maximum=999999,
107
+ label="Seed",
108
+ info="Seed used for inference in order to be able to reproduce the results."
109
+ )
110
+
111
+ sigma_txt_box = gr.Number(
112
+ 1.0,
113
+ minimum=0.0,
114
+ maximum=1.0,
115
+ step=0.001,
116
+ label="Sigma",
117
+ info="Sigma used for inference in WaveGlow."
118
+ )
119
+
120
+ max_decoder_steps_txt_box = gr.Number(
121
+ 5000,
122
+ minimum=1,
123
+ step=500,
124
+ label="Maximum decoder steps",
125
+ info="Stop the synthesis after this number of decoder steps at the latest."
126
+ )
127
+
128
+ denoiser_txt_box = gr.Number(
129
+ 0.005,
130
+ minimum=0.0,
131
+ maximum=1.0,
132
+ step=0.001,
133
+ label="Denoiser strength",
134
+ info="Level of noise reduction used to remove the noise bias from WaveGlow."
135
+ )
136
+
137
+ synt_btn = gr.Button("Synthesize", variant="primary")
138
+
139
+ with gr.Column():
140
+ with gr.Group():
141
+
142
+ with gr.Row():
143
+ with gr.Column():
144
+ out_audio = gr.Audio(
145
+ type="numpy",
146
+ label="Output",
147
+ autoplay=True,
148
+ )
149
+
150
+ with gr.Accordion(
151
+ "Log",
152
+ open=False,
153
+ ):
154
+ out_md = gr.Textbox(
155
+ interactive=False,
156
+ show_copy_button=True,
157
+ lines=15,
158
+ max_lines=10000,
159
+ placeholder="Log will be displayed here.",
160
+ show_label=False,
161
+ )
162
+
163
+ dl_btn = gr.DownloadButton(
164
+ "Download working directory",
165
+ variant="secondary",
166
+ )
167
+
168
+ with gr.Row():
169
+ gr.Examples(
170
+ examples=[
171
+ [
172
+ "When the sunlight strikes raindrops in the air, they act as a prism and form a rainbow.",
173
+ 5000, 1.0, 0.0005, 0, 0.4, 1.0, False, False
174
+ ],
175
+ [
176
+ "Please call Stella. Ask her to bring these things with her from the store: six spoons of fresh snow peas, five thick slabs of blue cheese, and maybe a snack for her brother Bob.\n\nWe also need a small plastic snake and a big toy frog for the kids. She can scoop these things into three red bags, and we will go meet her Wednesday at the train station.",
177
+ 5000, 1.0, 0.0005, 0, 0.4, 1.0, False, False
178
+ ],
179
+ ],
180
+ fn=fn,
181
+ inputs=[
182
+ input_txt_box,
183
+ max_decoder_steps_txt_box,
184
+ sigma_txt_box,
185
+ denoiser_txt_box,
186
+ seed_txt_box,
187
+ sil_sent_txt_box,
188
+ sil_para_txt_box,
189
+ sent_norm_check_box,
190
+ sent_sep_check_box,
191
+ ],
192
+ outputs=[
193
+ out_audio,
194
+ out_md,
195
+ dl_btn,
196
+ ],
197
+ label="Examples",
198
+ cache_examples=True,
199
+ )
200
+
201
+ with gr.Tab("Info"):
202
+ with gr.Column():
203
+ gr.Markdown(
204
+ """
205
+ ### General information
206
+
207
+ - Speaker: Linda Johnson
208
+ - Language: English
209
+ - Accent: North American
210
+ - Supported special characters: `.?!,:;-—"'()[]`
211
+
212
+ ### Evaluation results
213
+
214
+ |Metric|Value|
215
+ |---|---|
216
+ |MOS naturalness|3.55 ± 0.28 (GT: 4.17 ± 0.23)|
217
+ |MOS intelligibility|4.44 ± 0.24 (GT: 4.63 ± 0.19)|
218
+ |Mean MCD-DTW|29.15|
219
+ |Mean penalty|0.1018|
220
+
221
+ ### Components
222
+
223
+ |Component|Name|URLs|
224
+ |---|---|---|
225
+ |Acoustic model|Tacotron|[Checkpoint](https://zenodo.org/records/10107104), [Code](https://github.com/stefantaubert/tacotron)|
226
+ |Vocoder|WaveGlow|[Checkpoint](https://catalog.ngc.nvidia.com/orgs/nvidia/models/waveglow_ljs_256channels/files?version=3), [Code](https://github.com/stefantaubert/waveglow)
227
+ |Dataset|LJ Speech|[Link](https://keithito.com/LJ-Speech-Dataset), [Transcriptions](https://zenodo.org/records/7499098)|
228
+
229
+ ### Citation
230
+
231
+ Taubert, S. (2024). en-tts (Version 0.0.1) [Computer software]. https://doi.org/10.5281/zenodo.10479347
232
+
233
+ ### Acknowledgments
234
+
235
+ Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) – Project-ID 416228727 – [CRC 1410](https://gepris.dfg.de/gepris/projekt/416228727?context=projekt&task=showDetail&id=416228727)
236
+
237
+ The authors gratefully acknowledge the GWK support for funding this project by providing computing time through the Center for Information Services and HPC (ZIH) at TU Dresden.
238
+
239
+ The authors are grateful to the Center for Information Services and High Performance Computing [Zentrum fur Informationsdienste und Hochleistungsrechnen (ZIH)] at TU Dresden for providing its facilities for high throughput calculations.
240
+
241
+ ### App information
242
+
243
+ - Version: 0.0.1
244
+ - License: [MIT](https://github.com/stefantaubert/en-tts?tab=MIT-1-ov-file#readme)
245
+ - GitHub: [stefantaubert/en-tts](https://github.com/stefantaubert/en-tts)
246
+ """
247
+ )
248
+
249
+ synt_btn.click(
250
+ fn=fn,
251
+ inputs=[
252
+ input_txt_box,
253
+ max_decoder_steps_txt_box,
254
+ sigma_txt_box,
255
+ denoiser_txt_box,
256
+ seed_txt_box,
257
+ sil_sent_txt_box,
258
+ sil_para_txt_box,
259
+ sent_norm_check_box,
260
+ sent_sep_check_box,
261
+ ],
262
+ outputs=[
263
+ out_audio,
264
+ out_md,
265
+ dl_btn,
266
+ ],
267
+ queue=True,
268
+ )
269
+
270
+ return web_app
271
+
272
+
273
+ def synt(text: str, max_decoder_steps: int, sigma: float, denoiser_strength: float, seed: int, silence_sentences: float, silence_paragraphs: float, skip_normalization: bool, skip_sentence_separation: bool, cache: Dict) -> str:
274
+ result_path = synthesize_english(
275
+ text, cache,
276
+ max_decoder_steps=max_decoder_steps,
277
+ seed=seed,
278
+ sigma=sigma,
279
+ denoiser_strength=denoiser_strength,
280
+ silence_paragraphs=silence_paragraphs,
281
+ silence_sentences=silence_sentences,
282
+ skip_normalization=skip_normalization,
283
+ skip_sentence_separation=skip_sentence_separation,
284
+ )
285
+
286
+ rate, audio_int = read(result_path)
287
+ logs = get_log_path().read_text("utf-8")
288
+ zip_dl_path = create_zip_file_of_output()
289
+ return (rate, audio_int), logs, zip_dl_path
290
+
291
+
292
+ def create_zip_file_of_output() -> Path:
293
+ work_dir = get_work_dir()
294
+
295
+ name = f"en-tts-{datetime.now().strftime('%Y-%m-%dT%H-%M-%S')}"
296
+
297
+ res = shutil.make_archive(Path(gettempdir()) / name, 'zip', root_dir=work_dir)
298
+
299
+ resulting_zip = Path(res)
300
+
301
+ with zipfile.ZipFile(resulting_zip, "a", compression=zipfile.ZIP_DEFLATED) as zipf:
302
+ source_path = get_log_path()
303
+ destination = 'output.log'
304
+ zipf.write(source_path, destination)
305
+
306
+ return resulting_zip
307
+
308
+
309
+ if __name__ == "__main__":
310
+ run()
en_tts_gr/py.typed ADDED
File without changes