Kit-Lemonfoot commited on
Commit
c2a37ae
·
verified ·
1 Parent(s): bda1ea1

Prepared some files for an upcoming update.

Browse files
app.py CHANGED
@@ -150,7 +150,9 @@ def tts_fn(
150
 
151
  def load_voicedata():
152
  print("Loading voice data...")
153
- voices = []
 
 
154
  styledict = {}
155
  with open("voicelist.json", "r", encoding="utf-8") as f:
156
  voc_info = json.load(f)
@@ -168,8 +170,11 @@ def load_voicedata():
168
  s2id = hps.data.style2id
169
  styledict[model_path] = s2id.keys()
170
  print(f"Indexed voice {voice_name}")
171
- voices.append((name, model_path, voice_name, speakerid, datasetauthor, image))
172
- return voices, styledict
 
 
 
173
 
174
 
175
  initial_text = "Hello there! This is test audio of a new Hololive text to speech tool."
@@ -224,6 +229,7 @@ if __name__ == "__main__":
224
  model_holder = ModelHolder(model_dir, device)
225
 
226
  languages = ["EN", "JP", "ZH"]
 
227
 
228
  model_names = model_holder.model_names
229
  if len(model_names) == 0:
@@ -287,63 +293,66 @@ if __name__ == "__main__":
287
  )
288
  use_tone = gr.Checkbox(label="Use accent adjustment", value=False, visible=False)
289
 
290
- for (name, model_path, voice_name, speakerid, datasetauthor, image) in voicedata:
291
- with gr.TabItem(name):
292
- mn = gr.Textbox(value=model_path, visible=False, interactive=False)
293
- mp = gr.Textbox(value=f"model_assets/{model_path}/{model_path}.safetensors", visible=False, interactive=False)
294
- spk = gr.Textbox(value=speakerid, visible=False, interactive=False)
295
- with gr.Row():
296
- with gr.Column():
297
- gr.Markdown(f"**{voice_name}**\n\nModel name: {model_path} | Dataset author: {datasetauthor}")
298
- gr.Image(f"images/{image}", label=None, show_label=False, width=300, show_download_button=False, container=False, show_share_button=False)
299
- with gr.Column():
300
- with gr.TabItem("Style using a preset"):
301
- style = gr.Dropdown(
302
- label="Current style (Neutral is an average style)",
303
- choices=styledict[model_path],
304
- value="Neutral",
305
- )
306
- with gr.TabItem("Style using existing audio"):
307
- ref_audio_path = gr.Audio(label="Reference Audio", type="filepath")
308
- style_weight = gr.Slider(
309
- minimum=0,
310
- maximum=50,
311
- value=5,
312
- step=0.1,
313
- label="Style strength",
314
- )
315
- with gr.Column():
316
- tts_button = gr.Button(
317
- "Synthesize", variant="primary", interactive=True
318
- )
319
- text_output = gr.Textbox(label="Info")
320
- audio_output = gr.Audio(label="Result")
321
-
322
- tts_button.click(
323
- tts_fn,
324
- inputs=[
325
- mn,
326
- mp,
327
- text_input,
328
- language,
329
- ref_audio_path,
330
- sdp_ratio,
331
- noise_scale,
332
- noise_scale_w,
333
- length_scale,
334
- line_split,
335
- split_interval,
336
- style_text,
337
- style_text_weight,
338
- use_style_text,
339
- style,
340
- style_weight,
341
- tone,
342
- use_tone,
343
- spk,
344
- ],
345
- outputs=[text_output, audio_output, tone],
346
- )
 
 
 
347
 
348
  with gr.Row():
349
  with gr.Column():
 
150
 
151
  def load_voicedata():
152
  print("Loading voice data...")
153
+ #voices = []
154
+ envoices = []
155
+ jpvoices = []
156
  styledict = {}
157
  with open("voicelist.json", "r", encoding="utf-8") as f:
158
  voc_info = json.load(f)
 
170
  s2id = hps.data.style2id
171
  styledict[model_path] = s2id.keys()
