Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -53,7 +53,7 @@ def _clean_text(text, cleaner_names):
|
|
53 |
|
54 |
def get_text(text, hps):
|
55 |
text_norm = text_to_sequence(text, hps.data.text_cleaners)
|
56 |
-
if hps.data.add_blank:
|
57 |
text_norm = commons.intersperse(text_norm, 0)
|
58 |
text_norm = torch.LongTensor(text_norm)
|
59 |
return text_norm
|
@@ -96,6 +96,21 @@ def create_tab(tab_name):
|
|
96 |
tts_output2 = gr.Audio(label="Output")
|
97 |
tts_submit.click(lambda text, speaker_id: tts(text, speaker_id, tab_name), [tts_input1, tts_input2], [tts_output1, tts_output2])
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
hps = utils.get_hparams_from_file("configs/vctk_base.json")
|
100 |
|
101 |
app = gr.Blocks()
|
@@ -104,24 +119,21 @@ with app:
|
|
104 |
"""
|
105 |
# First Text to Speech (TTS) for Walloon
|
106 |
Based on VITS (https://github.com/jaywalnut310/vits).
|
107 |
-
|
108 |
## How to use:
|
109 |
Write the text in graphemes. For faster inference, it is recommended to use short sentences.
|
110 |
|
111 |
The quality of the results varies between male and female voice due to the limited data for female voice on this language.
|
112 |
For better results with male voice, use the models fully trained on Walloon.
|
113 |
For better results with female voice, use the models trained on french and fine-tuned on Walloon.
|
114 |
-
|
115 |
To try the version trained in phonemes follow the link below:
|
116 |
-
|
117 |
https://huggingface.co/spaces/Pipe1213/VITS_Walloon_Phonemes
|
118 |
-
|
119 |
## Hint: Some sample texts are available at the bottom of the web site.
|
120 |
"""
|
121 |
)
|
122 |
with gr.Tabs():
|
123 |
create_tab("Graphemes")
|
124 |
create_tab("Graphemes_finetuned")
|
|
|
125 |
|
126 |
gr.Markdown(
|
127 |
"""
|
@@ -135,4 +147,4 @@ with app:
|
|
135 |
"""
|
136 |
)
|
137 |
|
138 |
-
app.launch()
|
|
|
53 |
|
54 |
def get_text(text, hps):
|
55 |
text_norm = text_to_sequence(text, hps.data.text_cleaners)
|
56 |
+
if (hps.data.add_blank):
|
57 |
text_norm = commons.intersperse(text_norm, 0)
|
58 |
text_norm = torch.LongTensor(text_norm)
|
59 |
return text_norm
|
|
|
96 |
tts_output2 = gr.Audio(label="Output")
|
97 |
tts_submit.click(lambda text, speaker_id: tts(text, speaker_id, tab_name), [tts_input1, tts_input2], [tts_output1, tts_output2])
|
98 |
|
99 |
+
def tts_comparison(text, speaker_id):
|
100 |
+
result1 = tts(text, speaker_id, "Graphemes")
|
101 |
+
result2 = tts(text, speaker_id, "Graphemes_finetuned")
|
102 |
+
return result1[1], result2[1]
|
103 |
+
|
104 |
+
def create_comparison_tab():
|
105 |
+
with gr.TabItem("Compare Models"):
|
106 |
+
gr.Markdown("### Compare TTS Models")
|
107 |
+
tts_input = gr.TextArea(label="Text in Walloon", value="")
|
108 |
+
tts_speaker = gr.Dropdown(label="Speaker", choices=["Male", "Female"], type="index", value="Male")
|
109 |
+
tts_submit = gr.Button("Generate", variant="primary")
|
110 |
+
tts_output1 = gr.Audio(label="Graphemes Output")
|
111 |
+
tts_output2 = gr.Audio(label="Graphemes Finetuned Output")
|
112 |
+
tts_submit.click(lambda text, speaker_id: tts_comparison(text, speaker_id), [tts_input, tts_speaker], [tts_output1, tts_output2])
|
113 |
+
|
114 |
hps = utils.get_hparams_from_file("configs/vctk_base.json")
|
115 |
|
116 |
app = gr.Blocks()
|
|
|
119 |
"""
|
120 |
# First Text to Speech (TTS) for Walloon
|
121 |
Based on VITS (https://github.com/jaywalnut310/vits).
|
|
|
122 |
## How to use:
|
123 |
Write the text in graphemes. For faster inference, it is recommended to use short sentences.
|
124 |
|
125 |
The quality of the results varies between male and female voice due to the limited data for female voice on this language.
|
126 |
For better results with male voice, use the models fully trained on Walloon.
|
127 |
For better results with female voice, use the models trained on french and fine-tuned on Walloon.
|
|
|
128 |
To try the version trained in phonemes follow the link below:
|
|
|
129 |
https://huggingface.co/spaces/Pipe1213/VITS_Walloon_Phonemes
|
|
|
130 |
## Hint: Some sample texts are available at the bottom of the web site.
|
131 |
"""
|
132 |
)
|
133 |
with gr.Tabs():
|
134 |
create_tab("Graphemes")
|
135 |
create_tab("Graphemes_finetuned")
|
136 |
+
create_comparison_tab()
|
137 |
|
138 |
gr.Markdown(
|
139 |
"""
|
|
|
147 |
"""
|
148 |
)
|
149 |
|
150 |
+
app.launch()
|