Commit ·
11fe355
1
Parent(s): f7f103d
Upload app.py
Browse files
app.py
CHANGED
|
@@ -7,8 +7,9 @@ import torch
|
|
| 7 |
import logging
|
| 8 |
import yt_dlp
|
| 9 |
import json
|
|
|
|
| 10 |
import gradio as gr
|
| 11 |
-
import
|
| 12 |
import assets.themes.loadThemes as loadThemes
|
| 13 |
from audio_separator.separator import Separator
|
| 14 |
from assets.i18n.i18n import I18nAuto
|
|
@@ -20,16 +21,22 @@ i18n = I18nAuto()
|
|
| 20 |
now_dir = os.getcwd()
|
| 21 |
sys.path.append(now_dir)
|
| 22 |
config_file = os.path.join(now_dir, "assets", "config.json")
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 25 |
use_autocast = device == "cuda"
|
| 26 |
|
| 27 |
if os.path.isdir("env"):
|
| 28 |
if platform.system() == "Windows":
|
|
|
|
| 29 |
separator_location = ".\\env\\Scripts\\audio-separator.exe"
|
| 30 |
elif platform.system() == "Linux":
|
|
|
|
| 31 |
separator_location = "env/bin/audio-separator"
|
| 32 |
else:
|
|
|
|
| 33 |
separator_location = "audio-separator"
|
| 34 |
|
| 35 |
#=========================#
|
|
@@ -47,12 +54,16 @@ roformer_models = {
|
|
| 47 |
'MelBand Roformer | Denoise-Debleed by Gabox' : 'mel_band_roformer_denoise_debleed_gabox.ckpt',
|
| 48 |
'Mel-Roformer-Karaoke-Aufr33-Viperx': 'mel_band_roformer_karaoke_aufr33_viperx_sdr_10.1956.ckpt',
|
| 49 |
'MelBand Roformer | Karaoke by Gabox' : 'mel_band_roformer_karaoke_gabox.ckpt',
|
|
|
|
| 50 |
'MelBand Roformer | Vocals by Kimberley Jensen' : 'vocals_mel_band_roformer.ckpt',
|
| 51 |
'MelBand Roformer Kim | FT by unwa' : 'mel_band_roformer_kim_ft_unwa.ckpt',
|
| 52 |
'MelBand Roformer Kim | FT 2 by unwa' : 'mel_band_roformer_kim_ft2_unwa.ckpt',
|
| 53 |
'MelBand Roformer Kim | FT 2 Bleedless by unwa' : 'mel_band_roformer_kim_ft2_bleedless_unwa.ckpt',
|
|
|
|
| 54 |
'MelBand Roformer Kim | Inst V1 by Unwa' : 'melband_roformer_inst_v1.ckpt',
|
|
|
|
| 55 |
'MelBand Roformer Kim | Inst V1 (E) by Unwa' : 'melband_roformer_inst_v1e.ckpt',
|
|
|
|
| 56 |
'MelBand Roformer Kim | Inst V2 by Unwa' : 'melband_roformer_inst_v2.ckpt',
|
| 57 |
'MelBand Roformer Kim | InstVoc Duality V1 by Unwa' : 'melband_roformer_instvoc_duality_v1.ckpt',
|
| 58 |
'MelBand Roformer Kim | InstVoc Duality V2 by Unwa' : 'melband_roformer_instvox_duality_v2.ckpt',
|
|
@@ -70,6 +81,7 @@ roformer_models = {
|
|
| 70 |
'MelBand Roformer | Instrumental 3 by Gabox' : 'mel_band_roformer_instrumental_3_gabox.ckpt',
|
| 71 |
'MelBand Roformer | Instrumental Bleedless V1 by Gabox' : 'mel_band_roformer_instrumental_bleedless_v1_gabox.ckpt',
|
| 72 |
'MelBand Roformer | Instrumental Bleedless V2 by Gabox' : 'mel_band_roformer_instrumental_bleedless_v2_gabox.ckpt',
|
|
|
|
| 73 |
'MelBand Roformer | Instrumental Fullness V1 by Gabox' : 'mel_band_roformer_instrumental_fullness_v1_gabox.ckpt',
|
| 74 |
'MelBand Roformer | Instrumental Fullness V2 by Gabox' : 'mel_band_roformer_instrumental_fullness_v2_gabox.ckpt',
|
| 75 |
'MelBand Roformer | Instrumental Fullness V3 by Gabox' : 'mel_band_roformer_instrumental_fullness_v3_gabox.ckpt',
|
|
@@ -79,6 +91,10 @@ roformer_models = {
|
|
| 79 |
'MelBand Roformer | INSTV6 by Gabox' : 'mel_band_roformer_instrumental_instv6_gabox.ckpt',
|
| 80 |
'MelBand Roformer | INSTV6N by Gabox' : 'mel_band_roformer_instrumental_instv6n_gabox.ckpt',
|
| 81 |
'MelBand Roformer | INSTV7 by Gabox' : 'mel_band_roformer_instrumental_instv7_gabox.ckpt',
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
'MelBand Roformer | De-Reverb by anvuew' : 'dereverb_mel_band_roformer_anvuew_sdr_19.1729.ckpt',
|
| 83 |
'MelBand Roformer | De-Reverb Less Aggressive by anvuew' : 'dereverb_mel_band_roformer_less_aggressive_anvuew_sdr_18.8050.ckpt',
|
| 84 |
'MelBand Roformer | De-Reverb Mono by anvuew' : 'dereverb_mel_band_roformer_mono_anvuew.ckpt',
|
|
@@ -95,6 +111,7 @@ roformer_models = {
|
|
| 95 |
'MelBand Roformer Kim | Big Beta 4 FT by unwa' : 'melband_roformer_big_beta4.ckpt',
|
| 96 |
'MelBand Roformer Kim | Big Beta 5e FT by unwa' : 'melband_roformer_big_beta5e.ckpt',
|
| 97 |
'MelBand Roformer | Big Beta 6 by unwa' : 'melband_roformer_big_beta6.ckpt',
|
|
|
|
| 98 |
'BS Roformer | Chorus Male-Female by Sucial' : 'model_chorus_bs_roformer_ep_267_sdr_24.1275.ckpt',
|
| 99 |
'BS Roformer | Male-Female by aufr33' : 'bs_roformer_male_female_by_aufr33_sdr_7.2889.ckpt',
|
| 100 |
'MelBand Roformer | Aspiration by Sucial' : 'aspiration_mel_band_roformer_sdr_18.9845.ckpt',
|
|
@@ -266,30 +283,246 @@ def download_audio(url, output_dir="ytdl"):
|
|
| 266 |
|
| 267 |
def leaderboard(list_filter):
|
| 268 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
result = subprocess.run(
|
| 270 |
-
|
| 271 |
capture_output=True,
|
| 272 |
text=True,
|
| 273 |
)
|
| 274 |
if result.returncode != 0:
|
| 275 |
return f"Error: {result.stderr}"
|
| 276 |
-
|
| 277 |
return "<table border='1'>" + "".join(
|
| 278 |
-
f"<tr style='{'font-weight: bold; font-size: 1.2em;' if i == 0 else ''}'>" +
|
| 279 |
-
"".join(f"<td>{cell}</td>" for cell in re.split(r"\s{2,}", line.strip())) +
|
| 280 |
-
"</tr>"
|
| 281 |
for i, line in enumerate(re.findall(r"^(?!-+)(.+)$", result.stdout.strip(), re.MULTILINE))
|
| 282 |
) + "</table>"
|
| 283 |
-
|
| 284 |
except Exception as e:
|
| 285 |
return f"Error: {e}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
|
| 287 |
@track_presence("Performing BS/Mel Roformer Separation")
|
| 288 |
@spaces.GPU(duration=60)
|
| 289 |
def roformer_separator(audio, model_key, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress(track_tqdm=True)):
|
| 290 |
-
base_name = os.path.splitext(os.path.basename(audio))[0]
|
| 291 |
roformer_model = roformer_models[model_key]
|
|
|
|
| 292 |
try:
|
|
|
|
|
|
|
|
|
|
| 293 |
separator = Separator(
|
| 294 |
log_level=logging.WARNING,
|
| 295 |
model_file_dir=models_dir,
|
|
@@ -326,8 +559,11 @@ def roformer_separator(audio, model_key, out_format, segment_size, override_seg_
|
|
| 326 |
@track_presence("Performing MDXC Separationn")
|
| 327 |
@spaces.GPU(duration=60)
|
| 328 |
def mdxc_separator(audio, model, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress(track_tqdm=True)):
|
| 329 |
-
|
| 330 |
try:
|
|
|
|
|
|
|
|
|
|
| 331 |
separator = Separator(
|
| 332 |
log_level=logging.WARNING,
|
| 333 |
model_file_dir=models_dir,
|
|
@@ -364,8 +600,11 @@ def mdxc_separator(audio, model, out_format, segment_size, override_seg_size, ov
|
|
| 364 |
@track_presence("Performing MDX-NET Separation")
|
| 365 |
@spaces.GPU(duration=60)
|
| 366 |
def mdxnet_separator(audio, model, out_format, hop_length, segment_size, denoise, overlap, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress(track_tqdm=True)):
|
| 367 |
-
|
| 368 |
try:
|
|
|
|
|
|
|
|
|
|
| 369 |
separator = Separator(
|
| 370 |
log_level=logging.WARNING,
|
| 371 |
model_file_dir=models_dir,
|
|
@@ -403,8 +642,11 @@ def mdxnet_separator(audio, model, out_format, hop_length, segment_size, denoise
|
|
| 403 |
@track_presence("Performing VR Arch Separation")
|
| 404 |
@spaces.GPU(duration=60)
|
| 405 |
def vrarch_separator(audio, model, out_format, window_size, aggression, tta, post_process, post_process_threshold, high_end_process, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress(track_tqdm=True)):
|
| 406 |
-
|
| 407 |
try:
|
|
|
|
|
|
|
|
|
|
| 408 |
separator = Separator(
|
| 409 |
log_level=logging.WARNING,
|
| 410 |
model_file_dir=models_dir,
|
|
@@ -444,8 +686,11 @@ def vrarch_separator(audio, model, out_format, window_size, aggression, tta, pos
|
|
| 444 |
@track_presence("Performing Demucs Separation")
|
| 445 |
@spaces.GPU(duration=60)
|
| 446 |
def demucs_separator(audio, model, out_format, shifts, segment_size, segments_enabled, overlap, batch_size, norm_thresh, amp_thresh, progress=gr.Progress(track_tqdm=True)):
|
| 447 |
-
|
| 448 |
try:
|
|
|
|
|
|
|
|
|
|
| 449 |
separator = Separator(
|
| 450 |
log_level=logging.WARNING,
|
| 451 |
model_file_dir=models_dir,
|
|
@@ -487,10 +732,14 @@ def update_stems(model):
|
|
| 487 |
|
| 488 |
@track_presence("Performing BS/Mel Roformer Batch Separation")
|
| 489 |
@spaces.GPU(duration=60)
|
| 490 |
-
def roformer_batch(path_input, path_output, model_key, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh, single_stem):
|
| 491 |
found_files.clear()
|
| 492 |
logs.clear()
|
| 493 |
roformer_model = roformer_models[model_key]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 494 |
|
| 495 |
for audio_files in os.listdir(path_input):
|
| 496 |
if audio_files.endswith(extensions):
|
|
@@ -499,14 +748,15 @@ def roformer_batch(path_input, path_output, model_key, out_format, segment_size,
|
|
| 499 |
|
| 500 |
if total_files == 0:
|
| 501 |
logs.append("No valid audio files.")
|
| 502 |
-
|
| 503 |
else:
|
| 504 |
logs.append(f"{total_files} audio files found")
|
| 505 |
found_files.sort()
|
|
|
|
| 506 |
|
| 507 |
-
for audio_files in found_files:
|
|
|
|
| 508 |
file_path = os.path.join(path_input, audio_files)
|
| 509 |
-
base_name = os.path.splitext(os.path.basename(file_path))[0]
|
| 510 |
try:
|
| 511 |
separator = Separator(
|
| 512 |
log_level=logging.WARNING,
|
|
@@ -526,22 +776,26 @@ def roformer_batch(path_input, path_output, model_key, out_format, segment_size,
|
|
| 526 |
)
|
| 527 |
|
| 528 |
logs.append("Loading model...")
|
| 529 |
-
yield "\n".join(logs)
|
| 530 |
separator.load_model(model_filename=roformer_model)
|
| 531 |
|
| 532 |
logs.append(f"Separating file: {audio_files}")
|
| 533 |
-
yield "\n".join(logs)
|
| 534 |
separator.separate(file_path)
|
| 535 |
logs.append(f"File: {audio_files} separated!")
|
| 536 |
-
yield "\n".join(logs)
|
| 537 |
except Exception as e:
|
| 538 |
-
raise RuntimeError(f"Roformer batch separation failed: {e}") from e
|
|
|
|
|
|
|
|
|
|
| 539 |
|
| 540 |
@track_presence("Performing MDXC Batch Separation")
|
| 541 |
@spaces.GPU(duration=60)
|
| 542 |
-
def mdx23c_batch(path_input, path_output, model, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh, single_stem):
|
| 543 |
found_files.clear()
|
| 544 |
logs.clear()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 545 |
|
| 546 |
for audio_files in os.listdir(path_input):
|
| 547 |
if audio_files.endswith(extensions):
|
|
@@ -550,14 +804,15 @@ def mdx23c_batch(path_input, path_output, model, out_format, segment_size, overr
|
|
| 550 |
|
| 551 |
if total_files == 0:
|
| 552 |
logs.append("No valid audio files.")
|
| 553 |
-
|
| 554 |
else:
|
| 555 |
logs.append(f"{total_files} audio files found")
|
| 556 |
found_files.sort()
|
|
|
|
| 557 |
|
| 558 |
-
for audio_files in found_files:
|
|
|
|
| 559 |
file_path = os.path.join(path_input, audio_files)
|
| 560 |
-
base_name = os.path.splitext(os.path.basename(file_path))[0]
|
| 561 |
try:
|
| 562 |
separator = Separator(
|
| 563 |
log_level=logging.WARNING,
|
|
@@ -577,22 +832,26 @@ def mdx23c_batch(path_input, path_output, model, out_format, segment_size, overr
|
|
| 577 |
)
|
| 578 |
|
| 579 |
logs.append("Loading model...")
|
| 580 |
-
yield "\n".join(logs)
|
| 581 |
separator.load_model(model_filename=model)
|
| 582 |
|
| 583 |
logs.append(f"Separating file: {audio_files}")
|
| 584 |
-
yield "\n".join(logs)
|
| 585 |
separator.separate(file_path)
|
| 586 |
logs.append(f"File: {audio_files} separated!")
|
| 587 |
-
yield "\n".join(logs)
|
| 588 |
except Exception as e:
|
| 589 |
-
raise RuntimeError(f"
|
|
|
|
|
|
|
|
|
|
| 590 |
|
| 591 |
@track_presence("Performing MDX-NET Batch Separation")
|
| 592 |
@spaces.GPU(duration=60)
|
| 593 |
-
def mdxnet_batch(path_input, path_output, model, out_format, hop_length, segment_size, denoise, overlap, batch_size, norm_thresh, amp_thresh, single_stem):
|
| 594 |
found_files.clear()
|
| 595 |
logs.clear()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 596 |
|
| 597 |
for audio_files in os.listdir(path_input):
|
| 598 |
if audio_files.endswith(extensions):
|
|
@@ -601,14 +860,15 @@ def mdxnet_batch(path_input, path_output, model, out_format, hop_length, segment
|
|
| 601 |
|
| 602 |
if total_files == 0:
|
| 603 |
logs.append("No valid audio files.")
|
| 604 |
-
|
| 605 |
else:
|
| 606 |
logs.append(f"{total_files} audio files found")
|
| 607 |
found_files.sort()
|
|
|
|
| 608 |
|
| 609 |
-
for audio_files in found_files:
|
|
|
|
| 610 |
file_path = os.path.join(path_input, audio_files)
|
| 611 |
-
base_name = os.path.splitext(os.path.basename(file_path))[0]
|
| 612 |
try:
|
| 613 |
separator = Separator(
|
| 614 |
log_level=logging.WARNING,
|
|
@@ -629,22 +889,26 @@ def mdxnet_batch(path_input, path_output, model, out_format, hop_length, segment
|
|
| 629 |
)
|
| 630 |
|
| 631 |
logs.append("Loading model...")
|
| 632 |
-
yield "\n".join(logs)
|
| 633 |
separator.load_model(model_filename=model)
|
| 634 |
|
| 635 |
logs.append(f"Separating file: {audio_files}")
|
| 636 |
-
yield "\n".join(logs)
|
| 637 |
separator.separate(file_path)
|
| 638 |
logs.append(f"File: {audio_files} separated!")
|
| 639 |
-
yield "\n".join(logs)
|
| 640 |
except Exception as e:
|
| 641 |
-
raise RuntimeError(f"
|
|
|
|
|
|
|
|
|
|
| 642 |
|
| 643 |
@track_presence("Performing VR Arch Batch Separation")
|
| 644 |
@spaces.GPU(duration=60)
|
| 645 |
-
def vrarch_batch(path_input, path_output, model, out_format, window_size, aggression, tta, post_process, post_process_threshold, high_end_process, batch_size, norm_thresh, amp_thresh, single_stem):
|
| 646 |
found_files.clear()
|
| 647 |
logs.clear()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 648 |
|
| 649 |
for audio_files in os.listdir(path_input):
|
| 650 |
if audio_files.endswith(extensions):
|
|
@@ -653,14 +917,15 @@ def vrarch_batch(path_input, path_output, model, out_format, window_size, aggres
|
|
| 653 |
|
| 654 |
if total_files == 0:
|
| 655 |
logs.append("No valid audio files.")
|
| 656 |
-
|
| 657 |
else:
|
| 658 |
logs.append(f"{total_files} audio files found")
|
| 659 |
found_files.sort()
|
|
|
|
| 660 |
|
| 661 |
-
for audio_files in found_files:
|
|
|
|
| 662 |
file_path = os.path.join(path_input, audio_files)
|
| 663 |
-
base_name = os.path.splitext(os.path.basename(file_path))[0]
|
| 664 |
try:
|
| 665 |
separator = Separator(
|
| 666 |
log_level=logging.WARNING,
|
|
@@ -683,22 +948,26 @@ def vrarch_batch(path_input, path_output, model, out_format, window_size, aggres
|
|
| 683 |
)
|
| 684 |
|
| 685 |
logs.append("Loading model...")
|
| 686 |
-
yield "\n".join(logs)
|
| 687 |
separator.load_model(model_filename=model)
|
| 688 |
|
| 689 |
logs.append(f"Separating file: {audio_files}")
|
| 690 |
-
yield "\n".join(logs)
|
| 691 |
separator.separate(file_path)
|
| 692 |
logs.append(f"File: {audio_files} separated!")
|
| 693 |
-
yield "\n".join(logs)
|
| 694 |
except Exception as e:
|
| 695 |
-
raise RuntimeError(f"
|
|
|
|
|
|
|
|
|
|
| 696 |
|
| 697 |
@track_presence("Performing Demucs Batch Separation")
|
| 698 |
@spaces.GPU(duration=60)
|
| 699 |
-
def demucs_batch(path_input, path_output, model, out_format, shifts, segment_size, segments_enabled, overlap, batch_size, norm_thresh, amp_thresh):
|
| 700 |
found_files.clear()
|
| 701 |
logs.clear()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 702 |
|
| 703 |
for audio_files in os.listdir(path_input):
|
| 704 |
if audio_files.endswith(extensions):
|
|
@@ -707,12 +976,14 @@ def demucs_batch(path_input, path_output, model, out_format, shifts, segment_siz
|
|
| 707 |
|
| 708 |
if total_files == 0:
|
| 709 |
logs.append("No valid audio files.")
|
| 710 |
-
|
| 711 |
else:
|
| 712 |
logs.append(f"{total_files} audio files found")
|
| 713 |
found_files.sort()
|
|
|
|
| 714 |
|
| 715 |
-
for audio_files in found_files:
|
|
|
|
| 716 |
file_path = os.path.join(path_input, audio_files)
|
| 717 |
try:
|
| 718 |
separator = Separator(
|
|
@@ -733,34 +1004,35 @@ def demucs_batch(path_input, path_output, model, out_format, shifts, segment_siz
|
|
| 733 |
)
|
| 734 |
|
| 735 |
logs.append("Loading model...")
|
| 736 |
-
yield "\n".join(logs)
|
| 737 |
separator.load_model(model_filename=model)
|
| 738 |
|
| 739 |
logs.append(f"Separating file: {audio_files}")
|
| 740 |
-
yield "\n".join(logs)
|
| 741 |
separator.separate(file_path)
|
| 742 |
logs.append(f"File: {audio_files} separated!")
|
| 743 |
-
yield "\n".join(logs)
|
| 744 |
except Exception as e:
|
| 745 |
-
raise RuntimeError(f"
|
|
|
|
|
|
|
|
|
|
| 746 |
|
| 747 |
with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 UVR5 UI 🎵") as app:
|
| 748 |
gr.Markdown("<h1> 🎵 UVR5 UI 🎵 </h1>")
|
| 749 |
gr.Markdown(i18n("If you liked this HF Space you can give me a ❤️"))
|
| 750 |
gr.Markdown(i18n("Try UVR5 UI using Colab [here](https://colab.research.google.com/github/Eddycrack864/UVR5-UI/blob/main/UVR_UI.ipynb)"))
|
|
|
|
| 751 |
with gr.Tabs():
|
| 752 |
with gr.TabItem("BS/Mel Roformer"):
|
| 753 |
with gr.Row():
|
| 754 |
roformer_model = gr.Dropdown(
|
| 755 |
label = i18n("Select the model"),
|
| 756 |
choices = list(roformer_models.keys()),
|
| 757 |
-
value =
|
| 758 |
interactive = True
|
| 759 |
)
|
| 760 |
roformer_output_format = gr.Dropdown(
|
| 761 |
label = i18n("Select the output format"),
|
| 762 |
choices = output_format,
|
| 763 |
-
value =
|
| 764 |
interactive = True
|
| 765 |
)
|
| 766 |
with gr.Accordion(i18n("Advanced settings"), open = False):
|
|
@@ -772,13 +1044,13 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 772 |
minimum = 32,
|
| 773 |
maximum = 4000,
|
| 774 |
step = 32,
|
| 775 |
-
value = 256,
|
| 776 |
interactive = True
|
| 777 |
)
|
| 778 |
roformer_override_segment_size = gr.Checkbox(
|
| 779 |
label = i18n("Override segment size"),
|
| 780 |
info = i18n("Override model default segment size instead of using the model default value"),
|
| 781 |
-
value = False,
|
| 782 |
interactive = True
|
| 783 |
)
|
| 784 |
with gr.Row():
|
|
@@ -788,7 +1060,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 788 |
minimum = 2,
|
| 789 |
maximum = 10,
|
| 790 |
step = 1,
|
| 791 |
-
value = 8,
|
| 792 |
interactive = True
|
| 793 |
)
|
| 794 |
roformer_batch_size = gr.Slider(
|
|
@@ -797,7 +1069,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 797 |
minimum = 1,
|
| 798 |
maximum = 16,
|
| 799 |
step = 1,
|
| 800 |
-
value = 1,
|
| 801 |
interactive = True
|
| 802 |
)
|
| 803 |
with gr.Row():
|
|
@@ -807,7 +1079,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 807 |
minimum = 0.1,
|
| 808 |
maximum = 1,
|
| 809 |
step = 0.1,
|
| 810 |
-
value = 0.9,
|
| 811 |
interactive = True
|
| 812 |
)
|
| 813 |
roformer_amplification_threshold = gr.Slider(
|
|
@@ -816,15 +1088,30 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 816 |
minimum = 0.1,
|
| 817 |
maximum = 1,
|
| 818 |
step = 0.1,
|
| 819 |
-
value = 0.7,
|
| 820 |
interactive = True
|
| 821 |
)
|
| 822 |
with gr.Row():
|
| 823 |
roformer_single_stem = gr.Textbox(
|
| 824 |
label = i18n("Output only single stem"),
|
| 825 |
placeholder = i18n("Write the stem you want, check the stems of each model on Leaderboard. e.g. Instrumental"),
|
|
|
|
| 826 |
interactive = True
|
| 827 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 828 |
with gr.Row():
|
| 829 |
roformer_audio = gr.Audio(
|
| 830 |
label = i18n("Input audio"),
|
|
@@ -893,13 +1180,13 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 893 |
mdx23c_model = gr.Dropdown(
|
| 894 |
label = i18n("Select the model"),
|
| 895 |
choices = mdx23c_models,
|
| 896 |
-
value =
|
| 897 |
interactive = True
|
| 898 |
)
|
| 899 |
mdx23c_output_format = gr.Dropdown(
|
| 900 |
label = i18n("Select the output format"),
|
| 901 |
choices = output_format,
|
| 902 |
-
value =
|
| 903 |
interactive = True
|
| 904 |
)
|
| 905 |
with gr.Accordion(i18n("Advanced settings"), open = False):
|
|
@@ -911,13 +1198,13 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 911 |
step = 32,
|
| 912 |
label = i18n("Segment size"),
|
| 913 |
info = i18n("Larger consumes more resources, but may give better results"),
|
| 914 |
-
value = 256,
|
| 915 |
interactive = True
|
| 916 |
)
|
| 917 |
mdx23c_override_segment_size = gr.Checkbox(
|
| 918 |
label = i18n("Override segment size"),
|
| 919 |
info = i18n("Override model default segment size instead of using the model default value"),
|
| 920 |
-
value = False,
|
| 921 |
interactive = True
|
| 922 |
)
|
| 923 |
with gr.Row():
|
|
@@ -927,7 +1214,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 927 |
step = 1,
|
| 928 |
label = i18n("Overlap"),
|
| 929 |
info = i18n("Amount of overlap between prediction windows"),
|
| 930 |
-
value = 8,
|
| 931 |
interactive = True
|
| 932 |
)
|
| 933 |
mdx23c_batch_size = gr.Slider(
|
|
@@ -936,7 +1223,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 936 |
minimum = 1,
|
| 937 |
maximum = 16,
|
| 938 |
step = 1,
|
| 939 |
-
value = 1,
|
| 940 |
interactive = True
|
| 941 |
)
|
| 942 |
with gr.Row():
|
|
@@ -946,7 +1233,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 946 |
minimum = 0.1,
|
| 947 |
maximum = 1,
|
| 948 |
step = 0.1,
|
| 949 |
-
value = 0.9,
|
| 950 |
interactive = True
|
| 951 |
)
|
| 952 |
mdx23c_amplification_threshold = gr.Slider(
|
|
@@ -955,15 +1242,30 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 955 |
minimum = 0.1,
|
| 956 |
maximum = 1,
|
| 957 |
step = 0.1,
|
| 958 |
-
value = 0.7,
|
| 959 |
interactive = True
|
| 960 |
)
|
| 961 |
with gr.Row():
|
| 962 |
mdx23c_single_stem = gr.Textbox(
|
| 963 |
label = i18n("Output only single stem"),
|
| 964 |
placeholder = i18n("Write the stem you want, check the stems of each model on Leaderboard. e.g. Instrumental"),
|
|
|
|
| 965 |
interactive = True
|
| 966 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 967 |
with gr.Row():
|
| 968 |
mdx23c_audio = gr.Audio(
|
| 969 |
label = i18n("Input audio"),
|
|
@@ -1032,13 +1334,13 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1032 |
mdxnet_model = gr.Dropdown(
|
| 1033 |
label = i18n("Select the model"),
|
| 1034 |
choices = mdxnet_models,
|
| 1035 |
-
value =
|
| 1036 |
interactive = True
|
| 1037 |
)
|
| 1038 |
mdxnet_output_format = gr.Dropdown(
|
| 1039 |
label = i18n("Select the output format"),
|
| 1040 |
choices = output_format,
|
| 1041 |
-
value =
|
| 1042 |
interactive = True
|
| 1043 |
)
|
| 1044 |
with gr.Accordion(i18n("Advanced settings"), open = False):
|
|
@@ -1050,7 +1352,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1050 |
minimum = 32,
|
| 1051 |
maximum = 2048,
|
| 1052 |
step = 32,
|
| 1053 |
-
value = 1024,
|
| 1054 |
interactive = True
|
| 1055 |
)
|
| 1056 |
mdxnet_segment_size = gr.Slider(
|
|
@@ -1059,13 +1361,13 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1059 |
step = 32,
|
| 1060 |
label = i18n("Segment size"),
|
| 1061 |
info = i18n("Larger consumes more resources, but may give better results"),
|
| 1062 |
-
value = 256,
|
| 1063 |
interactive = True
|
| 1064 |
)
|
| 1065 |
mdxnet_denoise = gr.Checkbox(
|
| 1066 |
label = i18n("Denoise"),
|
| 1067 |
info = i18n("Enable denoising during separation"),
|
| 1068 |
-
value = True,
|
| 1069 |
interactive = True
|
| 1070 |
)
|
| 1071 |
with gr.Row():
|
|
@@ -1075,7 +1377,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1075 |
minimum = 0.001,
|
| 1076 |
maximum = 0.999,
|
| 1077 |
step = 0.001,
|
| 1078 |
-
value = 0.25,
|
| 1079 |
interactive = True
|
| 1080 |
)
|
| 1081 |
mdxnet_batch_size = gr.Slider(
|
|
@@ -1084,7 +1386,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1084 |
minimum = 1,
|
| 1085 |
maximum = 16,
|
| 1086 |
step = 1,
|
| 1087 |
-
value = 1,
|
| 1088 |
interactive = True
|
| 1089 |
)
|
| 1090 |
with gr.Row():
|
|
@@ -1094,7 +1396,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1094 |
minimum = 0.1,
|
| 1095 |
maximum = 1,
|
| 1096 |
step = 0.1,
|
| 1097 |
-
value = 0.9,
|
| 1098 |
interactive = True
|
| 1099 |
)
|
| 1100 |
mdxnet_amplification_threshold = gr.Slider(
|
|
@@ -1103,15 +1405,31 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1103 |
minimum = 0.1,
|
| 1104 |
maximum = 1,
|
| 1105 |
step = 0.1,
|
| 1106 |
-
value = 0.7,
|
| 1107 |
interactive = True
|
| 1108 |
)
|
| 1109 |
with gr.Row():
|
| 1110 |
mdxnet_single_stem = gr.Textbox(
|
| 1111 |
label = i18n("Output only single stem"),
|
| 1112 |
placeholder = i18n("Write the stem you want, check the stems of each model on Leaderboard. e.g. Instrumental"),
|
|
|
|
| 1113 |
interactive = True
|
| 1114 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1115 |
with gr.Row():
|
| 1116 |
mdxnet_audio = gr.Audio(
|
| 1117 |
label = i18n("Input audio"),
|
|
@@ -1180,13 +1498,13 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1180 |
vrarch_model = gr.Dropdown(
|
| 1181 |
label = i18n("Select the model"),
|
| 1182 |
choices = vrarch_models,
|
| 1183 |
-
value =
|
| 1184 |
interactive = True
|
| 1185 |
)
|
| 1186 |
vrarch_output_format = gr.Dropdown(
|
| 1187 |
label = i18n("Select the output format"),
|
| 1188 |
choices = output_format,
|
| 1189 |
-
value =
|
| 1190 |
interactive = True
|
| 1191 |
)
|
| 1192 |
with gr.Accordion(i18n("Advanced settings"), open = False):
|
|
@@ -1198,7 +1516,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1198 |
minimum=320,
|
| 1199 |
maximum=1024,
|
| 1200 |
step=32,
|
| 1201 |
-
value = 512,
|
| 1202 |
interactive = True
|
| 1203 |
)
|
| 1204 |
vrarch_agression = gr.Slider(
|
|
@@ -1207,13 +1525,13 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1207 |
step = 1,
|
| 1208 |
label = i18n("Agression"),
|
| 1209 |
info = i18n("Intensity of primary stem extraction"),
|
| 1210 |
-
value = 5,
|
| 1211 |
interactive = True
|
| 1212 |
)
|
| 1213 |
vrarch_tta = gr.Checkbox(
|
| 1214 |
label = i18n("TTA"),
|
| 1215 |
info = i18n("Enable Test-Time-Augmentation; slow but improves quality"),
|
| 1216 |
-
value = True,
|
| 1217 |
visible = True,
|
| 1218 |
interactive = True
|
| 1219 |
)
|
|
@@ -1221,7 +1539,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1221 |
vrarch_post_process = gr.Checkbox(
|
| 1222 |
label = i18n("Post process"),
|
| 1223 |
info = i18n("Identify leftover artifacts within vocal output; may improve separation for some songs"),
|
| 1224 |
-
value = False,
|
| 1225 |
visible = True,
|
| 1226 |
interactive = True
|
| 1227 |
)
|
|
@@ -1231,14 +1549,14 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1231 |
minimum = 0.1,
|
| 1232 |
maximum = 0.3,
|
| 1233 |
step = 0.1,
|
| 1234 |
-
value = 0.2,
|
| 1235 |
interactive = True
|
| 1236 |
)
|
| 1237 |
with gr.Row():
|
| 1238 |
vrarch_high_end_process = gr.Checkbox(
|
| 1239 |
label = i18n("High end process"),
|
| 1240 |
info = i18n("Mirror the missing frequency range of the output"),
|
| 1241 |
-
value = False,
|
| 1242 |
visible = True,
|
| 1243 |
interactive = True,
|
| 1244 |
)
|
|
@@ -1248,7 +1566,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1248 |
minimum = 1,
|
| 1249 |
maximum = 16,
|
| 1250 |
step = 1,
|
| 1251 |
-
value = 1,
|
| 1252 |
interactive = True
|
| 1253 |
)
|
| 1254 |
with gr.Row():
|
|
@@ -1258,7 +1576,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1258 |
minimum = 0.1,
|
| 1259 |
maximum = 1,
|
| 1260 |
step = 0.1,
|
| 1261 |
-
value = 0.9,
|
| 1262 |
interactive = True
|
| 1263 |
)
|
| 1264 |
vrarch_amplification_threshold = gr.Slider(
|
|
@@ -1267,15 +1585,33 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1267 |
minimum = 0.1,
|
| 1268 |
maximum = 1,
|
| 1269 |
step = 0.1,
|
| 1270 |
-
value = 0.7,
|
| 1271 |
interactive = True
|
| 1272 |
)
|
| 1273 |
with gr.Row():
|
| 1274 |
vrarch_single_stem = gr.Textbox(
|
| 1275 |
label = i18n("Output only single stem"),
|
| 1276 |
placeholder = i18n("Write the stem you want, check the stems of each model on Leaderboard. e.g. Instrumental"),
|
|
|
|
| 1277 |
interactive = True
|
| 1278 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1279 |
with gr.Row():
|
| 1280 |
vrarch_audio = gr.Audio(
|
| 1281 |
label = i18n("Input audio"),
|
|
@@ -1344,13 +1680,13 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1344 |
demucs_model = gr.Dropdown(
|
| 1345 |
label = i18n("Select the model"),
|
| 1346 |
choices = demucs_models,
|
| 1347 |
-
value =
|
| 1348 |
interactive = True
|
| 1349 |
)
|
| 1350 |
demucs_output_format = gr.Dropdown(
|
| 1351 |
label = i18n("Select the output format"),
|
| 1352 |
choices = output_format,
|
| 1353 |
-
value =
|
| 1354 |
interactive = True
|
| 1355 |
)
|
| 1356 |
with gr.Accordion(i18n("Advanced settings"), open = False):
|
|
@@ -1362,7 +1698,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1362 |
minimum = 1,
|
| 1363 |
maximum = 20,
|
| 1364 |
step = 1,
|
| 1365 |
-
value = 2,
|
| 1366 |
interactive = True
|
| 1367 |
)
|
| 1368 |
demucs_segment_size = gr.Slider(
|
|
@@ -1371,13 +1707,13 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1371 |
minimum = 1,
|
| 1372 |
maximum = 100,
|
| 1373 |
step = 1,
|
| 1374 |
-
value = 40,
|
| 1375 |
interactive = True
|
| 1376 |
)
|
| 1377 |
demucs_segments_enabled = gr.Checkbox(
|
| 1378 |
label = i18n("Segment-wise processing"),
|
| 1379 |
info = i18n("Enable segment-wise processing"),
|
| 1380 |
-
value = True,
|
| 1381 |
interactive = True
|
| 1382 |
)
|
| 1383 |
with gr.Row():
|
|
@@ -1387,7 +1723,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1387 |
minimum=0.001,
|
| 1388 |
maximum=0.999,
|
| 1389 |
step=0.001,
|
| 1390 |
-
value = 0.25,
|
| 1391 |
interactive = True
|
| 1392 |
)
|
| 1393 |
demucs_batch_size = gr.Slider(
|
|
@@ -1396,7 +1732,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1396 |
minimum = 1,
|
| 1397 |
maximum = 16,
|
| 1398 |
step = 1,
|
| 1399 |
-
value = 1,
|
| 1400 |
interactive = True
|
| 1401 |
)
|
| 1402 |
with gr.Row():
|
|
@@ -1406,7 +1742,7 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1406 |
minimum = 0.1,
|
| 1407 |
maximum = 1,
|
| 1408 |
step = 0.1,
|
| 1409 |
-
value = 0.9,
|
| 1410 |
interactive = True
|
| 1411 |
)
|
| 1412 |
demucs_amplification_threshold = gr.Slider(
|
|
@@ -1415,9 +1751,23 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1415 |
minimum = 0.1,
|
| 1416 |
maximum = 1,
|
| 1417 |
step = 0.1,
|
| 1418 |
-
value = 0.7,
|
| 1419 |
interactive = True
|
| 1420 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1421 |
with gr.Row():
|
| 1422 |
demucs_audio = gr.Audio(
|
| 1423 |
label = i18n("Input audio"),
|
|
@@ -1529,14 +1879,13 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1529 |
info = i18n("Select the theme you want to use. (Requires restarting the App)"),
|
| 1530 |
choices = loadThemes.get_list(),
|
| 1531 |
value = loadThemes.read_json(),
|
| 1532 |
-
|
| 1533 |
)
|
| 1534 |
-
dummy_output = gr.Textbox(visible = False)
|
| 1535 |
|
| 1536 |
themes_select.change(
|
| 1537 |
fn = loadThemes.select_theme,
|
| 1538 |
inputs = themes_select,
|
| 1539 |
-
outputs = [
|
| 1540 |
)
|
| 1541 |
|
| 1542 |
with gr.TabItem(i18n("Credits")):
|
|
@@ -1548,13 +1897,14 @@ with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 U
|
|
| 1548 |
* Thanks to [Mikus](https://github.com/cappuch) for the help with the code.
|
| 1549 |
* Thanks to [Nick088](https://huggingface.co/Nick088) for the help to fix roformers.
|
| 1550 |
* Thanks to [yt_dlp](https://github.com/yt-dlp/yt-dlp) devs.
|
| 1551 |
-
* Separation by link source code and improvements by [
|
| 1552 |
* Thanks to [ArisDev](https://github.com/aris-py) for porting UVR5 UI to Kaggle and improvements.
|
| 1553 |
* Thanks to [Bebra777228](https://github.com/Bebra777228)'s code for guiding me to improve my code.
|
| 1554 |
* Thanks to Nick088, MrM0dZ, Ryouko-Yamanda65777, lucinamari, perariroswe, Enes, Léo and the_undead0 for helping translate UVR5 UI.
|
| 1555 |
* Thanks to vadigr123 for creating the images for the Discord Rich Presence.
|
| 1556 |
|
| 1557 |
-
You can donate to the original UVR5 project
|
|
|
|
| 1558 |
"""
|
| 1559 |
)
|
| 1560 |
|
|
|
|
| 7 |
import logging
|
| 8 |
import yt_dlp
|
| 9 |
import json
|
| 10 |
+
import copy
|
| 11 |
import gradio as gr
|
| 12 |
+
import urllib.parse
|
| 13 |
import assets.themes.loadThemes as loadThemes
|
| 14 |
from audio_separator.separator import Separator
|
| 15 |
from assets.i18n.i18n import I18nAuto
|
|
|
|
| 21 |
now_dir = os.getcwd()
|
| 22 |
sys.path.append(now_dir)
|
| 23 |
config_file = os.path.join(now_dir, "assets", "config.json")
|
| 24 |
+
models_file = os.path.join(now_dir, "assets", "models.json")
|
| 25 |
+
default_settings_file = os.path.join(now_dir, "assets", "default_settings.json")
|
| 26 |
+
custom_settings_file = os.path.join(now_dir, "assets", "custom_settings.json")
|
| 27 |
|
| 28 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 29 |
use_autocast = device == "cuda"
|
| 30 |
|
| 31 |
if os.path.isdir("env"):
|
| 32 |
if platform.system() == "Windows":
|
| 33 |
+
python_location = ".\\env\\python.exe"
|
| 34 |
separator_location = ".\\env\\Scripts\\audio-separator.exe"
|
| 35 |
elif platform.system() == "Linux":
|
| 36 |
+
python_location = "env/bin/python"
|
| 37 |
separator_location = "env/bin/audio-separator"
|
| 38 |
else:
|
| 39 |
+
python_location = None
|
| 40 |
separator_location = "audio-separator"
|
| 41 |
|
| 42 |
#=========================#
|
|
|
|
| 54 |
'MelBand Roformer | Denoise-Debleed by Gabox' : 'mel_band_roformer_denoise_debleed_gabox.ckpt',
|
| 55 |
'Mel-Roformer-Karaoke-Aufr33-Viperx': 'mel_band_roformer_karaoke_aufr33_viperx_sdr_10.1956.ckpt',
|
| 56 |
'MelBand Roformer | Karaoke by Gabox' : 'mel_band_roformer_karaoke_gabox.ckpt',
|
| 57 |
+
'MelBand Roformer | Karaoke by becruily' : 'mel_band_roformer_karaoke_becruily.ckpt',
|
| 58 |
'MelBand Roformer | Vocals by Kimberley Jensen' : 'vocals_mel_band_roformer.ckpt',
|
| 59 |
'MelBand Roformer Kim | FT by unwa' : 'mel_band_roformer_kim_ft_unwa.ckpt',
|
| 60 |
'MelBand Roformer Kim | FT 2 by unwa' : 'mel_band_roformer_kim_ft2_unwa.ckpt',
|
| 61 |
'MelBand Roformer Kim | FT 2 Bleedless by unwa' : 'mel_band_roformer_kim_ft2_bleedless_unwa.ckpt',
|
| 62 |
+
'MelBand Roformer Kim | FT 3 by unwa' : 'mel_band_roformer_kim_ft3_unwa.ckpt',
|
| 63 |
'MelBand Roformer Kim | Inst V1 by Unwa' : 'melband_roformer_inst_v1.ckpt',
|
| 64 |
+
'MelBand Roformer Kim | Inst V1 Plus by Unwa' : 'melband_roformer_inst_v1_plus.ckpt',
|
| 65 |
'MelBand Roformer Kim | Inst V1 (E) by Unwa' : 'melband_roformer_inst_v1e.ckpt',
|
| 66 |
+
'MelBand Roformer Kim | Inst V1 (E) Plus by Unwa' : 'melband_roformer_inst_v1e_plus.ckpt',
|
| 67 |
'MelBand Roformer Kim | Inst V2 by Unwa' : 'melband_roformer_inst_v2.ckpt',
|
| 68 |
'MelBand Roformer Kim | InstVoc Duality V1 by Unwa' : 'melband_roformer_instvoc_duality_v1.ckpt',
|
| 69 |
'MelBand Roformer Kim | InstVoc Duality V2 by Unwa' : 'melband_roformer_instvox_duality_v2.ckpt',
|
|
|
|
| 81 |
'MelBand Roformer | Instrumental 3 by Gabox' : 'mel_band_roformer_instrumental_3_gabox.ckpt',
|
| 82 |
'MelBand Roformer | Instrumental Bleedless V1 by Gabox' : 'mel_band_roformer_instrumental_bleedless_v1_gabox.ckpt',
|
| 83 |
'MelBand Roformer | Instrumental Bleedless V2 by Gabox' : 'mel_band_roformer_instrumental_bleedless_v2_gabox.ckpt',
|
| 84 |
+
'MelBand Roformer | Instrumental Bleedless V3 by Gabox' : 'mel_band_roformer_instrumental_bleedless_v3_gabox.ckpt',
|
| 85 |
'MelBand Roformer | Instrumental Fullness V1 by Gabox' : 'mel_band_roformer_instrumental_fullness_v1_gabox.ckpt',
|
| 86 |
'MelBand Roformer | Instrumental Fullness V2 by Gabox' : 'mel_band_roformer_instrumental_fullness_v2_gabox.ckpt',
|
| 87 |
'MelBand Roformer | Instrumental Fullness V3 by Gabox' : 'mel_band_roformer_instrumental_fullness_v3_gabox.ckpt',
|
|
|
|
| 91 |
'MelBand Roformer | INSTV6 by Gabox' : 'mel_band_roformer_instrumental_instv6_gabox.ckpt',
|
| 92 |
'MelBand Roformer | INSTV6N by Gabox' : 'mel_band_roformer_instrumental_instv6n_gabox.ckpt',
|
| 93 |
'MelBand Roformer | INSTV7 by Gabox' : 'mel_band_roformer_instrumental_instv7_gabox.ckpt',
|
| 94 |
+
'MelBand Roformer | INSTV7N by Gabox' : 'mel_band_roformer_instrumental_instv7n_gabox.ckpt',
|
| 95 |
+
'MelBand Roformer | INSTV8 by Gabox' : 'mel_band_roformer_instrumental_instv8_gabox.ckpt',
|
| 96 |
+
'MelBand Roformer | INSTV8N by Gabox' : 'mel_band_roformer_instrumental_instv8n_gabox.ckpt',
|
| 97 |
+
'MelBand Roformer | FVX by Gabox' : 'mel_band_roformer_instrumental_fvx_gabox.ckpt',
|
| 98 |
'MelBand Roformer | De-Reverb by anvuew' : 'dereverb_mel_band_roformer_anvuew_sdr_19.1729.ckpt',
|
| 99 |
'MelBand Roformer | De-Reverb Less Aggressive by anvuew' : 'dereverb_mel_band_roformer_less_aggressive_anvuew_sdr_18.8050.ckpt',
|
| 100 |
'MelBand Roformer | De-Reverb Mono by anvuew' : 'dereverb_mel_band_roformer_mono_anvuew.ckpt',
|
|
|
|
| 111 |
'MelBand Roformer Kim | Big Beta 4 FT by unwa' : 'melband_roformer_big_beta4.ckpt',
|
| 112 |
'MelBand Roformer Kim | Big Beta 5e FT by unwa' : 'melband_roformer_big_beta5e.ckpt',
|
| 113 |
'MelBand Roformer | Big Beta 6 by unwa' : 'melband_roformer_big_beta6.ckpt',
|
| 114 |
+
'MelBand Roformer | Big Beta 6X by unwa' : 'melband_roformer_big_beta6x.ckpt',
|
| 115 |
'BS Roformer | Chorus Male-Female by Sucial' : 'model_chorus_bs_roformer_ep_267_sdr_24.1275.ckpt',
|
| 116 |
'BS Roformer | Male-Female by aufr33' : 'bs_roformer_male_female_by_aufr33_sdr_7.2889.ckpt',
|
| 117 |
'MelBand Roformer | Aspiration by Sucial' : 'aspiration_mel_band_roformer_sdr_18.9845.ckpt',
|
|
|
|
| 283 |
|
| 284 |
def leaderboard(list_filter):
|
| 285 |
try:
|
| 286 |
+
if python_location:
|
| 287 |
+
command = [python_location, separator_location, "-l", f"--list_filter={list_filter}"]
|
| 288 |
+
else:
|
| 289 |
+
command = [separator_location, "-l", f"--list_filter={list_filter}"]
|
| 290 |
+
|
| 291 |
result = subprocess.run(
|
| 292 |
+
command,
|
| 293 |
capture_output=True,
|
| 294 |
text=True,
|
| 295 |
)
|
| 296 |
if result.returncode != 0:
|
| 297 |
return f"Error: {result.stderr}"
|
| 298 |
+
|
| 299 |
return "<table border='1'>" + "".join(
|
| 300 |
+
f"<tr style='{'font-weight: bold; font-size: 1.2em;' if i == 0 else ''}'>" +
|
| 301 |
+
"".join(f"<td>{cell}</td>" for cell in re.split(r"\s{2,}", line.strip())) +
|
| 302 |
+
"</tr>"
|
| 303 |
for i, line in enumerate(re.findall(r"^(?!-+)(.+)$", result.stdout.strip(), re.MULTILINE))
|
| 304 |
) + "</table>"
|
| 305 |
+
|
| 306 |
except Exception as e:
|
| 307 |
return f"Error: {e}"
|
| 308 |
+
|
| 309 |
+
def get_language_settings():
|
| 310 |
+
with open(config_file, "r", encoding="utf8") as file:
|
| 311 |
+
config = json.load(file)
|
| 312 |
+
|
| 313 |
+
if config["lang"]["override"] == False:
|
| 314 |
+
return "Language automatically detected by system"
|
| 315 |
+
else:
|
| 316 |
+
return config["lang"]["selected_lang"]
|
| 317 |
+
|
| 318 |
+
def save_lang_settings(selected_language):
|
| 319 |
+
with open(config_file, "r", encoding="utf8") as file:
|
| 320 |
+
config = json.load(file)
|
| 321 |
+
|
| 322 |
+
if selected_language == "Language automatically detected by system":
|
| 323 |
+
config["lang"]["override"] = False
|
| 324 |
+
else:
|
| 325 |
+
config["lang"]["override"] = True
|
| 326 |
+
config["lang"]["selected_lang"] = selected_language
|
| 327 |
+
|
| 328 |
+
gr.Info(i18n("Language have been saved. Restart UVR5 UI to apply the changes"))
|
| 329 |
+
|
| 330 |
+
with open(config_file, "w", encoding="utf8") as file:
|
| 331 |
+
json.dump(config, file, indent=2)
|
| 332 |
+
|
| 333 |
+
def alternative_model_downloader(method, key, output_dir="models", progress=gr.Progress()):
|
| 334 |
+
logs.clear()
|
| 335 |
+
|
| 336 |
+
with open(models_file, 'r', encoding='utf-8') as file:
|
| 337 |
+
model_data = json.load(file)
|
| 338 |
+
|
| 339 |
+
if key not in model_data:
|
| 340 |
+
return f"Model '{key}' cannot be found."
|
| 341 |
+
|
| 342 |
+
total_files = len(model_data[key])
|
| 343 |
+
progress(0, desc="Starting downloads...")
|
| 344 |
+
|
| 345 |
+
for i, url in enumerate(model_data[key]):
|
| 346 |
+
filename = os.path.basename(urllib.parse.urlparse(url).path)
|
| 347 |
+
full_name = os.path.join(output_dir, filename)
|
| 348 |
+
|
| 349 |
+
if os.path.exists(full_name):
|
| 350 |
+
logs.append(f"{filename} already exists.")
|
| 351 |
+
continue
|
| 352 |
+
|
| 353 |
+
progress((i + 0.1) / total_files, desc=f"Starting download of {filename} ({i+1}/{total_files})")
|
| 354 |
+
|
| 355 |
+
if method == 'wget':
|
| 356 |
+
cmd = ['wget', '--progress=bar:force', '-O', full_name, url]
|
| 357 |
+
elif method == 'curl':
|
| 358 |
+
cmd = ['curl', '-L', '-#', '-o', full_name, url]
|
| 359 |
+
|
| 360 |
+
try:
|
| 361 |
+
process = subprocess.Popen(
|
| 362 |
+
cmd,
|
| 363 |
+
stdout=subprocess.PIPE,
|
| 364 |
+
stderr=subprocess.PIPE,
|
| 365 |
+
universal_newlines=True,
|
| 366 |
+
bufsize=1
|
| 367 |
+
)
|
| 368 |
+
|
| 369 |
+
for line in process.stderr:
|
| 370 |
+
if method == 'wget' and '%' in line:
|
| 371 |
+
try:
|
| 372 |
+
percent = int(line.strip().split('%')[0].split()[-1])
|
| 373 |
+
file_progress = percent / 100.0
|
| 374 |
+
total_progress = (i + file_progress) / total_files
|
| 375 |
+
progress(total_progress, desc=f"File {i+1}/{total_files}: {filename} ({percent}%)")
|
| 376 |
+
except (ValueError, IndexError):
|
| 377 |
+
pass
|
| 378 |
+
elif method == 'curl' and '##' in line:
|
| 379 |
+
try:
|
| 380 |
+
hash_count = line.count('#')
|
| 381 |
+
file_progress = min(hash_count / 50.0, 1.0)
|
| 382 |
+
total_progress = (i + file_progress) / total_files
|
| 383 |
+
percent = int(file_progress * 100)
|
| 384 |
+
progress(total_progress, desc=f"File {i+1}/{total_files}: {filename} ({percent}%)")
|
| 385 |
+
except Exception:
|
| 386 |
+
pass
|
| 387 |
+
|
| 388 |
+
process.wait()
|
| 389 |
+
if process.returncode != 0:
|
| 390 |
+
logs.append(f"Error downloading {filename}")
|
| 391 |
+
else:
|
| 392 |
+
logs.append(f"{filename} downloaded successfully!")
|
| 393 |
+
progress((i + 1) / total_files, desc=f"File {i+1}/{total_files} completed")
|
| 394 |
+
|
| 395 |
+
except Exception as e:
|
| 396 |
+
logs.append(f"Error running download command: {str(e)}")
|
| 397 |
+
|
| 398 |
+
progress(1.0, desc="Download process completed")
|
| 399 |
+
return "\n".join(logs)
|
| 400 |
+
|
| 401 |
+
def read_main_config():
|
| 402 |
+
try:
|
| 403 |
+
with open(config_file, "r", encoding="utf8") as f:
|
| 404 |
+
return json.load(f)
|
| 405 |
+
except Exception as e:
|
| 406 |
+
print(f"Error reading main config file '{config_file}': {e}")
|
| 407 |
+
gr.Warning(i18n("Error reading main config file"))
|
| 408 |
+
|
| 409 |
+
def write_main_config(data):
|
| 410 |
+
try:
|
| 411 |
+
with open(config_file, "w", encoding="utf8") as f:
|
| 412 |
+
json.dump(data, f, indent=2)
|
| 413 |
+
except Exception as e:
|
| 414 |
+
print(f"Error writing to main config file '{config_file}': {e}")
|
| 415 |
+
gr.Warning(i18n("Error writing to main config file"))
|
| 416 |
+
|
| 417 |
+
def load_settings_from_file(filepath):
|
| 418 |
+
try:
|
| 419 |
+
with open(filepath, 'r', encoding='utf-8') as f:
|
| 420 |
+
return json.load(f)
|
| 421 |
+
except Exception as e:
|
| 422 |
+
print(f"Error reading settings file '{filepath}': {e}")
|
| 423 |
+
gr.Warning(i18n("Error reading settings file"))
|
| 424 |
+
return None
|
| 425 |
+
|
| 426 |
+
def get_initial_settings():
|
| 427 |
+
main_config = read_main_config()
|
| 428 |
+
load_custom = main_config.get('load_custom_settings', False)
|
| 429 |
+
|
| 430 |
+
settings_to_load = {}
|
| 431 |
+
default_settings = load_settings_from_file(default_settings_file)
|
| 432 |
+
|
| 433 |
+
if load_custom:
|
| 434 |
+
print("Attempting to load custom settings...")
|
| 435 |
+
custom_settings = load_settings_from_file(custom_settings_file)
|
| 436 |
+
if custom_settings:
|
| 437 |
+
settings_to_load = copy.deepcopy(default_settings)
|
| 438 |
+
for section, params in custom_settings.items():
|
| 439 |
+
if section in settings_to_load:
|
| 440 |
+
for key, value in params.items():
|
| 441 |
+
settings_to_load[section][key] = value
|
| 442 |
+
else:
|
| 443 |
+
settings_to_load[section] = params
|
| 444 |
+
print("Custom settings loaded successfully.")
|
| 445 |
+
else:
|
| 446 |
+
print("Custom settings file not found or invalid. Falling back to default settings.")
|
| 447 |
+
settings_to_load = default_settings
|
| 448 |
+
else:
|
| 449 |
+
print("Loading default settings...")
|
| 450 |
+
settings_to_load = default_settings
|
| 451 |
+
|
| 452 |
+
return settings_to_load
|
| 453 |
+
|
| 454 |
+
initial_settings = get_initial_settings()
|
| 455 |
+
|
| 456 |
+
def get_all_components(components_dict):
|
| 457 |
+
all_comps = []
|
| 458 |
+
for section in components_dict.values():
|
| 459 |
+
all_comps.extend(section.values())
|
| 460 |
+
return all_comps
|
| 461 |
+
|
| 462 |
+
def save_current_settings(*values):
|
| 463 |
+
global components
|
| 464 |
+
try:
|
| 465 |
+
current_config_data = {}
|
| 466 |
+
value_index = 0
|
| 467 |
+
for section_name, section_comps in components.items():
|
| 468 |
+
current_config_data[section_name] = {}
|
| 469 |
+
for comp_name in section_comps.keys():
|
| 470 |
+
current_config_data[section_name][comp_name] = values[value_index]
|
| 471 |
+
value_index += 1
|
| 472 |
+
|
| 473 |
+
with open(custom_settings_file, 'w', encoding='utf-8') as f:
|
| 474 |
+
json.dump(current_config_data, f, indent=4)
|
| 475 |
+
|
| 476 |
+
main_config = read_main_config()
|
| 477 |
+
main_config['load_custom_settings'] = True
|
| 478 |
+
write_main_config(main_config)
|
| 479 |
+
gr.Info(i18n("Current settings saved successfully! They will be loaded next time"))
|
| 480 |
+
except Exception as e:
|
| 481 |
+
print(f"Error saving settings: {e}")
|
| 482 |
+
gr.Warning(i18n("Error saving settings"))
|
| 483 |
+
|
| 484 |
+
def reset_settings_to_default():
|
| 485 |
+
global components, default_settings_file
|
| 486 |
+
updates = []
|
| 487 |
+
all_comps_flat = get_all_components(components)
|
| 488 |
+
try:
|
| 489 |
+
default_settings = load_settings_from_file(default_settings_file)
|
| 490 |
+
for section_name, section_comps in components.items():
|
| 491 |
+
for comp_name, comp_instance in section_comps.items():
|
| 492 |
+
default_value = default_settings.get(section_name, {}).get(comp_name, None)
|
| 493 |
+
|
| 494 |
+
if isinstance(comp_instance, gr.Dropdown) and hasattr(comp_instance, 'choices') and default_value is not None:
|
| 495 |
+
if default_value not in comp_instance.choices:
|
| 496 |
+
print(f"Warning: Default value '{default_value}' for '{comp_name}' not in choices {comp_instance.choices}. Setting to None.")
|
| 497 |
+
default_value = None
|
| 498 |
+
|
| 499 |
+
updates.append(gr.update(value=default_value))
|
| 500 |
+
|
| 501 |
+
main_config = read_main_config()
|
| 502 |
+
main_config['load_custom_settings'] = False
|
| 503 |
+
write_main_config(main_config)
|
| 504 |
+
|
| 505 |
+
gr.Info(i18n("Settings reset to default. Default settings will be loaded next time"))
|
| 506 |
+
return updates
|
| 507 |
+
|
| 508 |
+
except Exception as e:
|
| 509 |
+
print(f"Error resetting settings: {e}")
|
| 510 |
+
gr.Warning(i18n("Error resetting settings"))
|
| 511 |
+
return [gr.update() for _ in all_comps_flat]
|
| 512 |
+
|
| 513 |
+
components = {
|
| 514 |
+
"Roformer": {}, "MDX23C": {}, "MDX-NET": {}, "VR Arch": {}, "Demucs": {}
|
| 515 |
+
}
|
| 516 |
|
| 517 |
@track_presence("Performing BS/Mel Roformer Separation")
|
| 518 |
@spaces.GPU(duration=60)
|
| 519 |
def roformer_separator(audio, model_key, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress(track_tqdm=True)):
|
|
|
|
| 520 |
roformer_model = roformer_models[model_key]
|
| 521 |
+
model_path = os.path.join(models_dir, roformer_model)
|
| 522 |
try:
|
| 523 |
+
if not os.path.exists(model_path):
|
| 524 |
+
gr.Info(f"This is the first time the {model_key} model is being used. The separation will take a little longer because the model needs to be downloaded.")
|
| 525 |
+
|
| 526 |
separator = Separator(
|
| 527 |
log_level=logging.WARNING,
|
| 528 |
model_file_dir=models_dir,
|
|
|
|
| 559 |
@track_presence("Performing MDXC Separationn")
|
| 560 |
@spaces.GPU(duration=60)
|
| 561 |
def mdxc_separator(audio, model, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress(track_tqdm=True)):
|
| 562 |
+
model_path = os.path.join(models_dir, model)
|
| 563 |
try:
|
| 564 |
+
if not os.path.exists(model_path):
|
| 565 |
+
gr.Info(f"This is the first time the {model} model is being used. The separation will take a little longer because the model needs to be downloaded.")
|
| 566 |
+
|
| 567 |
separator = Separator(
|
| 568 |
log_level=logging.WARNING,
|
| 569 |
model_file_dir=models_dir,
|
|
|
|
| 600 |
@track_presence("Performing MDX-NET Separation")
|
| 601 |
@spaces.GPU(duration=60)
|
| 602 |
def mdxnet_separator(audio, model, out_format, hop_length, segment_size, denoise, overlap, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress(track_tqdm=True)):
|
| 603 |
+
model_path = os.path.join(models_dir, model)
|
| 604 |
try:
|
| 605 |
+
if not os.path.exists(model_path):
|
| 606 |
+
gr.Info(f"This is the first time the {model} model is being used. The separation will take a little longer because the model needs to be downloaded.")
|
| 607 |
+
|
| 608 |
separator = Separator(
|
| 609 |
log_level=logging.WARNING,
|
| 610 |
model_file_dir=models_dir,
|
|
|
|
| 642 |
@track_presence("Performing VR Arch Separation")
|
| 643 |
@spaces.GPU(duration=60)
|
| 644 |
def vrarch_separator(audio, model, out_format, window_size, aggression, tta, post_process, post_process_threshold, high_end_process, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress(track_tqdm=True)):
|
| 645 |
+
model_path = os.path.join(models_dir, model)
|
| 646 |
try:
|
| 647 |
+
if not os.path.exists(model_path):
|
| 648 |
+
gr.Info(f"This is the first time the {model} model is being used. The separation will take a little longer because the model needs to be downloaded.")
|
| 649 |
+
|
| 650 |
separator = Separator(
|
| 651 |
log_level=logging.WARNING,
|
| 652 |
model_file_dir=models_dir,
|
|
|
|
| 686 |
@track_presence("Performing Demucs Separation")
|
| 687 |
@spaces.GPU(duration=60)
|
| 688 |
def demucs_separator(audio, model, out_format, shifts, segment_size, segments_enabled, overlap, batch_size, norm_thresh, amp_thresh, progress=gr.Progress(track_tqdm=True)):
|
| 689 |
+
model_path = os.path.join(models_dir, model)
|
| 690 |
try:
|
| 691 |
+
if not os.path.exists(model_path):
|
| 692 |
+
gr.Info(f"This is the first time the {model} model is being used. The separation will take a little longer because the model needs to be downloaded.")
|
| 693 |
+
|
| 694 |
separator = Separator(
|
| 695 |
log_level=logging.WARNING,
|
| 696 |
model_file_dir=models_dir,
|
|
|
|
| 732 |
|
| 733 |
@track_presence("Performing BS/Mel Roformer Batch Separation")
|
| 734 |
@spaces.GPU(duration=60)
|
| 735 |
+
def roformer_batch(path_input, path_output, model_key, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress()):
|
| 736 |
found_files.clear()
|
| 737 |
logs.clear()
|
| 738 |
roformer_model = roformer_models[model_key]
|
| 739 |
+
model_path = os.path.join(models_dir, roformer_model)
|
| 740 |
+
|
| 741 |
+
if not os.path.exists(model_path):
|
| 742 |
+
gr.Info(f"This is the first time the {model_key} model is being used. The separation will take a little longer because the model needs to be downloaded.")
|
| 743 |
|
| 744 |
for audio_files in os.listdir(path_input):
|
| 745 |
if audio_files.endswith(extensions):
|
|
|
|
| 748 |
|
| 749 |
if total_files == 0:
|
| 750 |
logs.append("No valid audio files.")
|
| 751 |
+
return "\n".join(logs)
|
| 752 |
else:
|
| 753 |
logs.append(f"{total_files} audio files found")
|
| 754 |
found_files.sort()
|
| 755 |
+
progress(0, desc="Starting processing...")
|
| 756 |
|
| 757 |
+
for i, audio_files in enumerate(found_files):
|
| 758 |
+
progress((i / total_files), desc=f"Processing file {i+1}/{total_files}")
|
| 759 |
file_path = os.path.join(path_input, audio_files)
|
|
|
|
| 760 |
try:
|
| 761 |
separator = Separator(
|
| 762 |
log_level=logging.WARNING,
|
|
|
|
| 776 |
)
|
| 777 |
|
| 778 |
logs.append("Loading model...")
|
|
|
|
| 779 |
separator.load_model(model_filename=roformer_model)
|
| 780 |
|
| 781 |
logs.append(f"Separating file: {audio_files}")
|
|
|
|
| 782 |
separator.separate(file_path)
|
| 783 |
logs.append(f"File: {audio_files} separated!")
|
|
|
|
| 784 |
except Exception as e:
|
| 785 |
+
raise RuntimeError(f"BS/Mel Roformer batch separation failed: {e}") from e
|
| 786 |
+
|
| 787 |
+
progress(1.0, desc="Processing complete")
|
| 788 |
+
return "\n".join(logs)
|
| 789 |
|
| 790 |
@track_presence("Performing MDXC Batch Separation")
|
| 791 |
@spaces.GPU(duration=60)
|
| 792 |
+
def mdx23c_batch(path_input, path_output, model, out_format, segment_size, override_seg_size, overlap, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress()):
|
| 793 |
found_files.clear()
|
| 794 |
logs.clear()
|
| 795 |
+
model_path = os.path.join(models_dir, model)
|
| 796 |
+
|
| 797 |
+
if not os.path.exists(model_path):
|
| 798 |
+
gr.Info(f"This is the first time the {model} model is being used. The separation will take a little longer because the model needs to be downloaded.")
|
| 799 |
|
| 800 |
for audio_files in os.listdir(path_input):
|
| 801 |
if audio_files.endswith(extensions):
|
|
|
|
| 804 |
|
| 805 |
if total_files == 0:
|
| 806 |
logs.append("No valid audio files.")
|
| 807 |
+
return "\n".join(logs)
|
| 808 |
else:
|
| 809 |
logs.append(f"{total_files} audio files found")
|
| 810 |
found_files.sort()
|
| 811 |
+
progress(0, desc="Starting processing...")
|
| 812 |
|
| 813 |
+
for i, audio_files in enumerate(found_files):
|
| 814 |
+
progress((i / total_files), desc=f"Processing file {i+1}/{total_files}")
|
| 815 |
file_path = os.path.join(path_input, audio_files)
|
|
|
|
| 816 |
try:
|
| 817 |
separator = Separator(
|
| 818 |
log_level=logging.WARNING,
|
|
|
|
| 832 |
)
|
| 833 |
|
| 834 |
logs.append("Loading model...")
|
|
|
|
| 835 |
separator.load_model(model_filename=model)
|
| 836 |
|
| 837 |
logs.append(f"Separating file: {audio_files}")
|
|
|
|
| 838 |
separator.separate(file_path)
|
| 839 |
logs.append(f"File: {audio_files} separated!")
|
|
|
|
| 840 |
except Exception as e:
|
| 841 |
+
raise RuntimeError(f"MDXC batch separation failed: {e}") from e
|
| 842 |
+
|
| 843 |
+
progress(1.0, desc="Processing complete")
|
| 844 |
+
return "\n".join(logs)
|
| 845 |
|
| 846 |
@track_presence("Performing MDX-NET Batch Separation")
|
| 847 |
@spaces.GPU(duration=60)
|
| 848 |
+
def mdxnet_batch(path_input, path_output, model, out_format, hop_length, segment_size, denoise, overlap, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress()):
|
| 849 |
found_files.clear()
|
| 850 |
logs.clear()
|
| 851 |
+
model_path = os.path.join(models_dir, model)
|
| 852 |
+
|
| 853 |
+
if not os.path.exists(model_path):
|
| 854 |
+
gr.Info(f"This is the first time the {model} model is being used. The separation will take a little longer because the model needs to be downloaded.")
|
| 855 |
|
| 856 |
for audio_files in os.listdir(path_input):
|
| 857 |
if audio_files.endswith(extensions):
|
|
|
|
| 860 |
|
| 861 |
if total_files == 0:
|
| 862 |
logs.append("No valid audio files.")
|
| 863 |
+
return "\n".join(logs)
|
| 864 |
else:
|
| 865 |
logs.append(f"{total_files} audio files found")
|
| 866 |
found_files.sort()
|
| 867 |
+
progress(0, desc="Starting processing...")
|
| 868 |
|
| 869 |
+
for i, audio_files in enumerate(found_files):
|
| 870 |
+
progress((i / total_files), desc=f"Processing file {i+1}/{total_files}")
|
| 871 |
file_path = os.path.join(path_input, audio_files)
|
|
|
|
| 872 |
try:
|
| 873 |
separator = Separator(
|
| 874 |
log_level=logging.WARNING,
|
|
|
|
| 889 |
)
|
| 890 |
|
| 891 |
logs.append("Loading model...")
|
|
|
|
| 892 |
separator.load_model(model_filename=model)
|
| 893 |
|
| 894 |
logs.append(f"Separating file: {audio_files}")
|
|
|
|
| 895 |
separator.separate(file_path)
|
| 896 |
logs.append(f"File: {audio_files} separated!")
|
|
|
|
| 897 |
except Exception as e:
|
| 898 |
+
raise RuntimeError(f"MDX-NET batch separation failed: {e}") from e
|
| 899 |
+
|
| 900 |
+
progress(1.0, desc="Processing complete")
|
| 901 |
+
return "\n".join(logs)
|
| 902 |
|
| 903 |
@track_presence("Performing VR Arch Batch Separation")
|
| 904 |
@spaces.GPU(duration=60)
|
| 905 |
+
def vrarch_batch(path_input, path_output, model, out_format, window_size, aggression, tta, post_process, post_process_threshold, high_end_process, batch_size, norm_thresh, amp_thresh, single_stem, progress=gr.Progress()):
|
| 906 |
found_files.clear()
|
| 907 |
logs.clear()
|
| 908 |
+
model_path = os.path.join(models_dir, model)
|
| 909 |
+
|
| 910 |
+
if not os.path.exists(model_path):
|
| 911 |
+
gr.Info(f"This is the first time the {model} model is being used. The separation will take a little longer because the model needs to be downloaded.")
|
| 912 |
|
| 913 |
for audio_files in os.listdir(path_input):
|
| 914 |
if audio_files.endswith(extensions):
|
|
|
|
| 917 |
|
| 918 |
if total_files == 0:
|
| 919 |
logs.append("No valid audio files.")
|
| 920 |
+
return "\n".join(logs)
|
| 921 |
else:
|
| 922 |
logs.append(f"{total_files} audio files found")
|
| 923 |
found_files.sort()
|
| 924 |
+
progress(0, desc="Starting processing...")
|
| 925 |
|
| 926 |
+
for i, audio_files in enumerate(found_files):
|
| 927 |
+
progress((i / total_files), desc=f"Processing file {i+1}/{total_files}")
|
| 928 |
file_path = os.path.join(path_input, audio_files)
|
|
|
|
| 929 |
try:
|
| 930 |
separator = Separator(
|
| 931 |
log_level=logging.WARNING,
|
|
|
|
| 948 |
)
|
| 949 |
|
| 950 |
logs.append("Loading model...")
|
|
|
|
| 951 |
separator.load_model(model_filename=model)
|
| 952 |
|
| 953 |
logs.append(f"Separating file: {audio_files}")
|
|
|
|
| 954 |
separator.separate(file_path)
|
| 955 |
logs.append(f"File: {audio_files} separated!")
|
|
|
|
| 956 |
except Exception as e:
|
| 957 |
+
raise RuntimeError(f"VR Arch batch separation failed: {e}") from e
|
| 958 |
+
|
| 959 |
+
progress(1.0, desc="Processing complete")
|
| 960 |
+
return "\n".join(logs)
|
| 961 |
|
| 962 |
@track_presence("Performing Demucs Batch Separation")
|
| 963 |
@spaces.GPU(duration=60)
|
| 964 |
+
def demucs_batch(path_input, path_output, model, out_format, shifts, segment_size, segments_enabled, overlap, batch_size, norm_thresh, amp_thresh, progress=gr.Progress()):
|
| 965 |
found_files.clear()
|
| 966 |
logs.clear()
|
| 967 |
+
model_path = os.path.join(models_dir, model)
|
| 968 |
+
|
| 969 |
+
if not os.path.exists(model_path):
|
| 970 |
+
gr.Info(f"This is the first time the {model} model is being used. The separation will take a little longer because the model needs to be downloaded.")
|
| 971 |
|
| 972 |
for audio_files in os.listdir(path_input):
|
| 973 |
if audio_files.endswith(extensions):
|
|
|
|
| 976 |
|
| 977 |
if total_files == 0:
|
| 978 |
logs.append("No valid audio files.")
|
| 979 |
+
return "\n".join(logs)
|
| 980 |
else:
|
| 981 |
logs.append(f"{total_files} audio files found")
|
| 982 |
found_files.sort()
|
| 983 |
+
progress(0, desc="Starting processing...")
|
| 984 |
|
| 985 |
+
for i, audio_files in enumerate(found_files):
|
| 986 |
+
progress((i / total_files), desc=f"Processing file {i+1}/{total_files}")
|
| 987 |
file_path = os.path.join(path_input, audio_files)
|
| 988 |
try:
|
| 989 |
separator = Separator(
|
|
|
|
| 1004 |
)
|
| 1005 |
|
| 1006 |
logs.append("Loading model...")
|
|
|
|
| 1007 |
separator.load_model(model_filename=model)
|
| 1008 |
|
| 1009 |
logs.append(f"Separating file: {audio_files}")
|
|
|
|
| 1010 |
separator.separate(file_path)
|
| 1011 |
logs.append(f"File: {audio_files} separated!")
|
|
|
|
| 1012 |
except Exception as e:
|
| 1013 |
+
raise RuntimeError(f"Demucs batch separation failed: {e}") from e
|
| 1014 |
+
|
| 1015 |
+
progress(1.0, desc="Processing complete")
|
| 1016 |
+
return "\n".join(logs)
|
| 1017 |
|
| 1018 |
with gr.Blocks(theme = loadThemes.load_json() or "NoCrypt/miku", title = "🎵 UVR5 UI 🎵") as app:
|
| 1019 |
gr.Markdown("<h1> 🎵 UVR5 UI 🎵 </h1>")
|
| 1020 |
gr.Markdown(i18n("If you liked this HF Space you can give me a ❤️"))
|
| 1021 |
gr.Markdown(i18n("Try UVR5 UI using Colab [here](https://colab.research.google.com/github/Eddycrack864/UVR5-UI/blob/main/UVR_UI.ipynb)"))
|
| 1022 |
+
all_configurable_inputs = []
|
| 1023 |
with gr.Tabs():
|
| 1024 |
with gr.TabItem("BS/Mel Roformer"):
|
| 1025 |
with gr.Row():
|
| 1026 |
roformer_model = gr.Dropdown(
|
| 1027 |
label = i18n("Select the model"),
|
| 1028 |
choices = list(roformer_models.keys()),
|
| 1029 |
+
value = initial_settings.get("Roformer", {}).get("model", None),
|
| 1030 |
interactive = True
|
| 1031 |
)
|
| 1032 |
roformer_output_format = gr.Dropdown(
|
| 1033 |
label = i18n("Select the output format"),
|
| 1034 |
choices = output_format,
|
| 1035 |
+
value = initial_settings.get("Roformer", {}).get("output_format", None),
|
| 1036 |
interactive = True
|
| 1037 |
)
|
| 1038 |
with gr.Accordion(i18n("Advanced settings"), open = False):
|
|
|
|
| 1044 |
minimum = 32,
|
| 1045 |
maximum = 4000,
|
| 1046 |
step = 32,
|
| 1047 |
+
value = initial_settings.get("Roformer", {}).get("segment_size", 256),
|
| 1048 |
interactive = True
|
| 1049 |
)
|
| 1050 |
roformer_override_segment_size = gr.Checkbox(
|
| 1051 |
label = i18n("Override segment size"),
|
| 1052 |
info = i18n("Override model default segment size instead of using the model default value"),
|
| 1053 |
+
value = initial_settings.get("Roformer", {}).get("override_segment_size", False),
|
| 1054 |
interactive = True
|
| 1055 |
)
|
| 1056 |
with gr.Row():
|
|
|
|
| 1060 |
minimum = 2,
|
| 1061 |
maximum = 10,
|
| 1062 |
step = 1,
|
| 1063 |
+
value = initial_settings.get("Roformer", {}).get("overlap", 8),
|
| 1064 |
interactive = True
|
| 1065 |
)
|
| 1066 |
roformer_batch_size = gr.Slider(
|
|
|
|
| 1069 |
minimum = 1,
|
| 1070 |
maximum = 16,
|
| 1071 |
step = 1,
|
| 1072 |
+
value = initial_settings.get("Roformer", {}).get("batch_size", 1),
|
| 1073 |
interactive = True
|
| 1074 |
)
|
| 1075 |
with gr.Row():
|
|
|
|
| 1079 |
minimum = 0.1,
|
| 1080 |
maximum = 1,
|
| 1081 |
step = 0.1,
|
| 1082 |
+
value = initial_settings.get("Roformer", {}).get("normalization_threshold", 0.9),
|
| 1083 |
interactive = True
|
| 1084 |
)
|
| 1085 |
roformer_amplification_threshold = gr.Slider(
|
|
|
|
| 1088 |
minimum = 0.1,
|
| 1089 |
maximum = 1,
|
| 1090 |
step = 0.1,
|
| 1091 |
+
value = initial_settings.get("Roformer", {}).get("amplification_threshold", 0.7),
|
| 1092 |
interactive = True
|
| 1093 |
)
|
| 1094 |
with gr.Row():
|
| 1095 |
roformer_single_stem = gr.Textbox(
|
| 1096 |
label = i18n("Output only single stem"),
|
| 1097 |
placeholder = i18n("Write the stem you want, check the stems of each model on Leaderboard. e.g. Instrumental"),
|
| 1098 |
+
value = initial_settings.get("Roformer", {}).get("single_stem", ""),
|
| 1099 |
interactive = True
|
| 1100 |
)
|
| 1101 |
+
|
| 1102 |
+
components["Roformer"] = {
|
| 1103 |
+
"model": roformer_model,
|
| 1104 |
+
"output_format": roformer_output_format,
|
| 1105 |
+
"segment_size": roformer_segment_size,
|
| 1106 |
+
"override_segment_size": roformer_override_segment_size,
|
| 1107 |
+
"overlap": roformer_overlap,
|
| 1108 |
+
"batch_size": roformer_batch_size,
|
| 1109 |
+
"normalization_threshold": roformer_normalization_threshold,
|
| 1110 |
+
"amplification_threshold": roformer_amplification_threshold,
|
| 1111 |
+
"single_stem": roformer_single_stem
|
| 1112 |
+
}
|
| 1113 |
+
all_configurable_inputs.extend(components["Roformer"].values())
|
| 1114 |
+
|
| 1115 |
with gr.Row():
|
| 1116 |
roformer_audio = gr.Audio(
|
| 1117 |
label = i18n("Input audio"),
|
|
|
|
| 1180 |
mdx23c_model = gr.Dropdown(
|
| 1181 |
label = i18n("Select the model"),
|
| 1182 |
choices = mdx23c_models,
|
| 1183 |
+
value = initial_settings.get("MDX23C", {}).get("model", None),
|
| 1184 |
interactive = True
|
| 1185 |
)
|
| 1186 |
mdx23c_output_format = gr.Dropdown(
|
| 1187 |
label = i18n("Select the output format"),
|
| 1188 |
choices = output_format,
|
| 1189 |
+
value = initial_settings.get("MDX23C", {}).get("output_format", None),
|
| 1190 |
interactive = True
|
| 1191 |
)
|
| 1192 |
with gr.Accordion(i18n("Advanced settings"), open = False):
|
|
|
|
| 1198 |
step = 32,
|
| 1199 |
label = i18n("Segment size"),
|
| 1200 |
info = i18n("Larger consumes more resources, but may give better results"),
|
| 1201 |
+
value = initial_settings.get("MDX23C", {}).get("segment_size", 256),
|
| 1202 |
interactive = True
|
| 1203 |
)
|
| 1204 |
mdx23c_override_segment_size = gr.Checkbox(
|
| 1205 |
label = i18n("Override segment size"),
|
| 1206 |
info = i18n("Override model default segment size instead of using the model default value"),
|
| 1207 |
+
value = initial_settings.get("MDX23C", {}).get("override_segment_size", False),
|
| 1208 |
interactive = True
|
| 1209 |
)
|
| 1210 |
with gr.Row():
|
|
|
|
| 1214 |
step = 1,
|
| 1215 |
label = i18n("Overlap"),
|
| 1216 |
info = i18n("Amount of overlap between prediction windows"),
|
| 1217 |
+
value = initial_settings.get("MDX23C", {}).get("overlap", 8),
|
| 1218 |
interactive = True
|
| 1219 |
)
|
| 1220 |
mdx23c_batch_size = gr.Slider(
|
|
|
|
| 1223 |
minimum = 1,
|
| 1224 |
maximum = 16,
|
| 1225 |
step = 1,
|
| 1226 |
+
value = initial_settings.get("MDX23C", {}).get("batch_size", 1),
|
| 1227 |
interactive = True
|
| 1228 |
)
|
| 1229 |
with gr.Row():
|
|
|
|
| 1233 |
minimum = 0.1,
|
| 1234 |
maximum = 1,
|
| 1235 |
step = 0.1,
|
| 1236 |
+
value = initial_settings.get("MDX23C", {}).get("normalization_threshold", 0.9),
|
| 1237 |
interactive = True
|
| 1238 |
)
|
| 1239 |
mdx23c_amplification_threshold = gr.Slider(
|
|
|
|
| 1242 |
minimum = 0.1,
|
| 1243 |
maximum = 1,
|
| 1244 |
step = 0.1,
|
| 1245 |
+
value = initial_settings.get("MDX23C", {}).get("amplification_threshold", 0.7),
|
| 1246 |
interactive = True
|
| 1247 |
)
|
| 1248 |
with gr.Row():
|
| 1249 |
mdx23c_single_stem = gr.Textbox(
|
| 1250 |
label = i18n("Output only single stem"),
|
| 1251 |
placeholder = i18n("Write the stem you want, check the stems of each model on Leaderboard. e.g. Instrumental"),
|
| 1252 |
+
value = initial_settings.get("MDX23C", {}).get("single_stem", ""),
|
| 1253 |
interactive = True
|
| 1254 |
)
|
| 1255 |
+
|
| 1256 |
+
components["MDX23C"] = {
|
| 1257 |
+
"model": mdx23c_model,
|
| 1258 |
+
"output_format": mdx23c_output_format,
|
| 1259 |
+
"segment_size": mdx23c_segment_size,
|
| 1260 |
+
"override_segment_size": mdx23c_override_segment_size,
|
| 1261 |
+
"overlap": mdx23c_overlap,
|
| 1262 |
+
"batch_size": mdx23c_batch_size,
|
| 1263 |
+
"normalization_threshold": mdx23c_normalization_threshold,
|
| 1264 |
+
"amplification_threshold": mdx23c_amplification_threshold,
|
| 1265 |
+
"single_stem": mdx23c_single_stem
|
| 1266 |
+
}
|
| 1267 |
+
all_configurable_inputs.extend(components["MDX23C"].values())
|
| 1268 |
+
|
| 1269 |
with gr.Row():
|
| 1270 |
mdx23c_audio = gr.Audio(
|
| 1271 |
label = i18n("Input audio"),
|
|
|
|
| 1334 |
mdxnet_model = gr.Dropdown(
|
| 1335 |
label = i18n("Select the model"),
|
| 1336 |
choices = mdxnet_models,
|
| 1337 |
+
value = initial_settings.get("MDX-NET", {}).get("model", None),
|
| 1338 |
interactive = True
|
| 1339 |
)
|
| 1340 |
mdxnet_output_format = gr.Dropdown(
|
| 1341 |
label = i18n("Select the output format"),
|
| 1342 |
choices = output_format,
|
| 1343 |
+
value = initial_settings.get("MDX-NET", {}).get("output_format", None),
|
| 1344 |
interactive = True
|
| 1345 |
)
|
| 1346 |
with gr.Accordion(i18n("Advanced settings"), open = False):
|
|
|
|
| 1352 |
minimum = 32,
|
| 1353 |
maximum = 2048,
|
| 1354 |
step = 32,
|
| 1355 |
+
value = initial_settings.get("MDX-NET", {}).get("hop_length", 1024),
|
| 1356 |
interactive = True
|
| 1357 |
)
|
| 1358 |
mdxnet_segment_size = gr.Slider(
|
|
|
|
| 1361 |
step = 32,
|
| 1362 |
label = i18n("Segment size"),
|
| 1363 |
info = i18n("Larger consumes more resources, but may give better results"),
|
| 1364 |
+
value = initial_settings.get("MDX-NET", {}).get("segment_size", 256),
|
| 1365 |
interactive = True
|
| 1366 |
)
|
| 1367 |
mdxnet_denoise = gr.Checkbox(
|
| 1368 |
label = i18n("Denoise"),
|
| 1369 |
info = i18n("Enable denoising during separation"),
|
| 1370 |
+
value = initial_settings.get("MDX-NET", {}).get("denoise", True),
|
| 1371 |
interactive = True
|
| 1372 |
)
|
| 1373 |
with gr.Row():
|
|
|
|
| 1377 |
minimum = 0.001,
|
| 1378 |
maximum = 0.999,
|
| 1379 |
step = 0.001,
|
| 1380 |
+
value = initial_settings.get("MDX-NET", {}).get("overlap", 0.25),
|
| 1381 |
interactive = True
|
| 1382 |
)
|
| 1383 |
mdxnet_batch_size = gr.Slider(
|
|
|
|
| 1386 |
minimum = 1,
|
| 1387 |
maximum = 16,
|
| 1388 |
step = 1,
|
| 1389 |
+
value = initial_settings.get("MDX-NET", {}).get("batch_size", 1),
|
| 1390 |
interactive = True
|
| 1391 |
)
|
| 1392 |
with gr.Row():
|
|
|
|
| 1396 |
minimum = 0.1,
|
| 1397 |
maximum = 1,
|
| 1398 |
step = 0.1,
|
| 1399 |
+
value = initial_settings.get("MDX-NET", {}).get("normalization_threshold", 0.9),
|
| 1400 |
interactive = True
|
| 1401 |
)
|
| 1402 |
mdxnet_amplification_threshold = gr.Slider(
|
|
|
|
| 1405 |
minimum = 0.1,
|
| 1406 |
maximum = 1,
|
| 1407 |
step = 0.1,
|
| 1408 |
+
value = initial_settings.get("MDX-NET", {}).get("amplification_threshold", 0.7),
|
| 1409 |
interactive = True
|
| 1410 |
)
|
| 1411 |
with gr.Row():
|
| 1412 |
mdxnet_single_stem = gr.Textbox(
|
| 1413 |
label = i18n("Output only single stem"),
|
| 1414 |
placeholder = i18n("Write the stem you want, check the stems of each model on Leaderboard. e.g. Instrumental"),
|
| 1415 |
+
value = initial_settings.get("MDX-NET", {}).get("single_stem", ""),
|
| 1416 |
interactive = True
|
| 1417 |
)
|
| 1418 |
+
|
| 1419 |
+
components["MDX-NET"] = {
|
| 1420 |
+
"model": mdxnet_model,
|
| 1421 |
+
"output_format": mdxnet_output_format,
|
| 1422 |
+
"hop_length": mdxnet_hop_length,
|
| 1423 |
+
"segment_size": mdxnet_segment_size,
|
| 1424 |
+
"denoise": mdxnet_denoise,
|
| 1425 |
+
"overlap": mdxnet_overlap,
|
| 1426 |
+
"batch_size": mdxnet_batch_size,
|
| 1427 |
+
"normalization_threshold": mdxnet_normalization_threshold,
|
| 1428 |
+
"amplification_threshold": mdxnet_amplification_threshold,
|
| 1429 |
+
"single_stem": mdxnet_single_stem
|
| 1430 |
+
}
|
| 1431 |
+
all_configurable_inputs.extend(components["MDX-NET"].values())
|
| 1432 |
+
|
| 1433 |
with gr.Row():
|
| 1434 |
mdxnet_audio = gr.Audio(
|
| 1435 |
label = i18n("Input audio"),
|
|
|
|
| 1498 |
vrarch_model = gr.Dropdown(
|
| 1499 |
label = i18n("Select the model"),
|
| 1500 |
choices = vrarch_models,
|
| 1501 |
+
value = initial_settings.get("VR Arch", {}).get("model", None),
|
| 1502 |
interactive = True
|
| 1503 |
)
|
| 1504 |
vrarch_output_format = gr.Dropdown(
|
| 1505 |
label = i18n("Select the output format"),
|
| 1506 |
choices = output_format,
|
| 1507 |
+
value = initial_settings.get("VR Arch", {}).get("output_format", None),
|
| 1508 |
interactive = True
|
| 1509 |
)
|
| 1510 |
with gr.Accordion(i18n("Advanced settings"), open = False):
|
|
|
|
| 1516 |
minimum=320,
|
| 1517 |
maximum=1024,
|
| 1518 |
step=32,
|
| 1519 |
+
value = initial_settings.get("VR Arch", {}).get("window_size", 512),
|
| 1520 |
interactive = True
|
| 1521 |
)
|
| 1522 |
vrarch_agression = gr.Slider(
|
|
|
|
| 1525 |
step = 1,
|
| 1526 |
label = i18n("Agression"),
|
| 1527 |
info = i18n("Intensity of primary stem extraction"),
|
| 1528 |
+
value = initial_settings.get("VR Arch", {}).get("aggression", 5),
|
| 1529 |
interactive = True
|
| 1530 |
)
|
| 1531 |
vrarch_tta = gr.Checkbox(
|
| 1532 |
label = i18n("TTA"),
|
| 1533 |
info = i18n("Enable Test-Time-Augmentation; slow but improves quality"),
|
| 1534 |
+
value = initial_settings.get("VR Arch", {}).get("tta", True),
|
| 1535 |
visible = True,
|
| 1536 |
interactive = True
|
| 1537 |
)
|
|
|
|
| 1539 |
vrarch_post_process = gr.Checkbox(
|
| 1540 |
label = i18n("Post process"),
|
| 1541 |
info = i18n("Identify leftover artifacts within vocal output; may improve separation for some songs"),
|
| 1542 |
+
value = initial_settings.get("VR Arch", {}).get("post_process", False),
|
| 1543 |
visible = True,
|
| 1544 |
interactive = True
|
| 1545 |
)
|
|
|
|
| 1549 |
minimum = 0.1,
|
| 1550 |
maximum = 0.3,
|
| 1551 |
step = 0.1,
|
| 1552 |
+
value = initial_settings.get("VR Arch", {}).get("post_process_threshold", 0.2),
|
| 1553 |
interactive = True
|
| 1554 |
)
|
| 1555 |
with gr.Row():
|
| 1556 |
vrarch_high_end_process = gr.Checkbox(
|
| 1557 |
label = i18n("High end process"),
|
| 1558 |
info = i18n("Mirror the missing frequency range of the output"),
|
| 1559 |
+
value = initial_settings.get("VR Arch", {}).get("high_end_process", False),
|
| 1560 |
visible = True,
|
| 1561 |
interactive = True,
|
| 1562 |
)
|
|
|
|
| 1566 |
minimum = 1,
|
| 1567 |
maximum = 16,
|
| 1568 |
step = 1,
|
| 1569 |
+
value = initial_settings.get("VR Arch", {}).get("batch_size", 1),
|
| 1570 |
interactive = True
|
| 1571 |
)
|
| 1572 |
with gr.Row():
|
|
|
|
| 1576 |
minimum = 0.1,
|
| 1577 |
maximum = 1,
|
| 1578 |
step = 0.1,
|
| 1579 |
+
value = initial_settings.get("VR Arch", {}).get("normalization_threshold", 0.9),
|
| 1580 |
interactive = True
|
| 1581 |
)
|
| 1582 |
vrarch_amplification_threshold = gr.Slider(
|
|
|
|
| 1585 |
minimum = 0.1,
|
| 1586 |
maximum = 1,
|
| 1587 |
step = 0.1,
|
| 1588 |
+
value = initial_settings.get("VR Arch", {}).get("amplification_threshold", 0.7),
|
| 1589 |
interactive = True
|
| 1590 |
)
|
| 1591 |
with gr.Row():
|
| 1592 |
vrarch_single_stem = gr.Textbox(
|
| 1593 |
label = i18n("Output only single stem"),
|
| 1594 |
placeholder = i18n("Write the stem you want, check the stems of each model on Leaderboard. e.g. Instrumental"),
|
| 1595 |
+
value = initial_settings.get("VR Arch", {}).get("single_stem", ""),
|
| 1596 |
interactive = True
|
| 1597 |
)
|
| 1598 |
+
|
| 1599 |
+
components["VR Arch"] = {
|
| 1600 |
+
"model": vrarch_model,
|
| 1601 |
+
"output_format": vrarch_output_format,
|
| 1602 |
+
"window_size": vrarch_window_size,
|
| 1603 |
+
"aggression": vrarch_agression,
|
| 1604 |
+
"tta": vrarch_tta,
|
| 1605 |
+
"post_process": vrarch_post_process,
|
| 1606 |
+
"post_process_threshold": vrarch_post_process_threshold,
|
| 1607 |
+
"high_end_process": vrarch_high_end_process,
|
| 1608 |
+
"batch_size": vrarch_batch_size,
|
| 1609 |
+
"normalization_threshold": vrarch_normalization_threshold,
|
| 1610 |
+
"amplification_threshold": vrarch_amplification_threshold,
|
| 1611 |
+
"single_stem": vrarch_single_stem
|
| 1612 |
+
}
|
| 1613 |
+
all_configurable_inputs.extend(components["VR Arch"].values())
|
| 1614 |
+
|
| 1615 |
with gr.Row():
|
| 1616 |
vrarch_audio = gr.Audio(
|
| 1617 |
label = i18n("Input audio"),
|
|
|
|
| 1680 |
demucs_model = gr.Dropdown(
|
| 1681 |
label = i18n("Select the model"),
|
| 1682 |
choices = demucs_models,
|
| 1683 |
+
value = initial_settings.get("Demucs", {}).get("model", None),
|
| 1684 |
interactive = True
|
| 1685 |
)
|
| 1686 |
demucs_output_format = gr.Dropdown(
|
| 1687 |
label = i18n("Select the output format"),
|
| 1688 |
choices = output_format,
|
| 1689 |
+
value = initial_settings.get("Demucs", {}).get("output_format", None),
|
| 1690 |
interactive = True
|
| 1691 |
)
|
| 1692 |
with gr.Accordion(i18n("Advanced settings"), open = False):
|
|
|
|
| 1698 |
minimum = 1,
|
| 1699 |
maximum = 20,
|
| 1700 |
step = 1,
|
| 1701 |
+
value = initial_settings.get("Demucs", {}).get("shifts", 2),
|
| 1702 |
interactive = True
|
| 1703 |
)
|
| 1704 |
demucs_segment_size = gr.Slider(
|
|
|
|
| 1707 |
minimum = 1,
|
| 1708 |
maximum = 100,
|
| 1709 |
step = 1,
|
| 1710 |
+
value = initial_settings.get("Demucs", {}).get("segment_size", 40),
|
| 1711 |
interactive = True
|
| 1712 |
)
|
| 1713 |
demucs_segments_enabled = gr.Checkbox(
|
| 1714 |
label = i18n("Segment-wise processing"),
|
| 1715 |
info = i18n("Enable segment-wise processing"),
|
| 1716 |
+
value = initial_settings.get("Demucs", {}).get("segments_enabled", True),
|
| 1717 |
interactive = True
|
| 1718 |
)
|
| 1719 |
with gr.Row():
|
|
|
|
| 1723 |
minimum=0.001,
|
| 1724 |
maximum=0.999,
|
| 1725 |
step=0.001,
|
| 1726 |
+
value = initial_settings.get("Demucs", {}).get("overlap", 0.25),
|
| 1727 |
interactive = True
|
| 1728 |
)
|
| 1729 |
demucs_batch_size = gr.Slider(
|
|
|
|
| 1732 |
minimum = 1,
|
| 1733 |
maximum = 16,
|
| 1734 |
step = 1,
|
| 1735 |
+
value = initial_settings.get("Demucs", {}).get("batch_size", 1),
|
| 1736 |
interactive = True
|
| 1737 |
)
|
| 1738 |
with gr.Row():
|
|
|
|
| 1742 |
minimum = 0.1,
|
| 1743 |
maximum = 1,
|
| 1744 |
step = 0.1,
|
| 1745 |
+
value = initial_settings.get("Demucs", {}).get("normalization_threshold", 0.9),
|
| 1746 |
interactive = True
|
| 1747 |
)
|
| 1748 |
demucs_amplification_threshold = gr.Slider(
|
|
|
|
| 1751 |
minimum = 0.1,
|
| 1752 |
maximum = 1,
|
| 1753 |
step = 0.1,
|
| 1754 |
+
value = initial_settings.get("Demucs", {}).get("amplification_threshold", 0.7),
|
| 1755 |
interactive = True
|
| 1756 |
)
|
| 1757 |
+
|
| 1758 |
+
components["Demucs"] = {
|
| 1759 |
+
"model": demucs_model,
|
| 1760 |
+
"output_format": demucs_output_format,
|
| 1761 |
+
"shifts": demucs_shifts,
|
| 1762 |
+
"segment_size": demucs_segment_size,
|
| 1763 |
+
"segments_enabled": demucs_segments_enabled,
|
| 1764 |
+
"overlap": demucs_overlap,
|
| 1765 |
+
"batch_size": demucs_batch_size,
|
| 1766 |
+
"normalization_threshold": demucs_normalization_threshold,
|
| 1767 |
+
"amplification_threshold": demucs_amplification_threshold
|
| 1768 |
+
}
|
| 1769 |
+
all_configurable_inputs.extend(components["Demucs"].values())
|
| 1770 |
+
|
| 1771 |
with gr.Row():
|
| 1772 |
demucs_audio = gr.Audio(
|
| 1773 |
label = i18n("Input audio"),
|
|
|
|
| 1879 |
info = i18n("Select the theme you want to use. (Requires restarting the App)"),
|
| 1880 |
choices = loadThemes.get_list(),
|
| 1881 |
value = loadThemes.read_json(),
|
| 1882 |
+
interactive = True
|
| 1883 |
)
|
|
|
|
| 1884 |
|
| 1885 |
themes_select.change(
|
| 1886 |
fn = loadThemes.select_theme,
|
| 1887 |
inputs = themes_select,
|
| 1888 |
+
outputs = []
|
| 1889 |
)
|
| 1890 |
|
| 1891 |
with gr.TabItem(i18n("Credits")):
|
|
|
|
| 1897 |
* Thanks to [Mikus](https://github.com/cappuch) for the help with the code.
|
| 1898 |
* Thanks to [Nick088](https://huggingface.co/Nick088) for the help to fix roformers.
|
| 1899 |
* Thanks to [yt_dlp](https://github.com/yt-dlp/yt-dlp) devs.
|
| 1900 |
+
* Separation by link source code and improvements by [NeoDev](https://github.com/TheNeodev).
|
| 1901 |
* Thanks to [ArisDev](https://github.com/aris-py) for porting UVR5 UI to Kaggle and improvements.
|
| 1902 |
* Thanks to [Bebra777228](https://github.com/Bebra777228)'s code for guiding me to improve my code.
|
| 1903 |
* Thanks to Nick088, MrM0dZ, Ryouko-Yamanda65777, lucinamari, perariroswe, Enes, Léo and the_undead0 for helping translate UVR5 UI.
|
| 1904 |
* Thanks to vadigr123 for creating the images for the Discord Rich Presence.
|
| 1905 |
|
| 1906 |
+
You can donate to the original UVR5 project here:
|
| 1907 |
+
[](https://www.buymeacoffee.com/uvr5)
|
| 1908 |
"""
|
| 1909 |
)
|
| 1910 |
|