172
  print(f"Indexed voice {voice_name}")
173
+ if(info['primarylang']=="JP"):
174
+ jpvoices.append((name, model_path, voice_name, speakerid, datasetauthor, image))
175
+ else:
176
+ envoices.append((name, model_path, voice_name, speakerid, datasetauthor, image))
177
+ return [envoices, jpvoices], styledict
178
 
179
 
180
  initial_text = "Hello there! This is test audio of a new Hololive text to speech tool."
 
229
  model_holder = ModelHolder(model_dir, device)
230
 
231
  languages = ["EN", "JP", "ZH"]
232
+ langnames = ["English", "Japanese"]
233
 
234
  model_names = model_holder.model_names
235
  if len(model_names) == 0:
 
293
  )
294
  use_tone = gr.Checkbox(label="Use accent adjustment", value=False, visible=False)
295
 
296
+ #for (name, model_path, voice_name, speakerid, datasetauthor, image) in voicedata:
297
+ for vi in range(len(voicedata)):
298
+ with gr.TabItem(langnames[vi]):
299
+ for (name, model_path, voice_name, speakerid, datasetauthor, image) in voicedata[vi]:
300
+ with gr.TabItem(name):
301
+ mn = gr.Textbox(value=model_path, visible=False, interactive=False)
302
+ mp = gr.Textbox(value=f"model_assets/{model_path}/{model_path}.safetensors", visible=False, interactive=False)
303
+ spk = gr.Textbox(value=speakerid, visible=False, interactive=False)
304
+ with gr.Row():
305
+ with gr.Column():
306
+ gr.Markdown(f"**{voice_name}**\n\nModel name: {model_path} | Dataset author: {datasetauthor}")
307
+ gr.Image(f"images/{image}", label=None, show_label=False, width=300, show_download_button=False, container=False, show_share_button=False)
308
+ with gr.Column():
309
+ with gr.TabItem("Style using a preset"):
310
+ style = gr.Dropdown(
311
+ label="Current style (Neutral is an average style)",
312
+ choices=styledict[model_path],
313
+ value="Neutral",
314
+ )
315
+ with gr.TabItem("Style using existing audio"):
316
+ ref_audio_path = gr.Audio(label="Reference Audio", type="filepath")
317
+ style_weight = gr.Slider(
318
+ minimum=0,
319
+ maximum=50,
320
+ value=5,
321
+ step=0.1,
322
+ label="Style strength",
323
+ )
324
+ with gr.Column():
325
+ tts_button = gr.Button(
326
+ "Synthesize", variant="primary", interactive=True
327
+ )
328
+ text_output = gr.Textbox(label="Info")
329
+ audio_output = gr.Audio(label="Result")
330
+
331
+ tts_button.click(
332
+ tts_fn,
333
+ inputs=[
334
+ mn,
335
+ mp,
336
+ text_input,
337
+ language,
338
+ ref_audio_path,
339
+ sdp_ratio,
340
+ noise_scale,
341
+ noise_scale_w,
342
+ length_scale,
343
+ line_split,
344
+ split_interval,
345
+ style_text,
346
+ style_text_weight,
347
+ use_style_text,
348
+ style,
349
+ style_weight,
350
+ tone,
351
+ use_tone,
352
+ spk,
353
+ ],
354
+ outputs=[text_output, audio_output, tone],
355
+ )
356
 
357
  with gr.Row():
358
  with gr.Column():
images/aqua.png ADDED
images/ayame.png ADDED
images/chloe.png ADDED
images/koyori.png ADDED
images/lamy.png ADDED
images/sora.png ADDED
images/suisei.png ADDED
images/towa.png ADDED
voicelist.json CHANGED
@@ -5,6 +5,7 @@
5
  "title": "Mori Calliope",
6
  "speakerid": "MoriCalliope",
7
  "datasetauthor": "Kit Lemonfoot",
 
8
  "cover": "calli.png"
9
  },
