AI-C commited on
Commit
ff3aaba
1 Parent(s): 01013b6

Upload app-full.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app-full.py +503 -0
app-full.py ADDED
@@ -0,0 +1,503 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import glob
3
+ import json
4
+ import traceback
5
+ import logging
6
+ import gradio as gr
7
+ import numpy as np
8
+ import librosa
9
+ import torch
10
+ import asyncio
11
+ import edge_tts
12
+ import yt_dlp
13
+ import ffmpeg
14
+ import subprocess
15
+ import sys
16
+ import io
17
+ import wave
18
+ from datetime import datetime
19
+ from fairseq import checkpoint_utils
20
+ from lib.infer_pack.models import (
21
+ SynthesizerTrnMs256NSFsid,
22
+ SynthesizerTrnMs256NSFsid_nono,
23
+ SynthesizerTrnMs768NSFsid,
24
+ SynthesizerTrnMs768NSFsid_nono,
25
+ )
26
+ from vc_infer_pipeline import VC
27
+ from config import Config
28
+ config = Config()
29
+ logging.getLogger("numba").setLevel(logging.WARNING)
30
+ limitation = os.getenv("SYSTEM") == "spaces"
31
+
32
+ audio_mode = []
33
+ f0method_mode = []
34
+ f0method_info = ""
35
+
36
+ if limitation is True:
37
+ audio_mode = ["Upload audio", "TTS Audio"]
38
+ f0method_mode = ["pm", "harvest"]
39
+ f0method_info = "PM is fast, Harvest is good but extremely slow, Rvmpe is alternative to harvest (might be better). (Default: PM)"
40
+ else:
41
+ audio_mode = ["Input path", "Upload audio", "Youtube", "TTS Audio"]
42
+ f0method_mode = ["pm", "harvest", "crepe"]
43
+ f0method_info = "PM is fast, Harvest is good but extremely slow, Rvmpe is alternative to harvest (might be better), and Crepe effect is good but requires GPU (Default: PM)"
44
+
45
+ if os.path.isfile("rmvpe.pt"):
46
+ f0method_mode.insert(2, "rmvpe")
47
+
48
+ def create_vc_fn(model_name, tgt_sr, net_g, vc, if_f0, version, file_index):
49
+ def vc_fn(
50
+ vc_audio_mode,
51
+ vc_input,
52
+ vc_upload,
53
+ tts_text,
54
+ tts_voice,
55
+ f0_up_key,
56
+ f0_method,
57
+ index_rate,
58
+ filter_radius,
59
+ resample_sr,
60
+ rms_mix_rate,
61
+ protect,
62
+ ):
63
+ try:
64
+ print(f"Converting using {model_name}...")
65
+ if vc_audio_mode == "Input path" or "Youtube" and vc_input != "":
66
+ audio, sr = librosa.load(vc_input, sr=16000, mono=True)
67
+ elif vc_audio_mode == "Upload audio":
68
+ if vc_upload is None:
69
+ return "You need to upload an audio", None
70
+ sampling_rate, audio = vc_upload
71
+ duration = audio.shape[0] / sampling_rate
72
+ if duration > 20 and limitation:
73
+ return "Please upload an audio file that is less than 20 seconds. If you need to generate a longer audio file, please use Colab.", None
74
+ audio = (audio / np.iinfo(audio.dtype).max).astype(np.float32)
75
+ if len(audio.shape) > 1:
76
+ audio = librosa.to_mono(audio.transpose(1, 0))
77
+ if sampling_rate != 16000:
78
+ audio = librosa.resample(audio, orig_sr=sampling_rate, target_sr=16000)
79
+ elif vc_audio_mode == "TTS Audio":
80
+ if len(tts_text) > 100 and limitation:
81
+ return "Text is too long", None
82
+ if tts_text is None or tts_voice is None:
83
+ return "You need to enter text and select a voice", None
84
+ asyncio.run(edge_tts.Communicate(tts_text, "-".join(tts_voice.split('-')[:-1])).save("tts.mp3"))
85
+ audio, sr = librosa.load("tts.mp3", sr=16000, mono=True)
86
+ vc_input = "tts.mp3"
87
+ times = [0, 0, 0]
88
+ f0_up_key = int(f0_up_key)
89
+ audio_opt = vc.pipeline(
90
+ hubert_model,
91
+ net_g,
92
+ 0,
93
+ audio,
94
+ vc_input,
95
+ times,
96
+ f0_up_key,
97
+ f0_method,
98
+ file_index,
99
+ # file_big_npy,
100
+ index_rate,
101
+ if_f0,
102
+ filter_radius,
103
+ tgt_sr,
104
+ resample_sr,
105
+ rms_mix_rate,
106
+ version,
107
+ protect,
108
+ f0_file=None,
109
+ )
110
+ info = f"[{datetime.now().strftime('%Y-%m-%d %H:%M')}]: npy: {times[0]}, f0: {times[1]}s, infer: {times[2]}s"
111
+ print(f"{model_name} | {info}")
112
+ return info, (tgt_sr, audio_opt)
113
+ except:
114
+ info = traceback.format_exc()
115
+ print(info)
116
+ return info, None
117
+ return vc_fn
118
+
119
+ def load_model():
120
+ models = []
121
+ with open(f"weights/model_info.json", "r", encoding="utf-8") as f:
122
+ models_info = json.load(f)
123
+ for character_name, info in models_info.items():
124
+ if not info['enable']:
125
+ continue
126
+ model_title = info['title']
127
+ model_name = info['model_path']
128
+ model_author = info.get("author", None)
129
+ model_cover = f"weights/{character_name}/{info['cover']}"
130
+ model_index = f"weights/{character_name}/{info['feature_retrieval_library']}"
131
+ cpt = torch.load(f"weights/{character_name}/{model_name}", map_location="cpu")
132
+ tgt_sr = cpt["config"][-1]
133
+ cpt["config"][-3] = cpt["weight"]["emb_g.weight"].shape[0] # n_spk
134
+ if_f0 = cpt.get("f0", 1)
135
+ version = cpt.get("version", "v1")
136
+ if version == "v1":
137
+ if if_f0 == 1:
138
+ net_g = SynthesizerTrnMs256NSFsid(*cpt["config"], is_half=config.is_half)
139
+ else:
140
+ net_g = SynthesizerTrnMs256NSFsid_nono(*cpt["config"])
141
+ model_version = "V1"
142
+ elif version == "v2":
143
+ if if_f0 == 1:
144
+ net_g = SynthesizerTrnMs768NSFsid(*cpt["config"], is_half=config.is_half)
145
+ else:
146
+ net_g = SynthesizerTrnMs768NSFsid_nono(*cpt["config"])
147
+ model_version = "V2"
148
+ del net_g.enc_q
149
+ print(net_g.load_state_dict(cpt["weight"], strict=False))
150
+ net_g.eval().to(config.device)
151
+ if config.is_half:
152
+ net_g = net_g.half()
153
+ else:
154
+ net_g = net_g.float()
155
+ vc = VC(tgt_sr, config)
156
+ print(f"Model loaded: {character_name} / {info['feature_retrieval_library']} | ({model_version})")
157
+ models.append((character_name, model_title, model_author, model_cover, model_version, create_vc_fn(model_name, tgt_sr, net_g, vc, if_f0, version, model_index)))
158
+ return models
159
+
160
+ def cut_vocal_and_inst(url, audio_provider, split_model):
161
+ if url != "":
162
+ if not os.path.exists("dl_audio"):
163
+ os.mkdir("dl_audio")
164
+ if audio_provider == "Youtube":
165
+ ydl_opts = {
166
+ 'noplaylist': True,
167
+ 'format': 'bestaudio/best',
168
+ 'postprocessors': [{
169
+ 'key': 'FFmpegExtractAudio',
170
+ 'preferredcodec': 'wav',
171
+ }],
172
+ "outtmpl": 'dl_audio/youtube_audio',
173
+ }
174
+ with yt_dlp.YoutubeDL(ydl_opts) as ydl:
175
+ ydl.download([url])
176
+ audio_path = "dl_audio/youtube_audio.wav"
177
+ if split_model == "htdemucs":
178
+ command = f"demucs --two-stems=vocals {audio_path} -o output"
179
+ result = subprocess.run(command.split(), stdout=subprocess.PIPE)
180
+ print(result.stdout.decode())
181
+ return "output/htdemucs/youtube_audio/vocals.wav", "output/htdemucs/youtube_audio/no_vocals.wav", audio_path, "output/htdemucs/youtube_audio/vocals.wav"
182
+ else:
183
+ command = f"demucs --two-stems=vocals -n mdx_extra_q {audio_path} -o output"
184
+ result = subprocess.run(command.split(), stdout=subprocess.PIPE)
185
+ print(result.stdout.decode())
186
+ return "output/mdx_extra_q/youtube_audio/vocals.wav", "output/mdx_extra_q/youtube_audio/no_vocals.wav", audio_path, "output/mdx_extra_q/youtube_audio/vocals.wav"
187
+ else:
188
+ raise gr.Error("URL Required!")
189
+ return None, None, None, None
190
+
191
+ def combine_vocal_and_inst(audio_data, audio_volume, split_model):
192
+ if not os.path.exists("output/result"):
193
+ os.mkdir("output/result")
194
+ vocal_path = "output/result/output.wav"
195
+ output_path = "output/result/combine.mp3"
196
+ if split_model == "htdemucs":
197
+ inst_path = "output/htdemucs/youtube_audio/no_vocals.wav"
198
+ else:
199
+ inst_path = "output/mdx_extra_q/youtube_audio/no_vocals.wav"
200
+ with wave.open(vocal_path, "w") as wave_file:
201
+ wave_file.setnchannels(1)
202
+ wave_file.setsampwidth(2)
203
+ wave_file.setframerate(audio_data[0])
204
+ wave_file.writeframes(audio_data[1].tobytes())
205
+ command = f'ffmpeg -y -i {inst_path} -i {vocal_path} -filter_complex [1:a]volume={audio_volume}dB[v];[0:a][v]amix=inputs=2:duration=longest -b:a 320k -c:a libmp3lame {output_path}'
206
+ result = subprocess.run(command.split(), stdout=subprocess.PIPE)
207
+ print(result.stdout.decode())
208
+ return output_path
209
+
210
+ def load_hubert():
211
+ global hubert_model
212
+ models, _, _ = checkpoint_utils.load_model_ensemble_and_task(
213
+ ["hubert_base.pt"],
214
+ suffix="",
215
+ )
216
+ hubert_model = models[0]
217
+ hubert_model = hubert_model.to(config.device)
218
+ if config.is_half:
219
+ hubert_model = hubert_model.half()
220
+ else:
221
+ hubert_model = hubert_model.float()
222
+ hubert_model.eval()
223
+
224
+ def change_audio_mode(vc_audio_mode):
225
+ if vc_audio_mode == "Input path":
226
+ return (
227
+ # Input & Upload
228
+ gr.Textbox.update(visible=True),
229
+ gr.Checkbox.update(visible=False),
230
+ gr.Audio.update(visible=False),
231
+ # Youtube
232
+ gr.Dropdown.update(visible=False),
233
+ gr.Textbox.update(visible=False),
234
+ gr.Dropdown.update(visible=False),
235
+ gr.Button.update(visible=False),
236
+ gr.Audio.update(visible=False),
237
+ gr.Audio.update(visible=False),
238
+ gr.Audio.update(visible=False),
239
+ gr.Slider.update(visible=False),
240
+ gr.Audio.update(visible=False),
241
+ gr.Button.update(visible=False),
242
+ # TTS
243
+ gr.Textbox.update(visible=False),
244
+ gr.Dropdown.update(visible=False)
245
+ )
246
+ elif vc_audio_mode == "Upload audio":
247
+ return (
248
+ # Input & Upload
249
+ gr.Textbox.update(visible=False),
250
+ gr.Checkbox.update(visible=True),
251
+ gr.Audio.update(visible=True),
252
+ # Youtube
253
+ gr.Dropdown.update(visible=False),
254
+ gr.Textbox.update(visible=False),
255
+ gr.Dropdown.update(visible=False),
256
+ gr.Button.update(visible=False),
257
+ gr.Audio.update(visible=False),
258
+ gr.Audio.update(visible=False),
259
+ gr.Audio.update(visible=False),
260
+ gr.Slider.update(visible=False),
261
+ gr.Audio.update(visible=False),
262
+ gr.Button.update(visible=False),
263
+ # TTS
264
+ gr.Textbox.update(visible=False),
265
+ gr.Dropdown.update(visible=False)
266
+ )
267
+ elif vc_audio_mode == "Youtube":
268
+ return (
269
+ # Input & Upload
270
+ gr.Textbox.update(visible=False),
271
+ gr.Checkbox.update(visible=False),
272
+ gr.Audio.update(visible=False),
273
+ # Youtube
274
+ gr.Dropdown.update(visible=True),
275
+ gr.Textbox.update(visible=True),
276
+ gr.Dropdown.update(visible=True),
277
+ gr.Button.update(visible=True),
278
+ gr.Audio.update(visible=True),
279
+ gr.Audio.update(visible=True),
280
+ gr.Audio.update(visible=True),
281
+ gr.Slider.update(visible=True),
282
+ gr.Audio.update(visible=True),
283
+ gr.Button.update(visible=True),
284
+ # TTS
285
+ gr.Textbox.update(visible=False),
286
+ gr.Dropdown.update(visible=False)
287
+ )
288
+ elif vc_audio_mode == "TTS Audio":
289
+ return (
290
+ # Input & Upload
291
+ gr.Textbox.update(visible=False),
292
+ gr.Checkbox.update(visible=False),
293
+ gr.Audio.update(visible=False),
294
+ # Youtube
295
+ gr.Dropdown.update(visible=False),
296
+ gr.Textbox.update(visible=False),
297
+ gr.Dropdown.update(visible=False),
298
+ gr.Button.update(visible=False),
299
+ gr.Audio.update(visible=False),
300
+ gr.Audio.update(visible=False),
301
+ gr.Audio.update(visible=False),
302
+ gr.Slider.update(visible=False),
303
+ gr.Audio.update(visible=False),
304
+ gr.Button.update(visible=False),
305
+ # TTS
306
+ gr.Textbox.update(visible=True),
307
+ gr.Dropdown.update(visible=True)
308
+ )
309
+ else:
310
+ return (
311
+ # Input & Upload
312
+ gr.Textbox.update(visible=False),
313
+ gr.Checkbox.update(visible=True),
314
+ gr.Audio.update(visible=True),
315
+ # Youtube
316
+ gr.Dropdown.update(visible=False),
317
+ gr.Textbox.update(visible=False),
318
+ gr.Dropdown.update(visible=False),
319
+ gr.Button.update(visible=False),
320
+ gr.Audio.update(visible=False),
321
+ gr.Audio.update(visible=False),
322
+ gr.Audio.update(visible=False),
323
+ gr.Slider.update(visible=False),
324
+ gr.Audio.update(visible=False),
325
+ gr.Button.update(visible=False),
326
+ # TTS
327
+ gr.Textbox.update(visible=False),
328
+ gr.Dropdown.update(visible=False)
329
+ )
330
+
331
+ def use_microphone(microphone):
332
+ if microphone == True:
333
+ return gr.Audio.update(source="microphone")
334
+ else:
335
+ return gr.Audio.update(source="upload")
336
+
337
+ if __name__ == '__main__':
338
+ load_hubert()
339
+ models = load_model()
340
+ tts_voice_list = asyncio.new_event_loop().run_until_complete(edge_tts.list_voices())
341
+ voices = [f"{v['ShortName']}-{v['Gender']}" for v in tts_voice_list]
342
+ with gr.Blocks() as app:
343
+ gr.Markdown(
344
+ "# <center> Combined Genshin Impact RVC Models\n"
345
+ "## <center> The input audio should be clean and pure voice without background music.\n"
346
+ "### <center> It is recommended to use google colab for more features. \n"
347
+ "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1Tgr6q9kKiB5P37rUitrB3CsNl8JP9iQZ?usp=sharing)\n\n"
348
+ "[![Original Repo](https://badgen.net/badge/icon/github?icon=github&label=Original%20Repo)](https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI)"
349
+ )
350
+ with gr.Tabs():
351
+ for (name, title, author, cover, model_version, vc_fn) in models:
352
+ with gr.TabItem(name):
353
+ with gr.Row():
354
+ gr.Markdown(
355
+ '<div align="center">'
356
+ f'<div>{title}</div>\n'+
357
+ f'<div>RVC {model_version} Model</div>\n'+
358
+ (f'<div>Model author: {author}</div>' if author else "")+
359
+ (f'<img style="width:auto;height:300px;" src="file/{cover}">' if cover else "")+
360
+ '</div>'
361
+ )
362
+ with gr.Row():
363
+ with gr.Column():
364
+ vc_audio_mode = gr.Dropdown(label="Input voice", choices=audio_mode, allow_custom_value=False, value="Upload audio")
365
+ # Input
366
+ vc_input = gr.Textbox(label="Input audio path", visible=False)
367
+ # Upload
368
+ vc_microphone_mode = gr.Checkbox(label="Use Microphone", value=False, visible=True, interactive=True)
369
+ vc_upload = gr.Audio(label="Upload audio file", source="upload", visible=True, interactive=True)
370
+ # Youtube
371
+ vc_download_audio = gr.Dropdown(label="Provider", choices=["Youtube"], allow_custom_value=False, visible=False, value="Youtube", info="Select provider (Default: Youtube)")
372
+ vc_link = gr.Textbox(label="Youtube URL", visible=False, info="Example: https://www.youtube.com/watch?v=Nc0sB1Bmf-A", placeholder="https://www.youtube.com/watch?v=...")
373
+ vc_split_model = gr.Dropdown(label="Splitter Model", choices=["htdemucs", "mdx_extra_q"], allow_custom_value=False, visible=False, value="htdemucs", info="Select the splitter model (Default: htdemucs)")
374
+ vc_split = gr.Button("Split Audio", variant="primary", visible=False)
375
+ vc_vocal_preview = gr.Audio(label="Vocal Preview", visible=False)
376
+ vc_inst_preview = gr.Audio(label="Instrumental Preview", visible=False)
377
+ vc_audio_preview = gr.Audio(label="Audio Preview", visible=False)
378
+ # TTS
379
+ tts_text = gr.Textbox(visible=False, label="TTS text", info="Text to speech input")
380
+ tts_voice = gr.Dropdown(label="Edge-tts speaker", choices=voices, visible=False, allow_custom_value=False, value="en-US-AnaNeural-Female")
381
+ with gr.Column():
382
+ vc_transform0 = gr.Number(label="Transpose", value=0, info='Type "12" to change from male to female voice. Type "-12" to change female to male voice')
383
+ f0method0 = gr.Radio(
384
+ label="Pitch extraction algorithm",
385
+ info=f0method_info,
386
+ choices=f0method_mode,
387
+ value="pm",
388
+ interactive=True
389
+ )
390
+ index_rate1 = gr.Slider(
391
+ minimum=0,
392
+ maximum=1,
393
+ label="Retrieval feature ratio",
394
+ info="(Default: 0.7)",
395
+ value=0.7,
396
+ interactive=True,
397
+ )
398
+ filter_radius0 = gr.Slider(
399
+ minimum=0,
400
+ maximum=7,
401
+ label="Apply Median Filtering",
402
+ info="The value represents the filter radius and can reduce breathiness.",
403
+ value=3,
404
+ step=1,
405
+ interactive=True,
406
+ )
407
+ resample_sr0 = gr.Slider(
408
+ minimum=0,
409
+ maximum=48000,
410
+ label="Resample the output audio",
411
+ info="Resample the output audio in post-processing to the final sample rate. Set to 0 for no resampling",
412
+ value=0,
413
+ step=1,
414
+ interactive=True,
415
+ )
416
+ rms_mix_rate0 = gr.Slider(
417
+ minimum=0,
418
+ maximum=1,
419
+ label="Volume Envelope",
420
+ info="Use the volume envelope of the input to replace or mix with the volume envelope of the output. The closer the ratio is to 1, the more the output envelope is used",
421
+ value=1,
422
+ interactive=True,
423
+ )
424
+ protect0 = gr.Slider(
425
+ minimum=0,
426
+ maximum=0.5,
427
+ label="Voice Protection",
428
+ info="Protect voiceless consonants and breath sounds to prevent artifacts such as tearing in electronic music. Set to 0.5 to disable. Decrease the value to increase protection, but it may reduce indexing accuracy",
429
+ value=0.5,
430
+ step=0.01,
431
+ interactive=True,
432
+ )
433
+ with gr.Column():
434
+ vc_log = gr.Textbox(label="Output Information", interactive=False)
435
+ vc_output = gr.Audio(label="Output Audio", interactive=False)
436
+ vc_convert = gr.Button("Convert", variant="primary")
437
+ vc_volume = gr.Slider(
438
+ minimum=0,
439
+ maximum=10,
440
+ label="Vocal volume",
441
+ value=4,
442
+ interactive=True,
443
+ step=1,
444
+ info="Adjust vocal volume (Default: 4}",
445
+ visible=False
446
+ )
447
+ vc_combined_output = gr.Audio(label="Output Combined Audio", visible=False)
448
+ vc_combine = gr.Button("Combine",variant="primary", visible=False)
449
+ vc_convert.click(
450
+ fn=vc_fn,
451
+ inputs=[
452
+ vc_audio_mode,
453
+ vc_input,
454
+ vc_upload,
455
+ tts_text,
456
+ tts_voice,
457
+ vc_transform0,
458
+ f0method0,
459
+ index_rate1,
460
+ filter_radius0,
461
+ resample_sr0,
462
+ rms_mix_rate0,
463
+ protect0,
464
+ ],
465
+ outputs=[vc_log ,vc_output]
466
+ )
467
+ vc_split.click(
468
+ fn=cut_vocal_and_inst,
469
+ inputs=[vc_link, vc_download_audio, vc_split_model],
470
+ outputs=[vc_vocal_preview, vc_inst_preview, vc_audio_preview, vc_input]
471
+ )
472
+ vc_combine.click(
473
+ fn=combine_vocal_and_inst,
474
+ inputs=[vc_output, vc_volume, vc_split_model],
475
+ outputs=[vc_combined_output]
476
+ )
477
+ vc_microphone_mode.change(
478
+ fn=use_microphone,
479
+ inputs=vc_microphone_mode,
480
+ outputs=vc_upload
481
+ )
482
+ vc_audio_mode.change(
483
+ fn=change_audio_mode,
484
+ inputs=[vc_audio_mode],
485
+ outputs=[
486
+ vc_input,
487
+ vc_microphone_mode,
488
+ vc_upload,
489
+ vc_download_audio,
490
+ vc_link,
491
+ vc_split_model,
492
+ vc_split,
493
+ vc_vocal_preview,
494
+ vc_inst_preview,
495
+ vc_audio_preview,
496
+ vc_volume,
497
+ vc_combined_output,
498
+ vc_combine,
499
+ tts_text,
500
+ tts_voice
501
+ ]
502
+ )
503
+ app.queue(concurrency_count=1, max_size=20, api_open=config.api).launch(share=config.colab)