Prgckwb
commited on
Commit
•
8d2a973
1
Parent(s):
59cd12a
init
Browse files
app.py
CHANGED
@@ -8,21 +8,29 @@ nltk.download('averaged_perceptron_tagger_eng')
|
|
8 |
|
9 |
# Get device
|
10 |
device = 'auto'
|
11 |
-
model = TTS(language='
|
12 |
speaker_ids = model.hps.data.spk2id
|
13 |
|
14 |
|
15 |
-
def inference(text: str):
|
16 |
output_path = 'en-us.wav'
|
17 |
-
model.tts_to_file(text, speaker_ids['EN-US'], output_path, speed=
|
18 |
return output_path
|
19 |
|
20 |
|
21 |
if __name__ == "__main__":
|
22 |
demo = gr.Interface(
|
|
|
|
|
23 |
fn=inference,
|
24 |
inputs=[
|
25 |
-
gr.Textbox(),
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
],
|
27 |
outputs=[
|
28 |
gr.Audio()
|
|
|
8 |
|
9 |
# Get device
|
10 |
device = 'auto'
|
11 |
+
model = TTS(language='EN_NEWEST', device=device)
|
12 |
speaker_ids = model.hps.data.spk2id
|
13 |
|
14 |
|
15 |
+
def inference(text: str, speed: float):
|
16 |
output_path = 'en-us.wav'
|
17 |
+
model.tts_to_file(text, speaker_ids['EN-US'], output_path, speed=speed)
|
18 |
return output_path
|
19 |
|
20 |
|
21 |
if __name__ == "__main__":
|
22 |
demo = gr.Interface(
|
23 |
+
title='Text-to-Speech',
|
24 |
+
description='Convert English text to speech',
|
25 |
fn=inference,
|
26 |
inputs=[
|
27 |
+
gr.Textbox(label='Text to Synthesize'),
|
28 |
+
gr.Slider(minimum=0.5, maximum=3.0, value=1.0, label='Speed'),
|
29 |
+
gr.Dropdown(
|
30 |
+
label='Speaker',
|
31 |
+
choices=['EN', 'EN-US', 'EN-BR', 'EN_INDIA', 'EN-AU', 'EN-Default'],
|
32 |
+
default='EN-US'
|
33 |
+
)
|
34 |
],
|
35 |
outputs=[
|
36 |
gr.Audio()
|