10
  "Kiara": {
@@ -13,6 +14,7 @@
13
  "title": "Takanashi Kiara",
14
  "speakerid": "TakanashiKiara",
15
  "datasetauthor": "Kit Lemonfoot",
 
16
  "cover": "kiara.png"
17
  },
18
  "Ina": {
@@ -21,6 +23,7 @@
21
  "title": "Ninomae Ina'nis",
22
  "speakerid": "NinomaeInanis",
23
  "datasetauthor": "Kit Lemonfoot",
 
24
  "cover": "ina.png"
25
  },
26
  "Gura": {
@@ -29,6 +32,7 @@
29
  "title": "Gawr Gura",
30
  "speakerid": "GawrGura",
31
  "datasetauthor": "Kit Lemonfoot",
 
32
  "cover": "gura.png"
33
  },
34
  "Amelia": {
@@ -37,6 +41,7 @@
37
  "title": "Amelia Watson",
38
  "speakerid": "AmeliaWatson",
39
  "datasetauthor": "Kit Lemonfoot",
 
40
  "cover": "ame.png"
41
  },
42
  "IRyS": {
@@ -45,6 +50,7 @@
45
  "title": "IRyS",
46
  "speakerid": "IRyS",
47
  "datasetauthor": "Kit Lemonfoot",
 
48
  "cover": "irys.png"
49
  },
50
  "Sana": {
@@ -53,6 +59,7 @@
53
  "title": "Tsukumo Sana",
54
  "speakerid": "TsukumoSana",
55
  "datasetauthor": "Kit Lemonfoot",
 
56
  "cover": "sana.png"
57
  },
58
  "Fauna": {
@@ -61,6 +68,7 @@
61
  "title": "Ceres Fauna",
62
  "speakerid": "CeresFauna",
63
  "datasetauthor": "Kit Lemonfoot",
 
64
  "cover": "fauna.png"
65
  },
66
  "Kronii": {
@@ -69,6 +77,7 @@
69
  "title": "Ouro Kronii",
70
  "speakerid": "OuroKronii",
71
  "datasetauthor": "Kit Lemonfoot",
 
72
  "cover": "kronii.png"
73
  },
74
  "Mumei": {
@@ -77,6 +86,7 @@
77
  "title": "Nanashi Mumei",
78
  "speakerid": "NanashiMumei",
79
  "datasetauthor": "Kit Lemonfoot",
 
80
  "cover": "mumei.png"
81
  },
82
  "Baelz": {
@@ -85,6 +95,7 @@
85
  "title": "Hakos Baelz",
86
  "speakerid": "HakosBaelz",
87
  "datasetauthor": "Kit Lemonfoot",
 
88
  "cover": "bae.png"
89
  },
90
  "Shiori": {
@@ -93,6 +104,7 @@
93
  "title": "Shiori Novella",
94
  "speakerid": "ShioriNovella",
95
  "datasetauthor": "Kit Lemonfoot",
 
96
  "cover": "shiori.png"
97
  },
98
  "Bijou": {
@@ -101,6 +113,7 @@
101
  "title": "Koseki Bijou",
102
  "speakerid": "KosekiBijou",
103
  "datasetauthor": "Kit Lemonfoot",
 
104
  "cover": "bijou.png"
105
  },
106
  "Nerissa": {
@@ -109,6 +122,7 @@
109
  "title": "Nerissa Ravencroft",
110
  "speakerid": "NerissaRavencroft",
111
  "datasetauthor": "Kit Lemonfoot",
 
112
  "cover": "nerissa.png"
113
  },
114
  "Iofi": {
@@ -117,6 +131,7 @@
117
  "title": "Airani Iofifteen",
118
  "speakerid": "AiraniIofifteen",
119
  "datasetauthor": "Kit Lemonfoot",
 
120
  "cover": "iofi.png"
121
  },
122
  "Ollie": {
@@ -125,6 +140,7 @@
125
  "title": "Kureiji Ollie",
126
  "speakerid": "KureijiOllie",
127
  "datasetauthor": "Kit Lemonfoot",
 
128
  "cover": "ollie.png"
129
  },
