Pipe1213 commited on
Commit
a5eeb17
1 Parent(s): 0ebf05c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -2
app.py CHANGED
@@ -18,7 +18,6 @@ from text.symbols_pho import symbols_pho
18
  from scipy.io.wavfile import write
19
  from text import cleaners
20
 
21
-
22
  model_configs = {
23
  "Phonemes_finetuned": {
24
  "path": "fr_wa_finetuned_pho/G_125000.pth",
@@ -97,6 +96,21 @@ def create_tab(tab_name):
97
  tts_output2 = gr.Audio(label="Output")
98
  tts_submit.click(lambda text, speaker_id: tts(text, speaker_id, tab_name), [tts_input1, tts_input2], [tts_output1, tts_output2])
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  hps = utils.get_hparams_from_file("configs/vctk_base.json")
101
 
102
  app = gr.Blocks()
@@ -122,6 +136,7 @@ with app:
122
  with gr.Tabs():
123
  create_tab("Phonemes_finetuned")
124
  create_tab("Phonemes")
 
125
 
126
  gr.Markdown(
127
  """
@@ -134,4 +149,4 @@ with app:
134
  """
135
  )
136
 
137
- app.launch()
 
18
  from scipy.io.wavfile import write
19
  from text import cleaners
20
 
 
21
  model_configs = {
22
  "Phonemes_finetuned": {
23
  "path": "fr_wa_finetuned_pho/G_125000.pth",
 
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, "Phonemes_finetuned")
101
+ result2 = tts(text, speaker_id, "Phonemes")
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 on IPA phonemes", 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="Phonemes Finetuned Output")
111
+ tts_output2 = gr.Audio(label="Phonemes 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()
 
136
  with gr.Tabs():
137
  create_tab("Phonemes_finetuned")
138
  create_tab("Phonemes")
139
+ create_comparison_tab()
140
 
141
  gr.Markdown(
142
  """
 
149
  """
150
  )
151
 
152
+ app.launch()