AI-C commited on
Commit
5bce428
1 Parent(s): ff3aaba

Upload app.py with huggingface_hub

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