130
  "Anya": {
@@ -133,6 +149,7 @@
133
  "title": "Anya Melfissa",
134
  "speakerid": "AnyaMelfissa",
135
  "datasetauthor": "Kit Lemonfoot",
 
136
  "cover": "anya.png"
137
  },
138
  "Zeta": {
@@ -141,14 +158,61 @@
141
  "title": "Vestia Zeta",
142
  "speakerid": "VestiaZeta",
143
  "datasetauthor": "Kit Lemonfoot",
 
144
  "cover": "zeta.png"
145
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  "Okayu": {
147
  "enable": true,
148
  "model_path": "SBV2_HoloJPTest",
149
  "title": "Nekomata Okayu",
150
  "speakerid": "NekomataOkayu",
151
  "datasetauthor": "dacoolkid44",
 
152
  "cover": "okayu.png"
153
  },
154
  "Flare": {
@@ -157,6 +221,7 @@
157
  "title": "Shiranui Flare",
158
  "speakerid": "ShiranuiFlare",
159
  "datasetauthor": "Kit Lemonfoot",
 
160
  "cover": "flare.png"
161
  },
162
  "Noel": {
@@ -165,6 +230,7 @@
165
  "title": "Shirogane Noel",
166
  "speakerid": "ShiroganeNoel",
167
  "datasetauthor": "Kit Lemonfoot",
 
168
  "cover": "noel.png"
169
  },
170
  "Marine": {
@@ -173,22 +239,52 @@
173
  "title": "Houshou Marine",
174
  "speakerid": "HoushouMarine",
175
  "datasetauthor": "dacoolkid44",
 
176
  "cover": "marine.png"
177
  },
 
 
 
 
 
 
 
 
 
178
  "Laplus": {
179
  "enable": true,
180
  "model_path": "SBV2_HoloJPTest",
181
  "title": "La+ Darknesss",
182
  "speakerid": "LaplusDarknesss",
183
  "datasetauthor": "dacoolkid44",
 
184
  "cover": "laplus.png"
185
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  "Ririka": {
187
  "enable": true,
188
  "model_path": "SBV2_HoloJPTest",
189
  "title": "Ichijou Ririka",
190
  "speakerid": "IchijouRirika",
191
  "datasetauthor": "Kit Lemonfoot",
 
192
  "cover": "ririka.png"
193
  }
194
  }
 
5
  "title": "Mori Calliope",
6
  "speakerid": "MoriCalliope",
7
  "datasetauthor": "Kit Lemonfoot",
8
+ "primarylang": "EN",
9
  "cover": "calli.png"
10
  },
11
  "Kiara": {
 
14
  "title": "Takanashi Kiara",
15
  "speakerid": "TakanashiKiara",
16
  "datasetauthor": "Kit Lemonfoot",
17
+ "primarylang": "EN",
18
  "cover": "kiara.png"
19
  },
20
  "Ina": {
 
23
  "title": "Ninomae Ina'nis",
24
  "speakerid": "NinomaeInanis",
25
  "datasetauthor": "Kit Lemonfoot",
26
+ "primarylang": "EN",
27
  "cover": "ina.png"
28
  },
29
  "Gura": {
 
32
  "title": "Gawr Gura",
33
  "speakerid": "GawrGura",
34
  "datasetauthor": "Kit Lemonfoot",
35
+ "primarylang": "EN",
36
  "cover": "gura.png"
37
  },
38
  "Amelia": {
 
41
  "title": "Amelia Watson",
42
  "speakerid": "AmeliaWatson",
43
  "datasetauthor": "Kit Lemonfoot",
44
+ "primarylang": "EN",
45
  "cover": "ame.png"
46
  },
47
  "IRyS": {
 
50
  "title": "IRyS",
51
  "speakerid": "IRyS",
52
  "datasetauthor": "Kit Lemonfoot",
53
+ "primarylang": "EN",
54
  "cover": "irys.png"
55
  },
