Commit
·
a8cbdb8
1
Parent(s):
254a63f
moddified app.py
Browse files
app.py
CHANGED
@@ -11,11 +11,11 @@ emotion_mapping = {"amused": 0, "anger": 1,
|
|
11 |
"disgust": 2, "neutral": 3, "sleepiness": 4}
|
12 |
|
13 |
|
14 |
-
def synthesize_speech(input_type, text, speaker_id, embed_type, emotion_id):
|
15 |
if input_type == "Choose from examples":
|
16 |
selected_text = text
|
17 |
else:
|
18 |
-
selected_text =
|
19 |
|
20 |
if embed_type == "bert_embed":
|
21 |
command = f"python3 synthesize.py --text '{selected_text}' --bert_embed 1 --speaker_id {speaker_id} --restore_step 900000 --mode single -p config/EmoV_DB/preprocess.yaml -m config/EmoV_DB/model.yaml -t config/EmoV_DB/train.yaml"
|
@@ -34,7 +34,7 @@ iface = gr.Interface(
|
|
34 |
["Choose from examples", "Enter your own text"], label="Input Type"),
|
35 |
gr.inputs.Dropdown(choices=predefined_texts, label="Select a text"),
|
36 |
gr.inputs.Textbox(lines=2, label="Enter your own text"),
|
37 |
-
gr.inputs.Slider(minimum=0, maximum=
|
38 |
default=0, label="Speaker ID"),
|
39 |
gr.inputs.Radio(["bert_embed", "emotion_id"], label="Embedding Type"),
|
40 |
gr.inputs.Dropdown(choices=emotion_mapping, label="Select Emotion"),
|
@@ -42,4 +42,4 @@ iface = gr.Interface(
|
|
42 |
outputs=gr.outputs.Audio(type="filepath"),
|
43 |
title="Text-to-Speech Demo",
|
44 |
)
|
45 |
-
iface.launch()
|
|
|
11 |
"disgust": 2, "neutral": 3, "sleepiness": 4}
|
12 |
|
13 |
|
14 |
+
def synthesize_speech(input_type, text, own_text, speaker_id, embed_type, emotion_id):
|
15 |
if input_type == "Choose from examples":
|
16 |
selected_text = text
|
17 |
else:
|
18 |
+
selected_text = own_text
|
19 |
|
20 |
if embed_type == "bert_embed":
|
21 |
command = f"python3 synthesize.py --text '{selected_text}' --bert_embed 1 --speaker_id {speaker_id} --restore_step 900000 --mode single -p config/EmoV_DB/preprocess.yaml -m config/EmoV_DB/model.yaml -t config/EmoV_DB/train.yaml"
|
|
|
34 |
["Choose from examples", "Enter your own text"], label="Input Type"),
|
35 |
gr.inputs.Dropdown(choices=predefined_texts, label="Select a text"),
|
36 |
gr.inputs.Textbox(lines=2, label="Enter your own text"),
|
37 |
+
gr.inputs.Slider(minimum=0, maximum=3, step=1,
|
38 |
default=0, label="Speaker ID"),
|
39 |
gr.inputs.Radio(["bert_embed", "emotion_id"], label="Embedding Type"),
|
40 |
gr.inputs.Dropdown(choices=emotion_mapping, label="Select Emotion"),
|
|
|
42 |
outputs=gr.outputs.Audio(type="filepath"),
|
43 |
title="Text-to-Speech Demo",
|
44 |
)
|
45 |
+
iface.launch(share=True)
|