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r_process
|
4 |
+
os.makedirs("dataset",exist_ok=True)
|
5 |
+
os.makedirs("audios",exist_ok=True)
|
6 |
+
model_library = CachedModels()
|
7 |
+
|
8 |
+
with gr.Blocks(title="🔊",theme=gr.themes.Base()) as app:
|
9 |
+
|
10 |
+
with gr.Tabs():
|
11 |
+
with gr.TabItem("Inference"):
|
12 |
+
with gr.Row():
|
13 |
+
voice_model = gr.Dropdown(label="Model Voice", choices=sorted(names), value=lambda:sorted(names)[0] if len(sorted(names)) > 0 else '', interactive=True)
|
14 |
+
refresh_button = gr.Button("Refresh", variant="primary")
|
15 |
+
spk_item = gr.Slider(
|
16 |
+
minimum=0,
|
17 |
+
maximum=2333,
|
18 |
+
step=1,
|
19 |
+
label="Speaker ID",
|
20 |
+
value=0,
|
21 |
+
visible=False,
|
22 |
+
interactive=True,
|
23 |
+
)
|
24 |
+
vc_transform0 = gr.Number(
|
25 |
+
label="Pitch",
|
26 |
+
value=0
|
27 |
+
)
|
28 |
+
but0 = gr.Button(value="Convert", variant="primary")
|
29 |
+
with gr.Row():
|
30 |
+
with gr.Column():
|
31 |
+
with gr.Tabs():
|
32 |
+
with gr.TabItem("Upload"):
|
33 |
+
dropbox = gr.File(label="Drop your audio here & hit the Reload button.")
|
34 |
+
with gr.TabItem("Record", visible=False):
|
35 |
+
record_button=gr.Microphone(label="OR Record audio.", type="filepath")
|
36 |
+
with gr.TabItem("TTS (experimental)", visible=False if whisperspeak_on is None else True):
|
37 |
+
with gr.Row():
|
38 |
+
tts_text = gr.Textbox(label="Text to Speech", placeholder="Enter text to convert to speech")
|
39 |
+
with gr.Row():
|
40 |
+
tts_lang = gr.Radio(choices=["en","es","it","pt"],label="",value="en")
|
41 |
+
with gr.Row():
|
42 |
+
tts_button = gr.Button(value="Speak", variant="primary")
|
43 |
+
with gr.Row():
|
44 |
+
paths_for_files = lambda path:[os.path.abspath(os.path.join(path, f)) for f in os.listdir(path) if os.path.splitext(f)[1].lower() in ('.mp3', '.wav', '.flac', '.ogg')]
|
45 |
+
input_audio0 = gr.Dropdown(
|
46 |
+
label="Input Path",
|
47 |
+
value=paths_for_files('audios')[0] if len(paths_for_files('audios')) > 0 else '',
|
48 |
+
choices=paths_for_files('audios'), # Only show absolute paths for audio files ending in .mp3, .wav, .flac or .ogg
|
49 |
+
allow_custom_value=True
|
50 |
+
)
|
51 |
+
with gr.Row():
|
52 |
+
input_player = gr.Audio(label="Input",type="numpy")
|
53 |
+
input_audio0.change(
|
54 |
+
inputs=[input_audio0],
|
55 |
+
outputs=[input_player],
|
56 |
+
fn=lambda path: {"value":path,"__type__":"update"} if os.path.exists(path) else None
|
57 |
+
)
|
58 |
+
record_button.stop_recording(
|
59 |
+
fn=lambda audio:audio, #TODO save wav lambda
|
60 |
+
inputs=[record_button],
|
61 |
+
outputs=[input_audio0])
|
62 |
+
dropbox.upload(
|
63 |
+
fn=lambda audio:audio.name,
|
64 |
+
inputs=[dropbox],
|
65 |
+
outputs=[input_audio0])
|
66 |
+
tts_button.click(
|
67 |
+
fn=whisperspeak,
|
68 |
+
inputs=[tts_text,tts_lang],
|
69 |
+
outputs=[input_audio0],
|
70 |
+
show_progress=True)
|
71 |
+
tts_button.click(
|
72 |
+
fn=lambda: {"choices":paths_for_files('audios'),"__type__":"update"},
|
73 |
+
inputs=[],
|
74 |
+
outputs=[input_audio0])
|
75 |
+
with gr.Column():
|
76 |
+
with gr.Accordion("Change Index", open=False):
|
77 |
+
file_index2 = gr.Dropdown(
|
78 |
+
label="Change Index",
|
79 |
+
choices=sorted(index_paths),
|
80 |
+
interactive=True,
|
81 |
+
value=sorted(index_paths)[0] if len(sorted(index_paths)) > 0 else ''
|
82 |
+
)
|
83 |
+
index_rate1 = gr.Slider(
|
84 |
+
minimum=0,
|
85 |
+
maximum=1,
|
86 |
+
label="Index Strength",
|
87 |
+
value=0.5,
|
88 |
+
interactive=True,
|
89 |
+
)
|
90 |
+
output_player = gr.Audio(label="Output",interactive=False)
|
91 |
+
with gr.Accordion("General Settings", open=False):
|
92 |
+
f0method0 = gr.Radio(
|
93 |
+
label="Method",
|
94 |
+
choices=["pm", "harvest", "crepe", "rmvpe"]
|
95 |
+
if config.dml == False
|
96 |
+
else ["pm", "harvest", "rmvpe"],
|
97 |
+
value="rmvpe",
|
98 |
+
interactive=True,
|
99 |
+
)
|
100 |
+
filter_radius0 = gr.Slider(
|
101 |
+
minimum=0,
|
102 |
+
maximum=7,
|
103 |
+
label="Breathiness Reduction (Harvest only)",
|
104 |
+
value=3,
|
105 |
+
step=1,
|
106 |
+
interactive=True,
|
107 |
+
)
|
108 |
+
resample_sr0 = gr.Slider(
|
109 |
+
minimum=0,
|
110 |
+
maximum=48000,
|
111 |
+
label="Resample",
|
112 |
+
value=0,
|
113 |
+
step=1,
|
114 |
+
interactive=True,
|
115 |
+
visible=False
|
116 |
+
)
|
117 |
+
rms_mix_rate0 = gr.Slider(
|
118 |
+
minimum=0,
|
119 |
+
maximum=1,
|
120 |
+
label="Volume Normalization",
|
121 |
+
value=0,
|
122 |
+
interactive=True,
|
123 |
+
)
|
124 |
+
protect0 = gr.Slider(
|
125 |
+
minimum=0,
|
126 |
+
maximum=0.5,
|
127 |
+
label="Breathiness Protection (0 is enabled, 0.5 is disabled)",
|
128 |
+
value=0.33,
|
129 |
+
step=0.01,
|
130 |
+
interactive=True,
|
131 |
+
)
|
132 |
+
if voice_model != None:
|
133 |
+
try: vc.get_vc(voice_model.value,protect0,protect0)
|
134 |
+
except: pass
|
135 |
+
with gr.Accordion("Processing Tools (Experimental)", open=True):
|
136 |
+
audio_choice = gr.Radio(choices=["Input", "Output"], value="Output", label="Source",interactive=True)
|
137 |
+
with gr.Column():
|
138 |
+
stereo_button = gr.Button(value="Stereo", variant="primary")
|
139 |
+
stereo_button.click(
|
140 |
+
fn=stereo_process,
|
141 |
+
inputs=[input_player,output_player,audio_choice],
|
142 |
+
outputs=[output_player],
|
143 |
+
preprocess=True,
|
144 |
+
)
|
145 |
+
with gr.Column():
|
146 |
+
sr_button = gr.Button(value="SuperResolution", variant="primary")
|
147 |
+
sr_button.click(
|
148 |
+
fn=sr_process,
|
149 |
+
inputs=[input_player,output_player,audio_choice],
|
150 |
+
outputs=[output_player],
|
151 |
+
preprocess=True,
|
152 |
+
)
|
153 |
+
file_index1 = gr.Textbox(
|
154 |
+
label="Index Path",
|
155 |
+
interactive=True,
|
156 |
+
visible=False#Not used here
|
157 |
+
)
|
158 |
+
refresh_button.click(
|
159 |
+
fn=change_choices,
|
160 |
+
inputs=[],
|
161 |
+
outputs=[voice_model, file_index2],
|
162 |
+
api_name="infer_refresh",
|
163 |
+
)
|
164 |
+
refresh_button.click(
|
165 |
+
fn=lambda:{"choices":paths_for_files('audios'),"__type__":"update"}, #TODO check if properly returns a sorted list of audio files in the 'audios' folder that have the extensions '.wav', '.mp3', '.ogg', or '.flac'
|
166 |
+
inputs=[],
|
167 |
+
outputs = [input_audio0],
|
168 |
+
)
|
169 |
+
refresh_button.click(
|
170 |
+
fn=lambda:{"value":paths_for_files('audios')[0],"__type__":"update"} if len(paths_for_files('audios')) > 0 else {"value":"","__type__":"update"}, #TODO check if properly returns a sorted list of audio files in the 'audios' folder that have the extensions '.wav', '.mp3', '.ogg', or '.flac'
|
171 |
+
inputs=[],
|
172 |
+
outputs = [input_audio0],
|
173 |
+
)
|
174 |
+
with gr.Row():
|
175 |
+
f0_file = gr.File(label="F0 Path", visible=False)
|
176 |
+
with gr.Row():
|
177 |
+
vc_output1 = gr.Textbox(label="Information", placeholder="Welcome!",visible=False)
|
178 |
+
but0.click(
|
179 |
+
vc.vc_single,
|
180 |
+
[
|
181 |
+
spk_item,
|
182 |
+
input_audio0,
|
183 |
+
vc_transform0,
|
184 |
+
f0_file,
|
185 |
+
f0method0,
|
186 |
+
file_index1,
|
187 |
+
file_index2,
|
188 |
+
index_rate1,
|
189 |
+
filter_radius0,
|
190 |
+
resample_sr0,
|
191 |
+
rms_mix_rate0,
|
192 |
+
protect0,
|
193 |
+
],
|
194 |
+
[vc_output1, output_player],
|
195 |
+
api_name="infer_convert",
|
196 |
+
)
|
197 |
+
voice_model.change(
|
198 |
+
fn=vc.get_vc,
|
199 |
+
inputs=[voice_model, protect0, protect0],
|
200 |
+
outputs=[spk_item, protect0, protect0, file_index2, file_index2],
|
201 |
+
api_name="infer_change_voice",
|
202 |
+
)
|
203 |
+
with gr.TabItem("Download Models"):
|
204 |
+
with gr.Row():
|
205 |
+
url_input = gr.Textbox(label="URL to model", value="",placeholder="https://...", scale=6)
|
206 |
+
name_output = gr.Textbox(label="Save as", value="",placeholder="MyModel",scale=2)
|
207 |
+
url_download = gr.Button(value="Download Model",scale=2)
|
208 |
+
url_download.click(
|
209 |
+
inputs=[url_input,name_output],
|
210 |
+
outputs=[url_input],
|
211 |
+
fn=download_from_url,
|
212 |
+
)
|
213 |
+
with gr.Row():
|
214 |
+
model_browser = gr.Dropdown(choices=list(model_library.models.keys()),label="OR Search Models (Quality UNKNOWN)",scale=5)
|
215 |
+
download_from_browser = gr.Button(value="Get",scale=2)
|
216 |
+
download_from_browser.click(
|
217 |
+
inputs=[model_browser],
|
218 |
+
outputs=[model_browser],
|
219 |
+
fn=lambda model: download_from_url(model_library.models[model],model),
|
220 |
+
)
|
221 |
+
with gr.TabItem("Train"):
|
222 |
+
with gr.Row():
|
223 |
+
with gr.Column():
|
224 |
+
training_name = gr.Textbox(label="Name your model", value="My-Voice",placeholder="My-Voice")
|
225 |
+
np7 = gr.Slider(
|
226 |
+
minimum=0,
|
227 |
+
maximum=config.n_cpu,
|
228 |
+
step=1,
|
229 |
+
label="Number of CPU processes used to extract pitch features",
|
230 |
+
value=int(np.ceil(config.n_cpu / 1.5)),
|
231 |
+
interactive=True,
|
232 |
+
)
|
233 |
+
sr2 = gr.Radio(
|
234 |
+
label="Sampling Rate",
|
235 |
+
choices=["40k", "32k"],
|
236 |
+
value="32k",
|
237 |
+
interactive=True,
|
238 |
+
visible=False
|
239 |
+
)
|
240 |
+
if_f0_3 = gr.Radio(
|
241 |
+
label="Will your model be used for singing? If not, you can ignore this.",
|
242 |
+
choices=[True, False],
|
243 |
+
value=True,
|
244 |
+
interactive=True,
|
245 |
+
visible=False
|
246 |
+
)
|
247 |
+
version19 = gr.Radio(
|
248 |
+
label="Version",
|
249 |
+
choices=["v1", "v2"],
|
250 |
+
value="v2",
|
251 |
+
interactive=True,
|
252 |
+
visible=False,
|
253 |
+
)
|
254 |
+
dataset_folder = gr.Textbox(
|
255 |
+
label="dataset folder", value='dataset'
|
256 |
+
)
|
257 |
+
easy_uploader = gr.Files(label="Drop your audio files here",file_types=['audio'])
|
258 |
+
but1 = gr.Button("1. Process", variant="primary")
|
259 |
+
info1 = gr.Textbox(label="Information", value="",visible=True)
|
260 |
+
easy_uploader.upload(inputs=[dataset_folder],outputs=[],fn=lambda folder:os.makedirs(folder,exist_ok=True))
|
261 |
+
easy_uploader.upload(
|
262 |
+
fn=lambda files,folder: [shutil.copy2(f.name,os.path.join(folder,os.path.split(f.name)[1])) for f in files] if folder != "" else gr.Warning('Please enter a folder name for your dataset'),
|
263 |
+
inputs=[easy_uploader, dataset_folder],
|
264 |
+
outputs=[])
|
265 |
+
gpus6 = gr.Textbox(
|
266 |
+
label="Enter the GPU numbers to use separated by -, (e.g. 0-1-2)",
|
267 |
+
value=gpus,
|
268 |
+
interactive=True,
|
269 |
+
visible=F0GPUVisible,
|
270 |
+
)
|
271 |
+
gpu_info9 = gr.Textbox(
|
272 |
+
label="GPU Info", value=gpu_info, visible=F0GPUVisible
|
273 |
+
)
|
274 |
+
spk_id5 = gr.Slider(
|
275 |
+
minimum=0,
|
276 |
+
maximum=4,
|
277 |
+
step=1,
|
278 |
+
label="Speaker ID",
|
279 |
+
value=0,
|
280 |
+
interactive=True,
|
281 |
+
visible=False
|
282 |
+
)
|
283 |
+
but1.click(
|
284 |
+
preprocess_dataset,
|
285 |
+
[dataset_folder, training_name, sr2, np7],
|
286 |
+
[info1],
|
287 |
+
api_name="train_preprocess",
|
288 |
+
)
|
289 |
+
with gr.Column():
|
290 |
+
f0method8 = gr.Radio(
|
291 |
+
label="F0 extraction method",
|
292 |
+
choices=["pm", "harvest", "dio", "rmvpe", "rmvpe_gpu"],
|
293 |
+
value="rmvpe_gpu",
|
294 |
+
interactive=True,
|
295 |
+
)
|
296 |
+
gpus_rmvpe = gr.Textbox(
|
297 |
+
label="GPU numbers to use separated by -, (e.g. 0-1-2)",
|
298 |
+
value="%s-%s" % (gpus, gpus),
|
299 |
+
interactive=True,
|
300 |
+
visible=F0GPUVisible,
|
301 |
+
)
|
302 |
+
but2 = gr.Button("2. Extract Features", variant="primary")
|
303 |
+
info2 = gr.Textbox(label="Information", value="", max_lines=8)
|
304 |
+
f0method8.change(
|
305 |
+
fn=change_f0_method,
|
306 |
+
inputs=[f0method8],
|
307 |
+
outputs=[gpus_rmvpe],
|
308 |
+
)
|
309 |
+
but2.click(
|
310 |
+
extract_f0_feature,
|
311 |
+
[
|
312 |
+
gpus6,
|
313 |
+
np7,
|
314 |
+
f0method8,
|
315 |
+
if_f0_3,
|
316 |
+
training_name,
|
317 |
+
version19,
|
318 |
+
gpus_rmvpe,
|
319 |
+
],
|
320 |
+
[info2],
|
321 |
+
api_name="train_extract_f0_feature",
|
322 |
+
)
|
323 |
+
with gr.Column():
|
324 |
+
total_epoch11 = gr.Slider(
|
325 |
+
minimum=2,
|
326 |
+
maximum=1000,
|
327 |
+
step=1,
|
328 |
+
label="Epochs (more epochs may improve quality but takes longer)",
|
329 |
+
value=150,
|
330 |
+
interactive=True,
|
331 |
+
)
|
332 |
+
but4 = gr.Button("3. Train Index", variant="primary")
|
333 |
+
but3 = gr.Button("4. Train Model", variant="primary")
|
334 |
+
info3 = gr.Textbox(label="Information", value="", max_lines=10)
|
335 |
+
with gr.Accordion(label="General Settings", open=False):
|
336 |
+
gpus16 = gr.Textbox(
|
337 |
+
label="GPUs separated by -, (e.g. 0-1-2)",
|
338 |
+
value="0",
|
339 |
+
interactive=True,
|
340 |
+
visible=True
|
341 |
+
)
|
342 |
+
save_epoch10 = gr.Slider(
|
343 |
+
minimum=1,
|
344 |
+
maximum=50,
|
345 |
+
step=1,
|
346 |
+
label="Weight Saving Frequency",
|
347 |
+
value=25,
|
348 |
+
interactive=True,
|
349 |
+
)
|
350 |
+
batch_size12 = gr.Slider(
|
351 |
+
minimum=1,
|
352 |
+
maximum=40,
|
353 |
+
step=1,
|
354 |
+
label="Batch Size",
|
355 |
+
value=default_batch_size,
|
356 |
+
interactive=True,
|
357 |
+
)
|
358 |
+
if_save_latest13 = gr.Radio(
|
359 |
+
label="Only save the latest model",
|
360 |
+
choices=["yes", "no"],
|
361 |
+
value="yes",
|
362 |
+
interactive=True,
|
363 |
+
visible=False
|
364 |
+
)
|
365 |
+
if_cache_gpu17 = gr.Radio(
|
366 |
+
label="If your dataset is UNDER 10 minutes, cache it to train faster",
|
367 |
+
choices=["yes", "no"],
|
368 |
+
value="no",
|
369 |
+
interactive=True,
|
370 |
+
)
|
371 |
+
if_save_every_weights18 = gr.Radio(
|
372 |
+
label="Save small model at every save point",
|
373 |
+
choices=["yes", "no"],
|
374 |
+
value="yes",
|
375 |
+
interactive=True,
|
376 |
+
)
|
377 |
+
with gr.Accordion(label="Change pretrains", open=False):
|
378 |
+
pretrained = lambda sr, letter: [os.path.abspath(os.path.join('assets/pretrained_v2', file)) for file in os.listdir('assets/pretrained_v2') if file.endswith('.pth') and sr in file and letter in file]
|
379 |
+
pretrained_G14 = gr.Dropdown(
|
380 |
+
label="pretrained G",
|
381 |
+
# Get a list of all pretrained G model files in assets/pretrained_v2 that end with .pth
|
382 |
+
choices = pretrained(sr2.value, 'G'),
|
383 |
+
value=pretrained(sr2.value, 'G')[0] if len(pretrained(sr2.value, 'G')) > 0 else '',
|
384 |
+
interactive=True,
|
385 |
+
visible=True
|
386 |
+
)
|
387 |
+
pretrained_D15 = gr.Dropdown(
|
388 |
+
label="pretrained D",
|
389 |
+
choices = pretrained(sr2.value, 'D'),
|
390 |
+
value= pretrained(sr2.value, 'D')[0] if len(pretrained(sr2.value, 'G')) > 0 else '',
|
391 |
+
visible=True,
|
392 |
+
interactive=True
|
393 |
+
)
|
394 |
+
with gr.Row():
|
395 |
+
download_model = gr.Button('5.Download Model')
|
396 |
+
with gr.Row():
|
397 |
+
model_files = gr.Files(label='Your Model and Index file can be downloaded here:')
|
398 |
+
download_model.click(
|
399 |
+
fn=lambda name: os.listdir(f'assets/weights/{name}') + glob.glob(f'logs/{name.split(".")[0]}/added_*.index'),
|
400 |
+
inputs=[training_name],
|
401 |
+
outputs=[model_files, info3])
|
402 |
+
with gr.Row():
|
403 |
+
sr2.change(
|
404 |
+
change_sr2,
|
405 |
+
[sr2, if_f0_3, version19],
|
406 |
+
[pretrained_G14, pretrained_D15],
|
407 |
+
)
|
408 |
+
version19.change(
|
409 |
+
change_version19,
|
410 |
+
[sr2, if_f0_3, version19],
|
411 |
+
[pretrained_G14, pretrained_D15, sr2],
|
412 |
+
)
|
413 |
+
if_f0_3.change(
|
414 |
+
change_f0,
|
415 |
+
[if_f0_3, sr2, version19],
|
416 |
+
[f0method8, pretrained_G14, pretrained_D15],
|
417 |
+
)
|
418 |
+
with gr.Row():
|
419 |
+
but5 = gr.Button("1 Click Training", variant="primary", visible=False)
|
420 |
+
but3.click(
|
421 |
+
click_train,
|
422 |
+
[
|
423 |
+
training_name,
|
424 |
+
sr2,
|
425 |
+
if_f0_3,
|
426 |
+
spk_id5,
|
427 |
+
save_epoch10,
|
428 |
+
total_epoch11,
|
429 |
+
batch_size12,
|
430 |
+
if_save_latest13,
|
431 |
+
pretrained_G14,
|
432 |
+
pretrained_D15,
|
433 |
+
gpus16,
|
434 |
+
if_cache_gpu17,
|
435 |
+
if_save_every_weights18,
|
436 |
+
version19,
|
437 |
+
],
|
438 |
+
info3,
|
439 |
+
api_name="train_start",
|
440 |
+
)
|
441 |
+
but4.click(train_index, [training_name, version19], info3)
|
442 |
+
but5.click(
|
443 |
+
train1key,
|
444 |
+
[
|
445 |
+
training_name,
|
446 |
+
sr2,
|
447 |
+
if_f0_3,
|
448 |
+
dataset_folder,
|
449 |
+
spk_id5,
|
450 |
+
np7,
|
451 |
+
f0method8,
|
452 |
+
save_epoch10,
|
453 |
+
total_epoch11,
|
454 |
+
batch_size12,
|
455 |
+
if_save_latest13,
|
456 |
+
pretrained_G14,
|
457 |
+
pretrained_D15,
|
458 |
+
gpus16,
|
459 |
+
if_cache_gpu17,
|
460 |
+
if_save_every_weights18,
|
461 |
+
version19,
|
462 |
+
gpus_rmvpe,
|
463 |
+
],
|
464 |
+
info3,
|
465 |
+
api_name="train_start_all",
|
466 |
+
)
|
467 |
+
|
468 |
+
if config.iscolab:
|
469 |
+
app.queue(max_size=20).launch(share=True,allowed_paths=["a.png","kofi_button.png"],show_error=True)
|
470 |
+
else:
|
471 |
+
app.queue(max_size=1022).launch(
|
472 |
+
server_name="0.0.0.0",
|
473 |
+
inbrowser=not config.noautoopen,
|
474 |
+
server_port=config.listen_port,
|
475 |
+
quiet=True,
|
476 |
+
)
|