56
  "Sana": {
 
59
  "title": "Tsukumo Sana",
60
  "speakerid": "TsukumoSana",
61
  "datasetauthor": "Kit Lemonfoot",
62
+ "primarylang": "EN",
63
  "cover": "sana.png"
64
  },
65
  "Fauna": {
 
68
  "title": "Ceres Fauna",
69
  "speakerid": "CeresFauna",
70
  "datasetauthor": "Kit Lemonfoot",
71
+ "primarylang": "EN",
72
  "cover": "fauna.png"
73
  },
74
  "Kronii": {
 
77
  "title": "Ouro Kronii",
78
  "speakerid": "OuroKronii",
79
  "datasetauthor": "Kit Lemonfoot",
80
+ "primarylang": "EN",
81
  "cover": "kronii.png"
82
  },
83
  "Mumei": {
 
86
  "title": "Nanashi Mumei",
87
  "speakerid": "NanashiMumei",
88
  "datasetauthor": "Kit Lemonfoot",
89
+ "primarylang": "EN",
90
  "cover": "mumei.png"
91
  },
92
  "Baelz": {
 
95
  "title": "Hakos Baelz",
96
  "speakerid": "HakosBaelz",
97
  "datasetauthor": "Kit Lemonfoot",
98
+ "primarylang": "EN",
99
  "cover": "bae.png"
100
  },
101
  "Shiori": {
 
104
  "title": "Shiori Novella",
105
  "speakerid": "ShioriNovella",
106
  "datasetauthor": "Kit Lemonfoot",
107
+ "primarylang": "EN",
108
  "cover": "shiori.png"
109
  },
110
  "Bijou": {
 
113
  "title": "Koseki Bijou",
114
  "speakerid": "KosekiBijou",
115
  "datasetauthor": "Kit Lemonfoot",
116
+ "primarylang": "EN",
117
  "cover": "bijou.png"
118
  },
119
  "Nerissa": {
 
122
  "title": "Nerissa Ravencroft",
123
  "speakerid": "NerissaRavencroft",
124
  "datasetauthor": "Kit Lemonfoot",
125
+ "primarylang": "EN",
126
  "cover": "nerissa.png"
127
  },
128
  "Iofi": {
 
131
  "title": "Airani Iofifteen",
132
  "speakerid": "AiraniIofifteen",
133
  "datasetauthor": "Kit Lemonfoot",
134
+ "primarylang": "EN",
135
  "cover": "iofi.png"
136
  },
137
  "Ollie": {
 
140
  "title": "Kureiji Ollie",
141
  "speakerid": "KureijiOllie",
142
  "datasetauthor": "Kit Lemonfoot",
143
+ "primarylang": "EN",
144
  "cover": "ollie.png"
145
  },
146
  "Anya": {
 
149
  "title": "Anya Melfissa",
150
  "speakerid": "AnyaMelfissa",
151
  "datasetauthor": "Kit Lemonfoot",
152
+ "primarylang": "EN",
153
  "cover": "anya.png"
154
  },
155
  "Zeta": {
 
158
  "title": "Vestia Zeta",
159
  "speakerid": "VestiaZeta",
160
  "datasetauthor": "Kit Lemonfoot",
161
+ "primarylang": "EN",
162
  "cover": "zeta.png"
163
  },
164
+ "Sora": {
165
+ "enable": false,
166
+ "model_path": "SBV2_HoloJPTest2",
167
+ "title": "Tokino Sora",
168
+ "speakerid": "TokinoSora",
169
+ "datasetauthor": "Kit Lemonfoot",
170
+ "primarylang": "JP",
171
+ "cover": "sora.png"
172
+ },
173
+ "Suisei": {
174
+ "enable": false,
175
+ "model_path": "SBV2_HoloJPTest2",
176
+ "title": "Hoshimachi Suisei",
177
+ "speakerid": "HoshimachiSuisei",
178
+ "datasetauthor": "Kit Lemonfoot",
179
+ "primarylang": "JP",
180
+ "cover": "suisei.png"
181
+ },
182
+ "Matsuri": {
183
+ "enable": false,
184
+ "model_path": "SBV2_HoloJPTest2",
185
+ "title": "Natsuiro Matsuri",
186
+ "speakerid": "NatsuiroMatsuri",
187
+ "datasetauthor": "Kit Lemonfoot",
188
+ "primarylang": "JP",
189
+ "cover": "matsuri.png"
190
+ },
191
+ "Aqua": {
192
+ "enable": false,
193
+ "model_path": "SBV2_HoloJPTest2",
194
+ "title": "Minato Aqua",
195
+ "speakerid": "MinatoAqua",
196
+ "datasetauthor": "Kit Lemonfoot",
197
+ "primarylang": "JP",
198
+ "cover": "aqua.png"
199
+ },
200
+ "Ayame": {
201
+ "enable": false,
202
+ "model_path": "SBV2_HoloJPTest2",
203
+ "title": "Nakiri Ayame",
204
+ "speakerid": "NakiriAyame",
205
+ "datasetauthor": "Kit Lemonfoot",
206
+ "primarylang": "JP",
207
+ "cover": "ayame.png"
208
+ },
209
  "Okayu": {
210
  "enable": true,
211
  "model_path": "SBV2_HoloJPTest",
212
  "title": "Nekomata Okayu",
213
  "speakerid": "NekomataOkayu",
214
  "datasetauthor": "dacoolkid44",
215
+ "primarylang": "JP",
216
  "cover": "okayu.png"
217
  },
218
  "Flare": {
 
221
  "title": "Shiranui Flare",
222
  "speakerid": "ShiranuiFlare",
223
  "datasetauthor": "Kit Lemonfoot",
224
+ "primarylang": "JP",
225
  "cover": "flare.png"
226
  },
227
  "Noel": {
 
230
  "title": "Shirogane Noel",
231
  "speakerid": "ShiroganeNoel",
232
  "datasetauthor": "Kit Lemonfoot",
233
+ "primarylang": "JP",
234
  "cover": "noel.png"
235
  },
236
  "Marine": {
 
239
  "title": "Houshou Marine",
240
  "speakerid": "HoushouMarine",
241
  "datasetauthor": "dacoolkid44",
242
+ "primarylang": "JP",
243
  "cover": "marine.png"
244
  },
245
+ "Lamy": {
246
+ "enable": false,
247
+ "model_path": "SBV2_HoloJPTest2",
248
+ "title": "Yukihana Lamy",
249
+ "speakerid": "YukihanaLamy",
250
+ "datasetauthor": "Kit Lemonfoot",
251
+ "primarylang": "JP",
252
+ "cover": "lamy.png"
253
+ },
254
  "Laplus": {
255
  "enable": true,
256
  "model_path": "SBV2_HoloJPTest",
257
  "title": "La+ Darknesss",
258
  "speakerid": "LaplusDarknesss",
259
  "datasetauthor": "dacoolkid44",
260
+ "primarylang": "JP",
261
  "cover": "laplus.png"
262
  },
263
+ "Koyori": {
264
+ "enable": false,
265
+ "model_path": "SBV2_HoloJPTest2",
266
+ "title": "Hakui Koyori",
267
+ "speakerid": "HakuiKoyori",
268
+ "datasetauthor": "Kit Lemonfoot",
269
+ "primarylang": "JP",
270
+ "cover": "koyori.png"
271
+ },
272
+ "Chloe": {
273
+ "enable": false,
274
+ "model_path": "SBV2_HoloJPTest2",
275
+ "title": "Sakamata Chloe",
276
+ "speakerid": "SakamataChloe",
277
+ "datasetauthor": "Kit Lemonfoot",
278
+ "primarylang": "JP",
279
+ "cover": "chloe.png"
280
+ },
281
  "Ririka": {
282
  "enable": true,
283
  "model_path": "SBV2_HoloJPTest",
284
  "title": "Ichijou Ririka",
285
  "speakerid": "IchijouRirika",
286
  "datasetauthor": "Kit Lemonfoot",
287
+ "primarylang": "JP",
288
  "cover": "ririka.png"
289
  }
290
  }