Delete main
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- main/app/app.py +0 -190
- main/app/core/csrt.py +0 -122
- main/app/core/downloads.py +0 -351
- main/app/core/editing.py +0 -310
- main/app/core/f0_extract.py +0 -86
- main/app/core/inference.py +0 -1248
- main/app/core/model_utils.py +0 -301
- main/app/core/presets.py +0 -744
- main/app/core/process.py +0 -192
- main/app/core/realtime.py +0 -1142
- main/app/core/restart.py +0 -43
- main/app/core/separate.py +0 -96
- main/app/core/training.py +0 -590
- main/app/core/tts.py +0 -203
- main/app/core/ui.py +0 -814
- main/app/core/utils.py +0 -123
- main/app/install.py +0 -205
- main/app/parser.py +0 -407
- main/app/run_tensorboard.py +0 -39
- main/app/tabs/downloads/downloads.py +0 -330
- main/app/tabs/editing/child/audio_effects.py +0 -1165
- main/app/tabs/editing/child/quirk.py +0 -130
- main/app/tabs/editing/editing.py +0 -27
- main/app/tabs/extra/child/analyzer.py +0 -94
- main/app/tabs/extra/child/convert_model_onnx.py +0 -93
- main/app/tabs/extra/child/convert_model_svc.py +0 -128
- main/app/tabs/extra/child/create_srt.py +0 -145
- main/app/tabs/extra/child/f0_extract.py +0 -225
- main/app/tabs/extra/child/fushion.py +0 -132
- main/app/tabs/extra/child/read_model.py +0 -83
- main/app/tabs/extra/child/settings.py +0 -217
- main/app/tabs/extra/extra.py +0 -62
- main/app/tabs/inference/child/convert.py +0 -1142
- main/app/tabs/inference/child/convert_tts.py +0 -979
- main/app/tabs/inference/child/convert_with_vad.py +0 -810
- main/app/tabs/inference/child/separate.py +0 -600
- main/app/tabs/inference/inference.py +0 -41
- main/app/tabs/realtime/realtime.py +0 -0
- main/app/tabs/training/child/create_dataset.py +0 -519
- main/app/tabs/training/child/create_reference.py +0 -390
- main/app/tabs/training/child/training.py +0 -1020
- main/app/tabs/training/training.py +0 -34
- main/app/variables.py +0 -345
- main/configs/config.json +0 -741
- main/configs/config.py +0 -192
- main/configs/rpc.py +0 -81
- main/configs/v1/24000.json +0 -42
- main/configs/v1/32000.json +0 -42
- main/configs/v1/40000.json +0 -42
- main/configs/v1/44100.json +0 -42
main/app/app.py
DELETED
|
@@ -1,190 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import io
|
| 3 |
-
import ssl
|
| 4 |
-
import sys
|
| 5 |
-
import time
|
| 6 |
-
import codecs
|
| 7 |
-
import logging
|
| 8 |
-
import warnings
|
| 9 |
-
|
| 10 |
-
import gradio as gr
|
| 11 |
-
|
| 12 |
-
sys.path.append(os.getcwd())
|
| 13 |
-
start_time = time.time()
|
| 14 |
-
|
| 15 |
-
from main.app.variables import logger, config, translations, theme, font, configs, language, allow_disk, gradio_version
|
| 16 |
-
|
| 17 |
-
from main.app.core.realtime import js_code
|
| 18 |
-
from main.app.tabs.extra.extra import extra_tab
|
| 19 |
-
from main.app.tabs.editing.editing import editing_tab
|
| 20 |
-
from main.app.tabs.training.training import training_tab
|
| 21 |
-
from main.app.tabs.realtime.realtime import realtime_tab
|
| 22 |
-
from main.app.tabs.downloads.downloads import download_tab
|
| 23 |
-
from main.app.tabs.inference.inference import inference_tab
|
| 24 |
-
from main.configs.rpc import connect_discord_ipc, send_discord_rpc
|
| 25 |
-
|
| 26 |
-
ssl._create_default_https_context = ssl._create_unverified_context
|
| 27 |
-
|
| 28 |
-
if not config.debug_mode:
|
| 29 |
-
warnings.filterwarnings("ignore")
|
| 30 |
-
for l in ["httpx", "gradio", "uvicorn", "httpcore", "urllib3"]:
|
| 31 |
-
logging.getLogger(l).setLevel(logging.ERROR)
|
| 32 |
-
|
| 33 |
-
if sys.platform == "win32":
|
| 34 |
-
import asyncio.proactor_events as _pe
|
| 35 |
-
|
| 36 |
-
_orig_ccl = _pe._ProactorBasePipeTransport._call_connection_lost
|
| 37 |
-
|
| 38 |
-
def _ccl_patched(self, exc):
|
| 39 |
-
try:
|
| 40 |
-
_orig_ccl(self, exc)
|
| 41 |
-
except ConnectionResetError:
|
| 42 |
-
pass
|
| 43 |
-
|
| 44 |
-
_pe._ProactorBasePipeTransport._call_connection_lost = _ccl_patched
|
| 45 |
-
|
| 46 |
-
css = """
|
| 47 |
-
<style>
|
| 48 |
-
@import url('{font_urls}');
|
| 49 |
-
|
| 50 |
-
* {{
|
| 51 |
-
font-family: '{fonts}', cursive !important;
|
| 52 |
-
}}
|
| 53 |
-
|
| 54 |
-
html,
|
| 55 |
-
body {{
|
| 56 |
-
font-family: '{fonts}', cursive !important;
|
| 57 |
-
}}
|
| 58 |
-
|
| 59 |
-
h1, h2, h3, h4, h5, h6,
|
| 60 |
-
p,
|
| 61 |
-
button,
|
| 62 |
-
input,
|
| 63 |
-
textarea,
|
| 64 |
-
label,
|
| 65 |
-
span,
|
| 66 |
-
div,
|
| 67 |
-
select {{
|
| 68 |
-
font-family: '{fonts}', cursive !important;
|
| 69 |
-
}}
|
| 70 |
-
</style>
|
| 71 |
-
""".format(
|
| 72 |
-
font_urls=font or "https://fonts.googleapis.com/css2?family=Saira&display=swap",
|
| 73 |
-
fonts=(
|
| 74 |
-
font or "https://fonts.googleapis.com/css2?family=Saira&display=swap"
|
| 75 |
-
).replace("https://fonts.googleapis.com/css2?family=", "").replace("+", " ").split(":")[0].split("&")[0]
|
| 76 |
-
|
| 77 |
-
)
|
| 78 |
-
|
| 79 |
-
client_mode = True # "--client" in sys.argv
|
| 80 |
-
|
| 81 |
-
gr_params = {
|
| 82 |
-
"js": (
|
| 83 |
-
("() => {\n" + js_code + "\n}")
|
| 84 |
-
if gradio_version else
|
| 85 |
-
js_code
|
| 86 |
-
) if client_mode else None,
|
| 87 |
-
"theme": theme,
|
| 88 |
-
"css": css
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
with gr.Blocks(
|
| 92 |
-
title="📱 Vietnamese-RVC GUI",
|
| 93 |
-
**gr_params if gradio_version else {}
|
| 94 |
-
) as app:
|
| 95 |
-
gr.HTML("<h1 style='text-align: center;'>🎵VIETNAMESE RVC🎵</h1>", padding=True)
|
| 96 |
-
gr.HTML(f"<h3 style='text-align: center;'>{translations['title']}</h3>", padding=True)
|
| 97 |
-
|
| 98 |
-
with gr.Tabs():
|
| 99 |
-
if configs.get("inference_tab", True): inference_tab()
|
| 100 |
-
if configs.get("editing_tab", True): editing_tab()
|
| 101 |
-
if configs.get("realtime_tab", True) and not config.is_zluda: realtime_tab()
|
| 102 |
-
if configs.get("create_and_training_tab", True): training_tab()
|
| 103 |
-
if configs.get("downloads_tab", True): download_tab()
|
| 104 |
-
if configs.get("extra_tab", True): extra_tab(app)
|
| 105 |
-
|
| 106 |
-
with gr.Row():
|
| 107 |
-
gr.Markdown(
|
| 108 |
-
translations["rick_roll"].format(
|
| 109 |
-
rickroll=codecs.decode('uggcf://jjj.lbhghor.pbz/jngpu?i=qDj4j9JtKpD', 'rot13')
|
| 110 |
-
)
|
| 111 |
-
)
|
| 112 |
-
|
| 113 |
-
with gr.Row():
|
| 114 |
-
gr.Markdown(translations["terms_of_use"])
|
| 115 |
-
|
| 116 |
-
with gr.Row():
|
| 117 |
-
gr.Markdown(translations["exemption"])
|
| 118 |
-
|
| 119 |
-
if __name__ == "__main__":
|
| 120 |
-
device = config.device.replace("privateuseone", "dml")
|
| 121 |
-
if config.is_zluda: device = device.replace("cuda", "zluda")
|
| 122 |
-
if config.hip_version is not None: device = device.replace("cuda", "hip")
|
| 123 |
-
|
| 124 |
-
logger.info(f"Pytorch: {device} | Onnxruntime: {config.providers[0].replace('Dml', 'Ocl') if device.startswith('ocl') else config.providers[0]}")
|
| 125 |
-
if config.compile_all: logger.info(translations["compile_model"].format(compile_mode=config.compile_mode))
|
| 126 |
-
logger.info(f'{translations["precision"]}: {("BF16" if config.brain else "FP16") if config.is_half else "FP32"}')
|
| 127 |
-
logger.info(translations["start_app"])
|
| 128 |
-
logger.info(translations["set_lang"].format(lang=language))
|
| 129 |
-
|
| 130 |
-
port = configs.get("app_port", 7860)
|
| 131 |
-
server_name = configs.get("server_name", "0.0.0.0")
|
| 132 |
-
share = "--share" in sys.argv
|
| 133 |
-
|
| 134 |
-
original_stdout = sys.stdout
|
| 135 |
-
sys.stdout = io.StringIO()
|
| 136 |
-
|
| 137 |
-
for i in range(configs.get("num_of_restart", 5)):
|
| 138 |
-
try:
|
| 139 |
-
gradio_app, _, share_url = app.queue().launch(
|
| 140 |
-
favicon_path=configs["ico_path"],
|
| 141 |
-
server_name=server_name,
|
| 142 |
-
server_port=port,
|
| 143 |
-
show_error=configs.get("app_show_error", False),
|
| 144 |
-
inbrowser="--open" in sys.argv,
|
| 145 |
-
share=share,
|
| 146 |
-
allowed_paths=allow_disk,
|
| 147 |
-
prevent_thread_lock=True,
|
| 148 |
-
quiet=not config.debug_mode,
|
| 149 |
-
**gr_params if not gradio_version else {}
|
| 150 |
-
)
|
| 151 |
-
break
|
| 152 |
-
except OSError:
|
| 153 |
-
logger.debug(translations["port"].format(port=port))
|
| 154 |
-
port -= 1
|
| 155 |
-
except Exception as e:
|
| 156 |
-
logger.error(translations["error_occurred"].format(e=e))
|
| 157 |
-
sys.exit(1)
|
| 158 |
-
|
| 159 |
-
if client_mode:
|
| 160 |
-
logger.debug(translations["mount_fastapi"])
|
| 161 |
-
|
| 162 |
-
from main.inference.realtime.client import app as fastapi_app
|
| 163 |
-
gradio_app.mount("/api", fastapi_app)
|
| 164 |
-
|
| 165 |
-
logger.debug("\n" + sys.stdout.getvalue())
|
| 166 |
-
sys.stdout = original_stdout
|
| 167 |
-
|
| 168 |
-
if configs.get("discord_presence", True) and "--no_discord" not in sys.argv:
|
| 169 |
-
pipe = connect_discord_ipc()
|
| 170 |
-
if pipe:
|
| 171 |
-
try:
|
| 172 |
-
logger.info(translations["start_rpc"])
|
| 173 |
-
send_discord_rpc(pipe)
|
| 174 |
-
except KeyboardInterrupt:
|
| 175 |
-
logger.info(translations["stop_rpc"])
|
| 176 |
-
pipe.close()
|
| 177 |
-
|
| 178 |
-
logger.info(f"{translations['running_local_url']}: {server_name}:{port}")
|
| 179 |
-
if share: logger.info(f"{translations['running_share_url']}: {share_url}")
|
| 180 |
-
|
| 181 |
-
if "--tensorboard" in sys.argv:
|
| 182 |
-
logger.info(translations["run_tensorboard"])
|
| 183 |
-
|
| 184 |
-
from main.app.run_tensorboard import launch_tensorboard
|
| 185 |
-
launch_tensorboard()
|
| 186 |
-
|
| 187 |
-
logger.info(f"{translations['gradio_start']}: {(time.time() - start_time):.2f}s")
|
| 188 |
-
|
| 189 |
-
while 1:
|
| 190 |
-
time.sleep(5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/csrt.py
DELETED
|
@@ -1,122 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import gc
|
| 3 |
-
import sys
|
| 4 |
-
|
| 5 |
-
sys.path.append(os.getcwd())
|
| 6 |
-
|
| 7 |
-
from main.app.core.ui import gr_info, gr_warning, process_output
|
| 8 |
-
from main.app.variables import config, translations, configs, logger
|
| 9 |
-
from main.library.utils import check_spk_diarization, clear_gpu_cache
|
| 10 |
-
|
| 11 |
-
def whisper_process(
|
| 12 |
-
model_size,
|
| 13 |
-
input_audio,
|
| 14 |
-
configs,
|
| 15 |
-
device,
|
| 16 |
-
out_queue,
|
| 17 |
-
language="vi"
|
| 18 |
-
):
|
| 19 |
-
from main.library.speaker_diarization.whisper import load_model
|
| 20 |
-
|
| 21 |
-
try:
|
| 22 |
-
model = load_model(
|
| 23 |
-
model_size,
|
| 24 |
-
device=device
|
| 25 |
-
)
|
| 26 |
-
|
| 27 |
-
if config.compile_all:
|
| 28 |
-
import torch
|
| 29 |
-
|
| 30 |
-
model.encoder = torch.compile(model.encoder, mode=config.compile_mode)
|
| 31 |
-
model.decoder = torch.compile(model.decoder, mode=config.compile_mode)
|
| 32 |
-
|
| 33 |
-
segments = model.transcribe(
|
| 34 |
-
input_audio,
|
| 35 |
-
fp16=configs.get("fp16", False),
|
| 36 |
-
word_timestamps=True,
|
| 37 |
-
language=language
|
| 38 |
-
)
|
| 39 |
-
|
| 40 |
-
out_queue.put(segments["segments"])
|
| 41 |
-
except Exception as e:
|
| 42 |
-
out_queue.put(e)
|
| 43 |
-
finally:
|
| 44 |
-
clear_gpu_cache()
|
| 45 |
-
del segments
|
| 46 |
-
gc.collect()
|
| 47 |
-
|
| 48 |
-
def create_srt(
|
| 49 |
-
model_size,
|
| 50 |
-
input_audio,
|
| 51 |
-
output_file,
|
| 52 |
-
language
|
| 53 |
-
):
|
| 54 |
-
import multiprocessing as mp
|
| 55 |
-
|
| 56 |
-
if not input_audio or not os.path.exists(input_audio) or os.path.isdir(input_audio):
|
| 57 |
-
gr_warning(translations["input_not_valid"])
|
| 58 |
-
return [None]*2
|
| 59 |
-
|
| 60 |
-
if not output_file.endswith(".srt"): output_file += ".srt"
|
| 61 |
-
|
| 62 |
-
if not output_file:
|
| 63 |
-
gr_warning(translations["output_not_valid"])
|
| 64 |
-
return [None]*2
|
| 65 |
-
|
| 66 |
-
output_dir = os.path.dirname(output_file)
|
| 67 |
-
if not os.path.exists(output_dir): os.makedirs(output_dir, exist_ok=True)
|
| 68 |
-
|
| 69 |
-
info = ""
|
| 70 |
-
output_file = process_output(output_file)
|
| 71 |
-
|
| 72 |
-
check_spk_diarization(model_size, speechbrain=False)
|
| 73 |
-
gr_info(translations["csrt"])
|
| 74 |
-
|
| 75 |
-
ctx = mp.get_context("spawn")
|
| 76 |
-
whisper_queue = ctx.Queue()
|
| 77 |
-
|
| 78 |
-
whisperprocess = ctx.Process(
|
| 79 |
-
target=whisper_process,
|
| 80 |
-
args=(
|
| 81 |
-
model_size,
|
| 82 |
-
input_audio,
|
| 83 |
-
configs,
|
| 84 |
-
config.device,
|
| 85 |
-
whisper_queue,
|
| 86 |
-
language
|
| 87 |
-
)
|
| 88 |
-
)
|
| 89 |
-
|
| 90 |
-
whisperprocess.start()
|
| 91 |
-
segments = whisper_queue.get()
|
| 92 |
-
whisperprocess.join()
|
| 93 |
-
|
| 94 |
-
with open(output_file, "w", encoding="utf-8") as f:
|
| 95 |
-
for i, segment in enumerate(segments):
|
| 96 |
-
start = segment["start"]
|
| 97 |
-
end = segment["end"]
|
| 98 |
-
text = segment["text"].strip()
|
| 99 |
-
|
| 100 |
-
index = f"{i+1}\n"
|
| 101 |
-
timestamp = f"{format_timestamp(start)} --> {format_timestamp(end)}\n"
|
| 102 |
-
text1 = f"{text}\n\n"
|
| 103 |
-
|
| 104 |
-
f.write(index)
|
| 105 |
-
f.write(timestamp)
|
| 106 |
-
f.write(text1)
|
| 107 |
-
|
| 108 |
-
info = info + index + timestamp + text1
|
| 109 |
-
logger.info(info)
|
| 110 |
-
|
| 111 |
-
gr_info(translations["success"])
|
| 112 |
-
|
| 113 |
-
return [{"value": output_file, "visible": True, "__type__": "update"}, info]
|
| 114 |
-
|
| 115 |
-
def format_timestamp(seconds):
|
| 116 |
-
hours = int(seconds // 3600)
|
| 117 |
-
minutes = int((seconds % 3600) // 60)
|
| 118 |
-
|
| 119 |
-
seconds = int(seconds % 60)
|
| 120 |
-
miliseconds = int(round((seconds % 1) * 1000))
|
| 121 |
-
|
| 122 |
-
return f"{hours:02}:{minutes:02}:{seconds:02},{miliseconds:03}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/downloads.py
DELETED
|
@@ -1,351 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import re
|
| 3 |
-
import sys
|
| 4 |
-
import json
|
| 5 |
-
import codecs
|
| 6 |
-
import shutil
|
| 7 |
-
import yt_dlp
|
| 8 |
-
import warnings
|
| 9 |
-
import requests
|
| 10 |
-
|
| 11 |
-
from bs4 import BeautifulSoup
|
| 12 |
-
|
| 13 |
-
sys.path.append(os.getcwd())
|
| 14 |
-
|
| 15 |
-
from main.tools import huggingface, gdown, meganz, mediafire, pixeldrain
|
| 16 |
-
from main.app.variables import logger, translations, model_options, configs
|
| 17 |
-
from main.app.core.process import move_files_from_directory, fetch_pretrained_data, extract_name_model
|
| 18 |
-
from main.app.core.ui import gr_info, gr_warning, gr_error, process_output, replace_url, replace_modelname
|
| 19 |
-
|
| 20 |
-
def download_url(url):
|
| 21 |
-
if not url:
|
| 22 |
-
gr_warning(translations["provide_url"])
|
| 23 |
-
return [None]*3
|
| 24 |
-
|
| 25 |
-
if not os.path.exists(configs["audios_path"]): os.makedirs(configs["audios_path"], exist_ok=True)
|
| 26 |
-
|
| 27 |
-
with warnings.catch_warnings():
|
| 28 |
-
warnings.filterwarnings("ignore")
|
| 29 |
-
|
| 30 |
-
ydl_opts = {
|
| 31 |
-
"format": "bestaudio/best",
|
| 32 |
-
"postprocessors": [{
|
| 33 |
-
"key": "FFmpegExtractAudio",
|
| 34 |
-
"preferredcodec": "wav",
|
| 35 |
-
"preferredquality": "192"
|
| 36 |
-
}],
|
| 37 |
-
"quiet": True,
|
| 38 |
-
"no_warnings": True,
|
| 39 |
-
"noplaylist": True,
|
| 40 |
-
"verbose": False
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
gr_info(translations["start"].format(start=translations["download_music"]))
|
| 44 |
-
audio_output = ""
|
| 45 |
-
|
| 46 |
-
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| 47 |
-
audio_output = process_output(os.path.join(
|
| 48 |
-
configs["audios_path"],
|
| 49 |
-
re.sub(
|
| 50 |
-
r'\s+', '-',
|
| 51 |
-
re.sub(
|
| 52 |
-
r'[^\w\s\u4e00-\u9fff\uac00-\ud7af\u0400-\u04FF\u1100-\u11FF]',
|
| 53 |
-
'',
|
| 54 |
-
ydl.extract_info(url, download=False).get('title', 'video')
|
| 55 |
-
).strip()
|
| 56 |
-
)
|
| 57 |
-
) + ".wav")
|
| 58 |
-
|
| 59 |
-
if os.path.exists(audio_output):
|
| 60 |
-
shutil.rmtree(audio_output, ignore_errors=True)
|
| 61 |
-
|
| 62 |
-
ydl_opts['outtmpl'] = audio_output.replace(".wav", "")
|
| 63 |
-
|
| 64 |
-
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| 65 |
-
ydl.download([url])
|
| 66 |
-
|
| 67 |
-
gr_info(translations["success"])
|
| 68 |
-
|
| 69 |
-
return [
|
| 70 |
-
audio_output,
|
| 71 |
-
audio_output,
|
| 72 |
-
translations["success"]
|
| 73 |
-
]
|
| 74 |
-
|
| 75 |
-
def move_file(
|
| 76 |
-
file,
|
| 77 |
-
download_dir,
|
| 78 |
-
model,
|
| 79 |
-
use_orig_weight_name=False
|
| 80 |
-
):
|
| 81 |
-
weights_dir = configs["weights_path"]
|
| 82 |
-
logs_dir = configs["logs_path"]
|
| 83 |
-
|
| 84 |
-
if not os.path.exists(weights_dir): os.makedirs(weights_dir, exist_ok=True)
|
| 85 |
-
if not os.path.exists(logs_dir): os.makedirs(logs_dir, exist_ok=True)
|
| 86 |
-
|
| 87 |
-
if file.endswith(".zip"): shutil.unpack_archive(file, download_dir)
|
| 88 |
-
move_files_from_directory(download_dir, weights_dir, logs_dir, model, use_orig_weight_name)
|
| 89 |
-
|
| 90 |
-
def download_model(url=None, model=None):
|
| 91 |
-
if not url: return gr_warning(translations["provide_url"])
|
| 92 |
-
logger.debug(model + ": " + url)
|
| 93 |
-
|
| 94 |
-
url = replace_url(url)
|
| 95 |
-
download_dir = "download_model"
|
| 96 |
-
use_orig_weight_name = False
|
| 97 |
-
|
| 98 |
-
os.makedirs(download_dir, exist_ok=True)
|
| 99 |
-
|
| 100 |
-
try:
|
| 101 |
-
gr_info(translations["start"].format(start=translations["download"]))
|
| 102 |
-
|
| 103 |
-
if "huggingface.co" in url:
|
| 104 |
-
file = huggingface.HF_download_file(
|
| 105 |
-
url,
|
| 106 |
-
download_dir
|
| 107 |
-
)
|
| 108 |
-
elif "google.com" in url:
|
| 109 |
-
file = gdown.gdown_download(
|
| 110 |
-
url,
|
| 111 |
-
download_dir
|
| 112 |
-
)
|
| 113 |
-
elif "mediafire.com" in url:
|
| 114 |
-
file = mediafire.Mediafire_Download(
|
| 115 |
-
url,
|
| 116 |
-
download_dir
|
| 117 |
-
)
|
| 118 |
-
elif "pixeldrain.com" in url:
|
| 119 |
-
file = pixeldrain.pixeldrain(
|
| 120 |
-
url,
|
| 121 |
-
download_dir
|
| 122 |
-
)
|
| 123 |
-
elif "mega.nz" in url:
|
| 124 |
-
file = meganz.mega_download_url(
|
| 125 |
-
url,
|
| 126 |
-
download_dir
|
| 127 |
-
)
|
| 128 |
-
else:
|
| 129 |
-
gr_warning(translations["not_support_url"])
|
| 130 |
-
return translations["not_support_url"]
|
| 131 |
-
|
| 132 |
-
if not model:
|
| 133 |
-
use_orig_weight_name = True
|
| 134 |
-
modelname = os.path.basename(file)
|
| 135 |
-
|
| 136 |
-
model = (
|
| 137 |
-
extract_name_model(modelname)
|
| 138 |
-
if modelname.endswith(".index") else
|
| 139 |
-
os.path.splitext(modelname)[0]
|
| 140 |
-
)
|
| 141 |
-
|
| 142 |
-
if model is None: model = os.path.splitext(modelname)[0]
|
| 143 |
-
|
| 144 |
-
model = replace_modelname(model)
|
| 145 |
-
move_file(file, download_dir, model, use_orig_weight_name)
|
| 146 |
-
|
| 147 |
-
gr_info(translations["success"])
|
| 148 |
-
return translations["success"]
|
| 149 |
-
except Exception as e:
|
| 150 |
-
gr_error(message=translations["error_occurred"].format(e=e))
|
| 151 |
-
|
| 152 |
-
return translations["error_occurred"].format(e=e)
|
| 153 |
-
finally:
|
| 154 |
-
shutil.rmtree(download_dir, ignore_errors=True)
|
| 155 |
-
|
| 156 |
-
def download_pretrained_model(
|
| 157 |
-
choices,
|
| 158 |
-
model,
|
| 159 |
-
sample_rate
|
| 160 |
-
):
|
| 161 |
-
pretraineds_custom_path = configs["pretrained_custom_path"]
|
| 162 |
-
|
| 163 |
-
if choices == translations["list_model"]:
|
| 164 |
-
paths = fetch_pretrained_data()[model][sample_rate]
|
| 165 |
-
if not os.path.exists(pretraineds_custom_path):
|
| 166 |
-
os.makedirs(pretraineds_custom_path, exist_ok=True)
|
| 167 |
-
|
| 168 |
-
url = codecs.decode(
|
| 169 |
-
"uggcf://uhttvatsnpr.pb/NauC/Ivrganzrfr-EIP-Cebwrpg/erfbyir/znva/cergenvarq_phfgbz/",
|
| 170 |
-
"rot13"
|
| 171 |
-
) + paths
|
| 172 |
-
|
| 173 |
-
gr_info(translations["download_pretrain"])
|
| 174 |
-
|
| 175 |
-
file = huggingface.HF_download_file(
|
| 176 |
-
replace_url(url),
|
| 177 |
-
os.path.join(pretraineds_custom_path, paths)
|
| 178 |
-
)
|
| 179 |
-
|
| 180 |
-
if file.endswith(".zip"):
|
| 181 |
-
shutil.unpack_archive(file, pretraineds_custom_path)
|
| 182 |
-
os.remove(file)
|
| 183 |
-
|
| 184 |
-
gr_info(translations["success"])
|
| 185 |
-
return translations["success"]
|
| 186 |
-
elif choices == translations["download_url"]:
|
| 187 |
-
pretrain_is_zip = (
|
| 188 |
-
model.endswith(".zip") or
|
| 189 |
-
model.endswith(".zip?download=true") or
|
| 190 |
-
sample_rate.endswith(".zip") or
|
| 191 |
-
sample_rate.endswith(".zip?download=true")
|
| 192 |
-
)
|
| 193 |
-
|
| 194 |
-
urls = []
|
| 195 |
-
|
| 196 |
-
if not model and not pretrain_is_zip:
|
| 197 |
-
gr_warning(translations["provide_pretrain"].format(dg="D"))
|
| 198 |
-
return [None]*2
|
| 199 |
-
|
| 200 |
-
if not sample_rate and not pretrain_is_zip:
|
| 201 |
-
gr_warning(translations["provide_pretrain"].format(dg="G"))
|
| 202 |
-
return [None]*2
|
| 203 |
-
|
| 204 |
-
gr_info(translations["download_pretrain"])
|
| 205 |
-
|
| 206 |
-
if model: urls.append(model)
|
| 207 |
-
if sample_rate: urls.append(sample_rate)
|
| 208 |
-
|
| 209 |
-
for url in urls:
|
| 210 |
-
url = replace_url(url)
|
| 211 |
-
|
| 212 |
-
if "huggingface.co" in url:
|
| 213 |
-
file = huggingface.HF_download_file(
|
| 214 |
-
url,
|
| 215 |
-
pretraineds_custom_path
|
| 216 |
-
)
|
| 217 |
-
elif "google.com" in url:
|
| 218 |
-
file = gdown.gdown_download(
|
| 219 |
-
url,
|
| 220 |
-
pretraineds_custom_path
|
| 221 |
-
)
|
| 222 |
-
elif "mediafire.com" in url:
|
| 223 |
-
file = mediafire.Mediafire_Download(
|
| 224 |
-
url,
|
| 225 |
-
pretraineds_custom_path
|
| 226 |
-
)
|
| 227 |
-
elif "pixeldrain.com" in url:
|
| 228 |
-
file = pixeldrain.pixeldrain(
|
| 229 |
-
url,
|
| 230 |
-
pretraineds_custom_path
|
| 231 |
-
)
|
| 232 |
-
elif "mega.nz" in url:
|
| 233 |
-
file = meganz.mega_download_url(
|
| 234 |
-
url,
|
| 235 |
-
pretraineds_custom_path
|
| 236 |
-
)
|
| 237 |
-
else:
|
| 238 |
-
gr_warning(translations["not_support_url"])
|
| 239 |
-
return translations["not_support_url"], translations["not_support_url"]
|
| 240 |
-
|
| 241 |
-
if file.endswith(".zip"):
|
| 242 |
-
shutil.unpack_archive(file, pretraineds_custom_path)
|
| 243 |
-
if os.path.exists(file): os.remove(file)
|
| 244 |
-
|
| 245 |
-
gr_info(translations["success"])
|
| 246 |
-
return translations["success"], translations["success"]
|
| 247 |
-
|
| 248 |
-
def is_empty_table(html):
|
| 249 |
-
return ('<td colspan=' in html and 'text-center' in html)
|
| 250 |
-
|
| 251 |
-
def fetch_models_data(search):
|
| 252 |
-
all_table_data = []
|
| 253 |
-
models = set()
|
| 254 |
-
page = 0
|
| 255 |
-
|
| 256 |
-
while 1:
|
| 257 |
-
try:
|
| 258 |
-
url = codecs.decode("uggcf://ibvpr-zbqryf.pbz", "rot13")
|
| 259 |
-
response = requests.post(
|
| 260 |
-
url=codecs.decode(
|
| 261 |
-
"uggcf://ibvpr-zbqryf.pbz/srgpu_qngn.cuc",
|
| 262 |
-
"rot13"
|
| 263 |
-
),
|
| 264 |
-
data={
|
| 265 |
-
"page": page,
|
| 266 |
-
"search": search
|
| 267 |
-
},
|
| 268 |
-
headers={
|
| 269 |
-
"User-Agent": (
|
| 270 |
-
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
|
| 271 |
-
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
| 272 |
-
"Chrome/148.0.0.0 Safari/537.36"
|
| 273 |
-
),
|
| 274 |
-
"Referer": url + "/",
|
| 275 |
-
"Origin": url
|
| 276 |
-
}
|
| 277 |
-
)
|
| 278 |
-
|
| 279 |
-
if response.status_code == 200:
|
| 280 |
-
table_data = response.json().get("table", "")
|
| 281 |
-
|
| 282 |
-
if not table_data.strip(): break
|
| 283 |
-
if is_empty_table(table_data): break
|
| 284 |
-
|
| 285 |
-
model_links = {a.get("href") for a in BeautifulSoup(table_data, "html.parser").select('a[href^="/model/"]')}
|
| 286 |
-
if not model_links: break
|
| 287 |
-
|
| 288 |
-
new_models = model_links - models
|
| 289 |
-
if not new_models: break
|
| 290 |
-
|
| 291 |
-
models.update(new_models)
|
| 292 |
-
all_table_data.append(table_data)
|
| 293 |
-
page += 1
|
| 294 |
-
else:
|
| 295 |
-
logger.debug(f"{translations['code_error']} {response.status_code}")
|
| 296 |
-
break
|
| 297 |
-
except json.JSONDecodeError:
|
| 298 |
-
logger.debug(translations["json_error"])
|
| 299 |
-
break
|
| 300 |
-
except requests.RequestException as e:
|
| 301 |
-
logger.debug(translations["requests_error"].format(e=e))
|
| 302 |
-
break
|
| 303 |
-
|
| 304 |
-
return all_table_data
|
| 305 |
-
|
| 306 |
-
def search_models(name):
|
| 307 |
-
if not name:
|
| 308 |
-
gr_warning(translations["provide_name"])
|
| 309 |
-
return [None]*2
|
| 310 |
-
|
| 311 |
-
gr_info(translations["start"].format(start=translations["search"]))
|
| 312 |
-
|
| 313 |
-
tables = fetch_models_data(name)
|
| 314 |
-
|
| 315 |
-
if len(tables) == 0:
|
| 316 |
-
gr_info(translations["not_found"].format(name=name))
|
| 317 |
-
return [None]*2
|
| 318 |
-
else:
|
| 319 |
-
from urllib.parse import unquote
|
| 320 |
-
|
| 321 |
-
model_options.clear()
|
| 322 |
-
|
| 323 |
-
for table in tables:
|
| 324 |
-
for row in BeautifulSoup(table, "html.parser").select("tr"):
|
| 325 |
-
name_tag, url_tag = (
|
| 326 |
-
row.find("a", {"class": "fs-5"}),
|
| 327 |
-
row.find("a", {"class": "btn btn-sm fw-bold btn-light ms-0 p-1 ps-2 pe-2"})
|
| 328 |
-
)
|
| 329 |
-
|
| 330 |
-
url = unquote(url_tag["href"].replace("https://easyaivoice.com/run?url=", ""))
|
| 331 |
-
|
| 332 |
-
if ("huggingface" in url) and (name_tag and url_tag):
|
| 333 |
-
model_options[replace_modelname(name_tag.text)] = url
|
| 334 |
-
|
| 335 |
-
logger.debug(model_options)
|
| 336 |
-
gr_info(translations["found"].format(results=len(model_options)))
|
| 337 |
-
|
| 338 |
-
return [
|
| 339 |
-
{
|
| 340 |
-
"value": "",
|
| 341 |
-
"choices": model_options,
|
| 342 |
-
"interactive": True,
|
| 343 |
-
"visible": True,
|
| 344 |
-
"__type__": "update"
|
| 345 |
-
},
|
| 346 |
-
{
|
| 347 |
-
"value": translations["downloads"],
|
| 348 |
-
"visible": True,
|
| 349 |
-
"__type__": "update"
|
| 350 |
-
}
|
| 351 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/editing.py
DELETED
|
@@ -1,310 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import random
|
| 4 |
-
import subprocess
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.variables import python, translations, configs
|
| 9 |
-
from main.app.core.ui import gr_info, gr_warning, process_output, replace_export_format
|
| 10 |
-
|
| 11 |
-
def audio_effects(
|
| 12 |
-
input_path,
|
| 13 |
-
output_path,
|
| 14 |
-
resample,
|
| 15 |
-
resample_sr,
|
| 16 |
-
chorus_depth,
|
| 17 |
-
chorus_rate,
|
| 18 |
-
chorus_mix,
|
| 19 |
-
chorus_delay,
|
| 20 |
-
chorus_feedback,
|
| 21 |
-
distortion_drive,
|
| 22 |
-
reverb_room_size,
|
| 23 |
-
reverb_damping,
|
| 24 |
-
reverb_wet_level,
|
| 25 |
-
reverb_dry_level,
|
| 26 |
-
reverb_width,
|
| 27 |
-
reverb_freeze_mode,
|
| 28 |
-
pitch_shift,
|
| 29 |
-
delay_seconds,
|
| 30 |
-
delay_feedback,
|
| 31 |
-
delay_mix,
|
| 32 |
-
compressor_threshold,
|
| 33 |
-
compressor_ratio,
|
| 34 |
-
compressor_attack_ms,
|
| 35 |
-
compressor_release_ms,
|
| 36 |
-
limiter_threshold,
|
| 37 |
-
limiter_release,
|
| 38 |
-
gain_db,
|
| 39 |
-
bitcrush_bit_depth,
|
| 40 |
-
clipping_threshold,
|
| 41 |
-
phaser_rate_hz,
|
| 42 |
-
phaser_depth,
|
| 43 |
-
phaser_centre_frequency_hz,
|
| 44 |
-
phaser_feedback,
|
| 45 |
-
phaser_mix,
|
| 46 |
-
bass_boost_db,
|
| 47 |
-
bass_boost_frequency,
|
| 48 |
-
treble_boost_db,
|
| 49 |
-
treble_boost_frequency,
|
| 50 |
-
fade_in_duration,
|
| 51 |
-
fade_out_duration,
|
| 52 |
-
export_format,
|
| 53 |
-
chorus,
|
| 54 |
-
distortion,
|
| 55 |
-
reverb,
|
| 56 |
-
delay,
|
| 57 |
-
compressor,
|
| 58 |
-
limiter,
|
| 59 |
-
gain,
|
| 60 |
-
bitcrush,
|
| 61 |
-
clipping,
|
| 62 |
-
phaser,
|
| 63 |
-
treble_bass_boost,
|
| 64 |
-
fade_in_out,
|
| 65 |
-
audio_combination,
|
| 66 |
-
audio_combination_input,
|
| 67 |
-
main_vol,
|
| 68 |
-
combine_vol
|
| 69 |
-
):
|
| 70 |
-
if not input_path or not os.path.exists(input_path) or os.path.isdir(input_path):
|
| 71 |
-
gr_warning(translations["input_not_valid"])
|
| 72 |
-
return None
|
| 73 |
-
|
| 74 |
-
if not output_path:
|
| 75 |
-
gr_warning(translations["output_not_valid"])
|
| 76 |
-
return None
|
| 77 |
-
|
| 78 |
-
if os.path.isdir(output_path): output_path = os.path.join(output_path, f"audio_effects.{export_format}")
|
| 79 |
-
output_dir = os.path.dirname(output_path) or output_path
|
| 80 |
-
|
| 81 |
-
if not os.path.exists(output_dir): os.makedirs(output_dir, exist_ok=True)
|
| 82 |
-
output_path = process_output(output_path)
|
| 83 |
-
|
| 84 |
-
gr_info(translations["start"].format(start=translations["apply_effect"]))
|
| 85 |
-
|
| 86 |
-
subprocess.run([
|
| 87 |
-
python,
|
| 88 |
-
configs["audio_effects_path"],
|
| 89 |
-
"--input_path", input_path,
|
| 90 |
-
"--output_path", output_path,
|
| 91 |
-
"--resample", str(resample),
|
| 92 |
-
"--resample_sr", str(resample_sr),
|
| 93 |
-
"--chorus_depth", str(chorus_depth),
|
| 94 |
-
"--chorus_rate", str(chorus_rate),
|
| 95 |
-
"--chorus_mix", str(chorus_mix),
|
| 96 |
-
"--chorus_delay", str(chorus_delay),
|
| 97 |
-
"--chorus_feedback", str(chorus_feedback),
|
| 98 |
-
"--drive_db", str(distortion_drive),
|
| 99 |
-
"--reverb_room_size", str(reverb_room_size),
|
| 100 |
-
"--reverb_damping", str(reverb_damping),
|
| 101 |
-
"--reverb_wet_level", str(reverb_wet_level),
|
| 102 |
-
"--reverb_dry_level", str(reverb_dry_level),
|
| 103 |
-
"--reverb_width", str(reverb_width),
|
| 104 |
-
"--reverb_freeze_mode", str(reverb_freeze_mode),
|
| 105 |
-
"--pitch_shift", str(pitch_shift),
|
| 106 |
-
"--delay_seconds", str(delay_seconds),
|
| 107 |
-
"--delay_feedback", str(delay_feedback),
|
| 108 |
-
"--delay_mix", str(delay_mix),
|
| 109 |
-
"--compressor_threshold", str(compressor_threshold),
|
| 110 |
-
"--compressor_ratio", str(compressor_ratio),
|
| 111 |
-
"--compressor_attack_ms", str(compressor_attack_ms),
|
| 112 |
-
"--compressor_release_ms", str(compressor_release_ms),
|
| 113 |
-
"--limiter_threshold", str(limiter_threshold),
|
| 114 |
-
"--limiter_release", str(limiter_release),
|
| 115 |
-
"--gain_db", str(gain_db),
|
| 116 |
-
"--bitcrush_bit_depth", str(bitcrush_bit_depth),
|
| 117 |
-
"--clipping_threshold", str(clipping_threshold),
|
| 118 |
-
"--phaser_rate_hz", str(phaser_rate_hz),
|
| 119 |
-
"--phaser_depth", str(phaser_depth),
|
| 120 |
-
"--phaser_centre_frequency_hz", str(phaser_centre_frequency_hz),
|
| 121 |
-
"--phaser_feedback", str(phaser_feedback),
|
| 122 |
-
"--phaser_mix", str(phaser_mix),
|
| 123 |
-
"--bass_boost_db", str(bass_boost_db),
|
| 124 |
-
"--bass_boost_frequency", str(bass_boost_frequency),
|
| 125 |
-
"--treble_boost_db", str(treble_boost_db),
|
| 126 |
-
"--treble_boost_frequency", str(treble_boost_frequency),
|
| 127 |
-
"--fade_in_duration", str(fade_in_duration),
|
| 128 |
-
"--fade_out_duration", str(fade_out_duration),
|
| 129 |
-
"--export_format", export_format,
|
| 130 |
-
"--chorus", str(chorus),
|
| 131 |
-
"--distortion", str(distortion),
|
| 132 |
-
"--reverb", str(reverb),
|
| 133 |
-
"--pitchshift", str(pitch_shift != 0),
|
| 134 |
-
"--delay", str(delay),
|
| 135 |
-
"--compressor", str(compressor),
|
| 136 |
-
"--limiter", str(limiter),
|
| 137 |
-
"--gain", str(gain),
|
| 138 |
-
"--bitcrush", str(bitcrush),
|
| 139 |
-
"--clipping", str(clipping),
|
| 140 |
-
"--phaser", str(phaser),
|
| 141 |
-
"--treble_bass_boost", str(treble_bass_boost),
|
| 142 |
-
"--fade_in_out", str(fade_in_out),
|
| 143 |
-
"--audio_combination", str(audio_combination),
|
| 144 |
-
"--audio_combination_input", audio_combination_input,
|
| 145 |
-
"--main_volume", str(main_vol),
|
| 146 |
-
"--combination_volume", str(combine_vol)])
|
| 147 |
-
|
| 148 |
-
gr_info(translations["success"])
|
| 149 |
-
return replace_export_format(output_path, export_format)
|
| 150 |
-
|
| 151 |
-
def apply_voice_quirk(
|
| 152 |
-
audio_path,
|
| 153 |
-
mode,
|
| 154 |
-
output_path,
|
| 155 |
-
export_format
|
| 156 |
-
):
|
| 157 |
-
if not audio_path or not os.path.exists(audio_path) or os.path.isdir(audio_path):
|
| 158 |
-
gr_warning(translations["input_not_valid"])
|
| 159 |
-
return None
|
| 160 |
-
|
| 161 |
-
if not output_path:
|
| 162 |
-
gr_warning(translations["output_not_valid"])
|
| 163 |
-
return None
|
| 164 |
-
|
| 165 |
-
if os.path.isdir(output_path):
|
| 166 |
-
output_path = os.path.join(output_path, f"audio_quirk.{export_format}")
|
| 167 |
-
|
| 168 |
-
output_dir = os.path.dirname(output_path) or output_path
|
| 169 |
-
|
| 170 |
-
if not os.path.exists(output_dir): os.makedirs(output_dir, exist_ok=True)
|
| 171 |
-
output_path = process_output(output_path)
|
| 172 |
-
|
| 173 |
-
gr_info(translations["start"].format(start=translations["apply_effect"]))
|
| 174 |
-
|
| 175 |
-
import librosa
|
| 176 |
-
import numpy as np
|
| 177 |
-
import soundfile as sf
|
| 178 |
-
|
| 179 |
-
def vibrato(y, sr, freq=5, depth=0.003):
|
| 180 |
-
return y[
|
| 181 |
-
np.clip(
|
| 182 |
-
(np.arange(
|
| 183 |
-
len(y)) + (
|
| 184 |
-
depth * np.sin(
|
| 185 |
-
2 * np.pi * freq * (np.arange(len(y)) / sr)
|
| 186 |
-
)
|
| 187 |
-
) * sr
|
| 188 |
-
).astype(int),
|
| 189 |
-
0,
|
| 190 |
-
len(y) - 1
|
| 191 |
-
)
|
| 192 |
-
]
|
| 193 |
-
|
| 194 |
-
y, sr = librosa.load(audio_path, sr=None)
|
| 195 |
-
output_path = replace_export_format(output_path, export_format)
|
| 196 |
-
|
| 197 |
-
mode = translations["quirk_choice"][mode]
|
| 198 |
-
if mode == 0: mode = random.randint(1, 16)
|
| 199 |
-
|
| 200 |
-
if mode == 1:
|
| 201 |
-
y *= np.random.uniform(
|
| 202 |
-
0.5,
|
| 203 |
-
0.8,
|
| 204 |
-
size=len(y)
|
| 205 |
-
)
|
| 206 |
-
elif mode == 2:
|
| 207 |
-
y = librosa.effects.pitch_shift(
|
| 208 |
-
y=y + np.random.normal(0, 0.01, y.shape),
|
| 209 |
-
sr=sr,
|
| 210 |
-
n_steps=np.random.uniform(-1.5, -3.5)
|
| 211 |
-
)
|
| 212 |
-
elif mode == 3:
|
| 213 |
-
y = librosa.effects.time_stretch(
|
| 214 |
-
librosa.effects.pitch_shift(
|
| 215 |
-
y=y,
|
| 216 |
-
sr=sr,
|
| 217 |
-
n_steps=3
|
| 218 |
-
),
|
| 219 |
-
rate=1.2
|
| 220 |
-
)
|
| 221 |
-
elif mode == 4:
|
| 222 |
-
y = librosa.effects.time_stretch(
|
| 223 |
-
librosa.effects.pitch_shift(
|
| 224 |
-
y=y,
|
| 225 |
-
sr=sr,
|
| 226 |
-
n_steps=8
|
| 227 |
-
),
|
| 228 |
-
rate=1.3
|
| 229 |
-
)
|
| 230 |
-
elif mode == 5:
|
| 231 |
-
y = librosa.effects.time_stretch(
|
| 232 |
-
librosa.effects.pitch_shift(
|
| 233 |
-
y=y,
|
| 234 |
-
sr=sr,
|
| 235 |
-
n_steps=-3
|
| 236 |
-
),
|
| 237 |
-
rate=0.75
|
| 238 |
-
)
|
| 239 |
-
elif mode == 6:
|
| 240 |
-
y *= np.sin(np.linspace(0, np.pi * 20, len(y))) * 0.5 + 0.5
|
| 241 |
-
elif mode == 7:
|
| 242 |
-
y = librosa.effects.time_stretch(
|
| 243 |
-
vibrato(
|
| 244 |
-
librosa.effects.pitch_shift(
|
| 245 |
-
y=y,
|
| 246 |
-
sr=sr,
|
| 247 |
-
n_steps=-4
|
| 248 |
-
),
|
| 249 |
-
sr,
|
| 250 |
-
freq=3,
|
| 251 |
-
depth=0.004
|
| 252 |
-
),
|
| 253 |
-
rate=0.85
|
| 254 |
-
)
|
| 255 |
-
elif mode == 8:
|
| 256 |
-
y *= 0.6 + np.pad(y, (sr // 2, 0), mode='constant')[:len(y)] * 0.4
|
| 257 |
-
elif mode == 9:
|
| 258 |
-
y = librosa.effects.pitch_shift(
|
| 259 |
-
y=y,
|
| 260 |
-
sr=sr,
|
| 261 |
-
n_steps=2
|
| 262 |
-
) + np.sin(
|
| 263 |
-
np.linspace(0, np.pi * 20, len(y))
|
| 264 |
-
) * 0.02
|
| 265 |
-
elif mode == 10:
|
| 266 |
-
y = vibrato(
|
| 267 |
-
y,
|
| 268 |
-
sr,
|
| 269 |
-
freq=8,
|
| 270 |
-
depth=0.005
|
| 271 |
-
)
|
| 272 |
-
elif mode == 11:
|
| 273 |
-
y = librosa.effects.time_stretch(
|
| 274 |
-
librosa.effects.pitch_shift(y=y, sr=sr, n_steps=4),
|
| 275 |
-
rate=1.25
|
| 276 |
-
)
|
| 277 |
-
elif mode == 12:
|
| 278 |
-
y = np.hstack([
|
| 279 |
-
np.pad(f, (0, int(len(f)*0.3)), mode='edge')
|
| 280 |
-
for f in librosa.util.frame(y, frame_length=2048, hop_length=512).T
|
| 281 |
-
])
|
| 282 |
-
elif mode == 13:
|
| 283 |
-
y = np.concatenate([
|
| 284 |
-
y,
|
| 285 |
-
np.sin(
|
| 286 |
-
2 * np.pi * np.linspace(0, 1, int(0.05 * sr))
|
| 287 |
-
) * 0.04
|
| 288 |
-
])
|
| 289 |
-
elif mode == 14:
|
| 290 |
-
y += np.random.normal(
|
| 291 |
-
0,
|
| 292 |
-
0.005,
|
| 293 |
-
len(y)
|
| 294 |
-
)
|
| 295 |
-
elif mode == 15:
|
| 296 |
-
frame = int(sr * 0.8)
|
| 297 |
-
chunks = [y[i:i + frame] for i in range(0, len(y), frame)]
|
| 298 |
-
|
| 299 |
-
np.random.shuffle(chunks)
|
| 300 |
-
y = np.concatenate(chunks)
|
| 301 |
-
elif mode == 16:
|
| 302 |
-
frame = int(sr * 0.3)
|
| 303 |
-
|
| 304 |
-
for i in range(0, len(y), frame * 2):
|
| 305 |
-
y[i:i+frame] = y[i:i+frame][::-1]
|
| 306 |
-
|
| 307 |
-
sf.write(output_path, y, sr, format=export_format)
|
| 308 |
-
gr_info(translations["success"])
|
| 309 |
-
|
| 310 |
-
return output_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/f0_extract.py
DELETED
|
@@ -1,86 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
sys.path.append(os.getcwd())
|
| 5 |
-
|
| 6 |
-
from main.app.core.ui import gr_info, gr_warning
|
| 7 |
-
from main.app.variables import config, translations, configs
|
| 8 |
-
|
| 9 |
-
def f0_extract(
|
| 10 |
-
audio,
|
| 11 |
-
f0_method,
|
| 12 |
-
predictor_onnx,
|
| 13 |
-
pitch,
|
| 14 |
-
filter_radius,
|
| 15 |
-
f0_autotune,
|
| 16 |
-
f0_autotune_strength,
|
| 17 |
-
proposal_pitch,
|
| 18 |
-
proposal_pitch_threshold
|
| 19 |
-
):
|
| 20 |
-
if not audio or not os.path.exists(audio) or os.path.isdir(audio):
|
| 21 |
-
gr_warning(translations["input_not_valid"])
|
| 22 |
-
return [None]*2
|
| 23 |
-
|
| 24 |
-
import numpy as np
|
| 25 |
-
import matplotlib.pyplot as plt
|
| 26 |
-
|
| 27 |
-
from main.library.utils import check_assets
|
| 28 |
-
from main.library.audio.audio import load_audio
|
| 29 |
-
from main.library.predictors.Generator import Generator
|
| 30 |
-
|
| 31 |
-
check_assets(f0_method, "", predictor_onnx, "")
|
| 32 |
-
|
| 33 |
-
f0_path = os.path.join(configs["f0_path"], os.path.splitext(os.path.basename(audio))[0])
|
| 34 |
-
image_path = os.path.join(f0_path, "f0.png")
|
| 35 |
-
txt_path = os.path.join(f0_path, "f0.txt")
|
| 36 |
-
|
| 37 |
-
gr_info(translations["start_extract"])
|
| 38 |
-
if not os.path.exists(f0_path): os.makedirs(f0_path, exist_ok=True)
|
| 39 |
-
|
| 40 |
-
y = load_audio(audio, sample_rate=16000)
|
| 41 |
-
|
| 42 |
-
f0_generator = Generator(
|
| 43 |
-
sample_rate=16000,
|
| 44 |
-
hop_length=160,
|
| 45 |
-
f0_min=configs.get("f0_min", 50),
|
| 46 |
-
f0_max=configs.get("f0_max", 1100),
|
| 47 |
-
alpha=0.5,
|
| 48 |
-
is_half=config.is_half,
|
| 49 |
-
device=config.device,
|
| 50 |
-
predictor_onnx=predictor_onnx
|
| 51 |
-
)
|
| 52 |
-
|
| 53 |
-
_, pitchf = f0_generator.calculator(
|
| 54 |
-
x_pad=config.x_pad,
|
| 55 |
-
f0_method=f0_method,
|
| 56 |
-
x=y,
|
| 57 |
-
f0_up_key=pitch,
|
| 58 |
-
p_len=None,
|
| 59 |
-
filter_radius=filter_radius,
|
| 60 |
-
f0_autotune=f0_autotune,
|
| 61 |
-
f0_autotune_strength=f0_autotune_strength,
|
| 62 |
-
manual_f0=None,
|
| 63 |
-
proposal_pitch=proposal_pitch,
|
| 64 |
-
proposal_pitch_threshold=proposal_pitch_threshold
|
| 65 |
-
)
|
| 66 |
-
|
| 67 |
-
F_temp = np.array(pitchf, dtype=np.float32)
|
| 68 |
-
F_temp[F_temp == 0] = np.nan
|
| 69 |
-
|
| 70 |
-
f0 = 1200 * np.log2(F_temp / 8.175798915643707)
|
| 71 |
-
|
| 72 |
-
plt.figure(figsize=(10, 4))
|
| 73 |
-
plt.plot(f0)
|
| 74 |
-
plt.title(f0_method)
|
| 75 |
-
plt.xlabel(translations["time_frames"])
|
| 76 |
-
plt.ylabel(translations["Frequency"])
|
| 77 |
-
plt.savefig(image_path)
|
| 78 |
-
plt.close()
|
| 79 |
-
|
| 80 |
-
with open(txt_path, "w") as f:
|
| 81 |
-
for i, f0_value in enumerate(pitchf):
|
| 82 |
-
f.write(f"{i},{f0_value}\n")
|
| 83 |
-
|
| 84 |
-
gr_info(translations["extract_done"])
|
| 85 |
-
|
| 86 |
-
return [txt_path, image_path]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/inference.py
DELETED
|
@@ -1,1248 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import re
|
| 3 |
-
import gc
|
| 4 |
-
import sys
|
| 5 |
-
import shutil
|
| 6 |
-
import datetime
|
| 7 |
-
import subprocess
|
| 8 |
-
|
| 9 |
-
import numpy as np
|
| 10 |
-
|
| 11 |
-
sys.path.append(os.getcwd())
|
| 12 |
-
|
| 13 |
-
from main.app.core.ui import gr_info, gr_warning, gr_error, process_output, replace_export_format
|
| 14 |
-
from main.app.variables import logger, config, configs, translations, python, file_types, gradio_version
|
| 15 |
-
|
| 16 |
-
def convert(
|
| 17 |
-
pitch,
|
| 18 |
-
filter_radius,
|
| 19 |
-
index_rate,
|
| 20 |
-
rms_mix_rate,
|
| 21 |
-
protect,
|
| 22 |
-
hop_length,
|
| 23 |
-
f0_method,
|
| 24 |
-
input_path,
|
| 25 |
-
output_path,
|
| 26 |
-
pth_path,
|
| 27 |
-
index_path,
|
| 28 |
-
f0_autotune,
|
| 29 |
-
clean_audio,
|
| 30 |
-
clean_strength,
|
| 31 |
-
export_format,
|
| 32 |
-
embedder_model,
|
| 33 |
-
resample_sr,
|
| 34 |
-
split_audio,
|
| 35 |
-
f0_autotune_strength,
|
| 36 |
-
checkpointing,
|
| 37 |
-
predictor_onnx,
|
| 38 |
-
embedders_mode,
|
| 39 |
-
formant_shifting,
|
| 40 |
-
formant_qfrency,
|
| 41 |
-
formant_timbre,
|
| 42 |
-
f0_file,
|
| 43 |
-
proposal_pitch,
|
| 44 |
-
proposal_pitch_threshold,
|
| 45 |
-
audio_processing=False,
|
| 46 |
-
alpha=0.5,
|
| 47 |
-
sid=0,
|
| 48 |
-
embedders_mix = False,
|
| 49 |
-
embedders_mix_layers = 9,
|
| 50 |
-
embedders_mix_ratio = 0.5,
|
| 51 |
-
noise_scale = 0.35,
|
| 52 |
-
nprobe = 1,
|
| 53 |
-
audio_upscaler = False
|
| 54 |
-
):
|
| 55 |
-
subprocess.run([
|
| 56 |
-
python,
|
| 57 |
-
configs["convert_path"],
|
| 58 |
-
"--pitch", str(pitch),
|
| 59 |
-
"--filter_radius", str(filter_radius),
|
| 60 |
-
"--index_rate", str(index_rate),
|
| 61 |
-
"--rms_mix_rate", str(rms_mix_rate),
|
| 62 |
-
"--protect", str(protect),
|
| 63 |
-
"--hop_length", str(hop_length),
|
| 64 |
-
"--f0_method", f0_method,
|
| 65 |
-
"--input_path", input_path,
|
| 66 |
-
"--output_path", output_path,
|
| 67 |
-
"--pth_path", pth_path,
|
| 68 |
-
"--index_path", index_path,
|
| 69 |
-
"--f0_autotune", str(f0_autotune),
|
| 70 |
-
"--clean_audio", str(clean_audio),
|
| 71 |
-
"--clean_strength", str(clean_strength),
|
| 72 |
-
"--export_format", export_format,
|
| 73 |
-
"--embedder_model", embedder_model,
|
| 74 |
-
"--resample_sr", str(resample_sr),
|
| 75 |
-
"--split_audio", str(split_audio),
|
| 76 |
-
"--f0_autotune_strength", str(f0_autotune_strength),
|
| 77 |
-
"--checkpointing", str(checkpointing),
|
| 78 |
-
"--predictor_onnx", str(predictor_onnx),
|
| 79 |
-
"--embedders_mode", embedders_mode,
|
| 80 |
-
"--formant_shifting", str(formant_shifting),
|
| 81 |
-
"--formant_qfrency", str(formant_qfrency),
|
| 82 |
-
"--formant_timbre", str(formant_timbre),
|
| 83 |
-
"--f0_file", f0_file,
|
| 84 |
-
"--proposal_pitch", str(proposal_pitch),
|
| 85 |
-
"--proposal_pitch_threshold", str(proposal_pitch_threshold),
|
| 86 |
-
"--audio_processing", str(audio_processing),
|
| 87 |
-
"--alpha", str(alpha),
|
| 88 |
-
"--sid", str(sid),
|
| 89 |
-
"--embedders_mix", str(embedders_mix),
|
| 90 |
-
"--embedders_mix_layers", str(embedders_mix_layers),
|
| 91 |
-
"--embedders_mix_ratio", str(embedders_mix_ratio),
|
| 92 |
-
"--noise_scale", str(noise_scale),
|
| 93 |
-
"--nprobe", str(nprobe),
|
| 94 |
-
"--audio_upscaler", str(audio_upscaler)
|
| 95 |
-
])
|
| 96 |
-
|
| 97 |
-
def convert_audio(
|
| 98 |
-
clean_audio,
|
| 99 |
-
autotune,
|
| 100 |
-
use_separate_audio,
|
| 101 |
-
use_original,
|
| 102 |
-
convert_backing,
|
| 103 |
-
not_merge_backing,
|
| 104 |
-
merge_instrument,
|
| 105 |
-
pitch,
|
| 106 |
-
clean_strength,
|
| 107 |
-
model,
|
| 108 |
-
index,
|
| 109 |
-
index_rate,
|
| 110 |
-
input_path,
|
| 111 |
-
output_path,
|
| 112 |
-
export_format,
|
| 113 |
-
f0_method,
|
| 114 |
-
hybrid_method,
|
| 115 |
-
hop_length,
|
| 116 |
-
embedders,
|
| 117 |
-
custom_embedders,
|
| 118 |
-
resample_sr,
|
| 119 |
-
filter_radius,
|
| 120 |
-
rms_mix_rate,
|
| 121 |
-
protect,
|
| 122 |
-
split_audio,
|
| 123 |
-
f0_autotune_strength,
|
| 124 |
-
input_audio_name,
|
| 125 |
-
checkpointing,
|
| 126 |
-
predictor_onnx,
|
| 127 |
-
formant_shifting,
|
| 128 |
-
formant_qfrency,
|
| 129 |
-
formant_timbre,
|
| 130 |
-
f0_file,
|
| 131 |
-
embedders_mode,
|
| 132 |
-
proposal_pitch,
|
| 133 |
-
proposal_pitch_threshold,
|
| 134 |
-
audio_processing=False,
|
| 135 |
-
alpha=0.5,
|
| 136 |
-
sid=0,
|
| 137 |
-
embedders_mix = False,
|
| 138 |
-
embedders_mix_layers = 9,
|
| 139 |
-
embedders_mix_ratio = 0.5,
|
| 140 |
-
noise_scale = 0.35,
|
| 141 |
-
nprobe = 1,
|
| 142 |
-
audio_upscaler = False
|
| 143 |
-
):
|
| 144 |
-
model_path = os.path.join(configs["weights_path"], model) if not os.path.exists(model) else model
|
| 145 |
-
|
| 146 |
-
return_none = [None]*6
|
| 147 |
-
return_none[5] = {"visible": True, "__type__": "update"}
|
| 148 |
-
|
| 149 |
-
if (
|
| 150 |
-
not use_separate_audio and (
|
| 151 |
-
merge_instrument or
|
| 152 |
-
not_merge_backing or
|
| 153 |
-
convert_backing or
|
| 154 |
-
use_original
|
| 155 |
-
)
|
| 156 |
-
):
|
| 157 |
-
gr_warning(translations["turn_on_use_audio"])
|
| 158 |
-
return return_none
|
| 159 |
-
|
| 160 |
-
if use_original:
|
| 161 |
-
if convert_backing:
|
| 162 |
-
gr_warning(translations["turn_off_convert_backup"])
|
| 163 |
-
return return_none
|
| 164 |
-
elif not_merge_backing:
|
| 165 |
-
gr_warning(translations["turn_off_merge_backup"])
|
| 166 |
-
return return_none
|
| 167 |
-
|
| 168 |
-
if (
|
| 169 |
-
not model or
|
| 170 |
-
not os.path.exists(model_path) or
|
| 171 |
-
os.path.isdir(model_path) or
|
| 172 |
-
not model.endswith((".pth", ".onnx"))
|
| 173 |
-
):
|
| 174 |
-
gr_warning(translations["provide_file"].format(filename=translations["model"]))
|
| 175 |
-
return return_none
|
| 176 |
-
|
| 177 |
-
f0method, embedder_model = (
|
| 178 |
-
f0_method if f0_method != "hybrid" else hybrid_method,
|
| 179 |
-
embedders if embedders != "custom" else custom_embedders
|
| 180 |
-
)
|
| 181 |
-
|
| 182 |
-
if use_separate_audio:
|
| 183 |
-
output_audio = os.path.join(configs["audios_path"], input_audio_name)
|
| 184 |
-
|
| 185 |
-
from main.library.audio.audio import pydub_load
|
| 186 |
-
|
| 187 |
-
def get_audio_file(label):
|
| 188 |
-
matching_files = [f for f in os.listdir(output_audio) if label in f]
|
| 189 |
-
|
| 190 |
-
if not matching_files: return translations["notfound"]
|
| 191 |
-
return os.path.join(output_audio, matching_files[0])
|
| 192 |
-
|
| 193 |
-
output_path = os.path.join(output_audio, f"Convert_Vocals.{export_format}")
|
| 194 |
-
output_backing = os.path.join(output_audio, f"Convert_Backing.{export_format}")
|
| 195 |
-
output_merge_backup = os.path.join(output_audio, f"Vocals+Backing.{export_format}")
|
| 196 |
-
output_merge_instrument = os.path.join(output_audio, f"Vocals+Instruments.{export_format}")
|
| 197 |
-
|
| 198 |
-
if os.path.exists(output_audio): os.makedirs(output_audio, exist_ok=True)
|
| 199 |
-
output_path = process_output(output_path)
|
| 200 |
-
|
| 201 |
-
if use_original:
|
| 202 |
-
original_vocal = get_audio_file('Original_Vocals_No_Reverb.')
|
| 203 |
-
if original_vocal == translations["notfound"]:
|
| 204 |
-
original_vocal = get_audio_file('Original_Vocals.')
|
| 205 |
-
|
| 206 |
-
if original_vocal == translations["notfound"]:
|
| 207 |
-
gr_warning(translations["not_found_original_vocal"])
|
| 208 |
-
return return_none
|
| 209 |
-
|
| 210 |
-
input_path = original_vocal
|
| 211 |
-
else:
|
| 212 |
-
main_vocal = get_audio_file('Main_Vocals_No_Reverb.')
|
| 213 |
-
backing_vocal = get_audio_file('Backing_Vocals.')
|
| 214 |
-
|
| 215 |
-
if main_vocal == translations["notfound"]:
|
| 216 |
-
main_vocal = get_audio_file('Main_Vocals.')
|
| 217 |
-
|
| 218 |
-
if main_vocal == translations["notfound"]:
|
| 219 |
-
gr_warning(translations["not_found_main_vocal"])
|
| 220 |
-
return return_none
|
| 221 |
-
|
| 222 |
-
if (
|
| 223 |
-
not not_merge_backing and
|
| 224 |
-
backing_vocal == translations["notfound"]
|
| 225 |
-
):
|
| 226 |
-
gr_warning(translations["not_found_backing_vocal"])
|
| 227 |
-
return return_none
|
| 228 |
-
|
| 229 |
-
input_path = main_vocal
|
| 230 |
-
backing_path = backing_vocal
|
| 231 |
-
|
| 232 |
-
gr_info(translations["convert_vocal"])
|
| 233 |
-
|
| 234 |
-
convert(
|
| 235 |
-
pitch,
|
| 236 |
-
filter_radius,
|
| 237 |
-
index_rate,
|
| 238 |
-
rms_mix_rate,
|
| 239 |
-
protect,
|
| 240 |
-
hop_length,
|
| 241 |
-
f0method,
|
| 242 |
-
input_path,
|
| 243 |
-
output_path,
|
| 244 |
-
model_path,
|
| 245 |
-
index,
|
| 246 |
-
autotune,
|
| 247 |
-
clean_audio,
|
| 248 |
-
clean_strength,
|
| 249 |
-
export_format,
|
| 250 |
-
embedder_model,
|
| 251 |
-
resample_sr,
|
| 252 |
-
split_audio,
|
| 253 |
-
f0_autotune_strength,
|
| 254 |
-
checkpointing,
|
| 255 |
-
predictor_onnx,
|
| 256 |
-
embedders_mode,
|
| 257 |
-
formant_shifting,
|
| 258 |
-
formant_qfrency,
|
| 259 |
-
formant_timbre,
|
| 260 |
-
f0_file,
|
| 261 |
-
proposal_pitch,
|
| 262 |
-
proposal_pitch_threshold,
|
| 263 |
-
audio_processing,
|
| 264 |
-
alpha,
|
| 265 |
-
sid,
|
| 266 |
-
embedders_mix,
|
| 267 |
-
embedders_mix_layers,
|
| 268 |
-
embedders_mix_ratio,
|
| 269 |
-
noise_scale,
|
| 270 |
-
nprobe,
|
| 271 |
-
audio_upscaler
|
| 272 |
-
)
|
| 273 |
-
|
| 274 |
-
gr_info(translations["convert_success"])
|
| 275 |
-
|
| 276 |
-
if convert_backing:
|
| 277 |
-
output_backing = process_output(output_backing)
|
| 278 |
-
gr_info(translations["convert_backup"])
|
| 279 |
-
|
| 280 |
-
convert(
|
| 281 |
-
pitch,
|
| 282 |
-
filter_radius,
|
| 283 |
-
index_rate,
|
| 284 |
-
rms_mix_rate,
|
| 285 |
-
protect,
|
| 286 |
-
hop_length,
|
| 287 |
-
f0method,
|
| 288 |
-
backing_path,
|
| 289 |
-
output_backing,
|
| 290 |
-
model_path,
|
| 291 |
-
index,
|
| 292 |
-
autotune,
|
| 293 |
-
clean_audio,
|
| 294 |
-
clean_strength,
|
| 295 |
-
export_format,
|
| 296 |
-
embedder_model,
|
| 297 |
-
resample_sr,
|
| 298 |
-
split_audio,
|
| 299 |
-
f0_autotune_strength,
|
| 300 |
-
checkpointing,
|
| 301 |
-
predictor_onnx,
|
| 302 |
-
embedders_mode,
|
| 303 |
-
formant_shifting,
|
| 304 |
-
formant_qfrency,
|
| 305 |
-
formant_timbre,
|
| 306 |
-
f0_file,
|
| 307 |
-
proposal_pitch,
|
| 308 |
-
proposal_pitch_threshold,
|
| 309 |
-
audio_processing,
|
| 310 |
-
alpha,
|
| 311 |
-
sid,
|
| 312 |
-
embedders_mix,
|
| 313 |
-
embedders_mix_layers,
|
| 314 |
-
embedders_mix_ratio,
|
| 315 |
-
noise_scale,
|
| 316 |
-
nprobe,
|
| 317 |
-
audio_upscaler
|
| 318 |
-
)
|
| 319 |
-
|
| 320 |
-
gr_info(translations["convert_backup_success"])
|
| 321 |
-
|
| 322 |
-
try:
|
| 323 |
-
if not not_merge_backing and not use_original:
|
| 324 |
-
backing_source = (
|
| 325 |
-
output_backing
|
| 326 |
-
if convert_backing else
|
| 327 |
-
backing_vocal
|
| 328 |
-
)
|
| 329 |
-
|
| 330 |
-
output_merge_backup = process_output(output_merge_backup)
|
| 331 |
-
|
| 332 |
-
gr_info(translations["merge_backup"])
|
| 333 |
-
|
| 334 |
-
pydub_load(
|
| 335 |
-
output_path,
|
| 336 |
-
volume=-4
|
| 337 |
-
).overlay(
|
| 338 |
-
pydub_load(
|
| 339 |
-
backing_source,
|
| 340 |
-
volume=-6
|
| 341 |
-
)
|
| 342 |
-
).export(
|
| 343 |
-
output_merge_backup,
|
| 344 |
-
format=export_format
|
| 345 |
-
)
|
| 346 |
-
|
| 347 |
-
gr_info(translations["merge_success"])
|
| 348 |
-
|
| 349 |
-
if merge_instrument:
|
| 350 |
-
vocals = (
|
| 351 |
-
output_merge_backup
|
| 352 |
-
if not not_merge_backing and not use_original else
|
| 353 |
-
output_path
|
| 354 |
-
)
|
| 355 |
-
|
| 356 |
-
output_merge_instrument = process_output(output_merge_instrument)
|
| 357 |
-
gr_info(translations["merge_instruments_process"])
|
| 358 |
-
|
| 359 |
-
instruments = get_audio_file('Instruments.')
|
| 360 |
-
if instruments == translations["notfound"]:
|
| 361 |
-
gr_warning(translations["not_found_instruments"])
|
| 362 |
-
|
| 363 |
-
output_merge_instrument = None
|
| 364 |
-
else:
|
| 365 |
-
pydub_load(
|
| 366 |
-
instruments,
|
| 367 |
-
volume=-7
|
| 368 |
-
).overlay(
|
| 369 |
-
pydub_load(
|
| 370 |
-
vocals,
|
| 371 |
-
volume=-4 if use_original else None
|
| 372 |
-
)
|
| 373 |
-
).export(
|
| 374 |
-
output_merge_instrument,
|
| 375 |
-
format=export_format
|
| 376 |
-
)
|
| 377 |
-
|
| 378 |
-
gr_info(translations["merge_success"])
|
| 379 |
-
except:
|
| 380 |
-
return return_none
|
| 381 |
-
|
| 382 |
-
return [
|
| 383 |
-
(None if use_original else output_path),
|
| 384 |
-
output_backing,
|
| 385 |
-
(None if not_merge_backing and use_original else output_merge_backup),
|
| 386 |
-
(output_path if use_original else None),
|
| 387 |
-
(output_merge_instrument if merge_instrument else None),
|
| 388 |
-
{"visible": True, "__type__": "update"}
|
| 389 |
-
]
|
| 390 |
-
else:
|
| 391 |
-
if not input_path or not os.path.exists(input_path):
|
| 392 |
-
gr_warning(translations["input_not_valid"])
|
| 393 |
-
return return_none
|
| 394 |
-
|
| 395 |
-
if not output_path:
|
| 396 |
-
gr_warning(translations["output_not_valid"])
|
| 397 |
-
return return_none
|
| 398 |
-
|
| 399 |
-
output_path = replace_export_format(output_path, export_format)
|
| 400 |
-
|
| 401 |
-
if os.path.isdir(input_path):
|
| 402 |
-
gr_info(translations["is_folder"])
|
| 403 |
-
|
| 404 |
-
if not [
|
| 405 |
-
f for f in os.listdir(input_path)
|
| 406 |
-
if f.lower().endswith(tuple(file_types))
|
| 407 |
-
]:
|
| 408 |
-
gr_warning(translations["not_found_in_folder"])
|
| 409 |
-
return return_none
|
| 410 |
-
|
| 411 |
-
gr_info(translations["batch_convert"])
|
| 412 |
-
output_dir = os.path.dirname(output_path) or output_path
|
| 413 |
-
|
| 414 |
-
convert(
|
| 415 |
-
pitch,
|
| 416 |
-
filter_radius,
|
| 417 |
-
index_rate,
|
| 418 |
-
rms_mix_rate,
|
| 419 |
-
protect,
|
| 420 |
-
hop_length,
|
| 421 |
-
f0method,
|
| 422 |
-
input_path,
|
| 423 |
-
output_dir,
|
| 424 |
-
model_path,
|
| 425 |
-
index,
|
| 426 |
-
autotune,
|
| 427 |
-
clean_audio,
|
| 428 |
-
clean_strength,
|
| 429 |
-
export_format,
|
| 430 |
-
embedder_model,
|
| 431 |
-
resample_sr,
|
| 432 |
-
split_audio,
|
| 433 |
-
f0_autotune_strength,
|
| 434 |
-
checkpointing,
|
| 435 |
-
predictor_onnx,
|
| 436 |
-
embedders_mode,
|
| 437 |
-
formant_shifting,
|
| 438 |
-
formant_qfrency,
|
| 439 |
-
formant_timbre,
|
| 440 |
-
f0_file,
|
| 441 |
-
proposal_pitch,
|
| 442 |
-
proposal_pitch_threshold,
|
| 443 |
-
audio_processing,
|
| 444 |
-
alpha,
|
| 445 |
-
sid,
|
| 446 |
-
embedders_mix,
|
| 447 |
-
embedders_mix_layers,
|
| 448 |
-
embedders_mix_ratio,
|
| 449 |
-
noise_scale,
|
| 450 |
-
nprobe,
|
| 451 |
-
audio_upscaler
|
| 452 |
-
)
|
| 453 |
-
|
| 454 |
-
gr_info(translations["batch_convert_success"])
|
| 455 |
-
|
| 456 |
-
return return_none
|
| 457 |
-
else:
|
| 458 |
-
output_dir = os.path.dirname(output_path) or output_path
|
| 459 |
-
|
| 460 |
-
if not os.path.exists(output_dir): os.makedirs(output_dir, exist_ok=True)
|
| 461 |
-
output_path = process_output(output_path)
|
| 462 |
-
|
| 463 |
-
gr_info(translations["convert_vocal"])
|
| 464 |
-
|
| 465 |
-
convert(
|
| 466 |
-
pitch,
|
| 467 |
-
filter_radius,
|
| 468 |
-
index_rate,
|
| 469 |
-
rms_mix_rate,
|
| 470 |
-
protect,
|
| 471 |
-
hop_length,
|
| 472 |
-
f0method,
|
| 473 |
-
input_path,
|
| 474 |
-
output_path,
|
| 475 |
-
model_path,
|
| 476 |
-
index,
|
| 477 |
-
autotune,
|
| 478 |
-
clean_audio,
|
| 479 |
-
clean_strength,
|
| 480 |
-
export_format,
|
| 481 |
-
embedder_model,
|
| 482 |
-
resample_sr,
|
| 483 |
-
split_audio,
|
| 484 |
-
f0_autotune_strength,
|
| 485 |
-
checkpointing,
|
| 486 |
-
predictor_onnx,
|
| 487 |
-
embedders_mode,
|
| 488 |
-
formant_shifting,
|
| 489 |
-
formant_qfrency,
|
| 490 |
-
formant_timbre,
|
| 491 |
-
f0_file,
|
| 492 |
-
proposal_pitch,
|
| 493 |
-
proposal_pitch_threshold,
|
| 494 |
-
audio_processing,
|
| 495 |
-
alpha,
|
| 496 |
-
sid,
|
| 497 |
-
embedders_mix,
|
| 498 |
-
embedders_mix_layers,
|
| 499 |
-
embedders_mix_ratio,
|
| 500 |
-
noise_scale,
|
| 501 |
-
nprobe,
|
| 502 |
-
audio_upscaler
|
| 503 |
-
)
|
| 504 |
-
|
| 505 |
-
gr_info(translations["convert_success"])
|
| 506 |
-
|
| 507 |
-
return_none[0] = output_path
|
| 508 |
-
return return_none
|
| 509 |
-
|
| 510 |
-
def convert_selection(
|
| 511 |
-
clean_audio,
|
| 512 |
-
autotune,
|
| 513 |
-
use_separate_audio,
|
| 514 |
-
use_original,
|
| 515 |
-
convert_backing,
|
| 516 |
-
not_merge_backing,
|
| 517 |
-
merge_instrument,
|
| 518 |
-
pitch,
|
| 519 |
-
clean_strength,
|
| 520 |
-
model,
|
| 521 |
-
index,
|
| 522 |
-
index_rate,
|
| 523 |
-
input_path,
|
| 524 |
-
output_path,
|
| 525 |
-
export_format,
|
| 526 |
-
f0_method,
|
| 527 |
-
hybrid_method,
|
| 528 |
-
hop_length,
|
| 529 |
-
embedders,
|
| 530 |
-
custom_embedders,
|
| 531 |
-
resample_sr,
|
| 532 |
-
filter_radius,
|
| 533 |
-
rms_mix_rate,
|
| 534 |
-
protect,
|
| 535 |
-
split_audio,
|
| 536 |
-
f0_autotune_strength,
|
| 537 |
-
checkpointing,
|
| 538 |
-
predictor_onnx,
|
| 539 |
-
formant_shifting,
|
| 540 |
-
formant_qfrency,
|
| 541 |
-
formant_timbre,
|
| 542 |
-
f0_file,
|
| 543 |
-
embedders_mode,
|
| 544 |
-
proposal_pitch,
|
| 545 |
-
proposal_pitch_threshold,
|
| 546 |
-
audio_processing=False,
|
| 547 |
-
alpha=0.5,
|
| 548 |
-
sid=0,
|
| 549 |
-
embedders_mix = False,
|
| 550 |
-
embedders_mix_layers = 9,
|
| 551 |
-
embedders_mix_ratio = 0.5,
|
| 552 |
-
noise_scale = 0.35,
|
| 553 |
-
nprobe = 1,
|
| 554 |
-
audio_upscaler = False
|
| 555 |
-
):
|
| 556 |
-
if use_separate_audio:
|
| 557 |
-
gr_info(translations["search_separate"])
|
| 558 |
-
choice = [
|
| 559 |
-
f for f in os.listdir(configs["audios_path"])
|
| 560 |
-
if os.path.isdir(os.path.join(configs["audios_path"], f))
|
| 561 |
-
] if config.debug_mode else [
|
| 562 |
-
f for f in os.listdir(configs["audios_path"])
|
| 563 |
-
if (
|
| 564 |
-
os.path.isdir(os.path.join(configs["audios_path"], f)) and any(
|
| 565 |
-
file.lower().endswith(tuple(file_types))
|
| 566 |
-
for file in os.listdir(os.path.join(configs["audios_path"], f))
|
| 567 |
-
)
|
| 568 |
-
)
|
| 569 |
-
]
|
| 570 |
-
|
| 571 |
-
gr_info(translations["found_choice"].format(choice=len(choice)))
|
| 572 |
-
|
| 573 |
-
if len(choice) == 0:
|
| 574 |
-
gr_warning(translations["separator==0"])
|
| 575 |
-
|
| 576 |
-
return [
|
| 577 |
-
{
|
| 578 |
-
"choices": [],
|
| 579 |
-
"value": "",
|
| 580 |
-
"interactive": False,
|
| 581 |
-
"visible": False if gradio_version else "hidden",
|
| 582 |
-
"__type__": "update"
|
| 583 |
-
},
|
| 584 |
-
None,
|
| 585 |
-
None,
|
| 586 |
-
None,
|
| 587 |
-
None,
|
| 588 |
-
None,
|
| 589 |
-
{
|
| 590 |
-
"visible": True,
|
| 591 |
-
"__type__": "update"
|
| 592 |
-
},
|
| 593 |
-
{
|
| 594 |
-
"visible": False if gradio_version else "hidden",
|
| 595 |
-
"__type__": "update"
|
| 596 |
-
}
|
| 597 |
-
]
|
| 598 |
-
elif len(choice) == 1:
|
| 599 |
-
convert_output = convert_audio(
|
| 600 |
-
clean_audio,
|
| 601 |
-
autotune,
|
| 602 |
-
use_separate_audio,
|
| 603 |
-
use_original,
|
| 604 |
-
convert_backing,
|
| 605 |
-
not_merge_backing,
|
| 606 |
-
merge_instrument,
|
| 607 |
-
pitch,
|
| 608 |
-
clean_strength,
|
| 609 |
-
model,
|
| 610 |
-
index,
|
| 611 |
-
index_rate,
|
| 612 |
-
None,
|
| 613 |
-
None,
|
| 614 |
-
export_format,
|
| 615 |
-
f0_method,
|
| 616 |
-
hybrid_method,
|
| 617 |
-
hop_length,
|
| 618 |
-
embedders,
|
| 619 |
-
custom_embedders,
|
| 620 |
-
resample_sr,
|
| 621 |
-
filter_radius,
|
| 622 |
-
rms_mix_rate,
|
| 623 |
-
protect,
|
| 624 |
-
split_audio,
|
| 625 |
-
f0_autotune_strength,
|
| 626 |
-
choice[0],
|
| 627 |
-
checkpointing,
|
| 628 |
-
predictor_onnx,
|
| 629 |
-
formant_shifting,
|
| 630 |
-
formant_qfrency,
|
| 631 |
-
formant_timbre,
|
| 632 |
-
f0_file,
|
| 633 |
-
embedders_mode,
|
| 634 |
-
proposal_pitch,
|
| 635 |
-
proposal_pitch_threshold,
|
| 636 |
-
audio_processing,
|
| 637 |
-
alpha,
|
| 638 |
-
sid,
|
| 639 |
-
embedders_mix,
|
| 640 |
-
embedders_mix_layers,
|
| 641 |
-
embedders_mix_ratio,
|
| 642 |
-
noise_scale,
|
| 643 |
-
nprobe,
|
| 644 |
-
audio_upscaler
|
| 645 |
-
)
|
| 646 |
-
|
| 647 |
-
return [
|
| 648 |
-
{
|
| 649 |
-
"choices": [],
|
| 650 |
-
"value": "",
|
| 651 |
-
"interactive": False,
|
| 652 |
-
"visible": False if gradio_version else "hidden",
|
| 653 |
-
"__type__": "update"
|
| 654 |
-
},
|
| 655 |
-
convert_output[0],
|
| 656 |
-
convert_output[1],
|
| 657 |
-
convert_output[2],
|
| 658 |
-
convert_output[3],
|
| 659 |
-
convert_output[4],
|
| 660 |
-
{
|
| 661 |
-
"visible": True,
|
| 662 |
-
"__type__": "update"
|
| 663 |
-
},
|
| 664 |
-
{
|
| 665 |
-
"visible": False if gradio_version else "hidden",
|
| 666 |
-
"__type__": "update"
|
| 667 |
-
}
|
| 668 |
-
]
|
| 669 |
-
else:
|
| 670 |
-
return [
|
| 671 |
-
{
|
| 672 |
-
"choices": choice,
|
| 673 |
-
"value": choice[0],
|
| 674 |
-
"interactive": True,
|
| 675 |
-
"visible": True,
|
| 676 |
-
"__type__": "update"
|
| 677 |
-
},
|
| 678 |
-
None,
|
| 679 |
-
None,
|
| 680 |
-
None,
|
| 681 |
-
None,
|
| 682 |
-
None,
|
| 683 |
-
{
|
| 684 |
-
"visible": False if gradio_version else "hidden",
|
| 685 |
-
"__type__": "update"
|
| 686 |
-
},
|
| 687 |
-
{
|
| 688 |
-
"visible": True,
|
| 689 |
-
"__type__": "update"
|
| 690 |
-
}
|
| 691 |
-
]
|
| 692 |
-
else:
|
| 693 |
-
main_convert = convert_audio(
|
| 694 |
-
clean_audio,
|
| 695 |
-
autotune,
|
| 696 |
-
use_separate_audio,
|
| 697 |
-
use_original,
|
| 698 |
-
convert_backing,
|
| 699 |
-
not_merge_backing,
|
| 700 |
-
merge_instrument,
|
| 701 |
-
pitch,
|
| 702 |
-
clean_strength,
|
| 703 |
-
model,
|
| 704 |
-
index,
|
| 705 |
-
index_rate,
|
| 706 |
-
input_path,
|
| 707 |
-
output_path,
|
| 708 |
-
export_format,
|
| 709 |
-
f0_method,
|
| 710 |
-
hybrid_method,
|
| 711 |
-
hop_length,
|
| 712 |
-
embedders,
|
| 713 |
-
custom_embedders,
|
| 714 |
-
resample_sr,
|
| 715 |
-
filter_radius,
|
| 716 |
-
rms_mix_rate,
|
| 717 |
-
protect,
|
| 718 |
-
split_audio,
|
| 719 |
-
f0_autotune_strength,
|
| 720 |
-
None,
|
| 721 |
-
checkpointing,
|
| 722 |
-
predictor_onnx,
|
| 723 |
-
formant_shifting,
|
| 724 |
-
formant_qfrency,
|
| 725 |
-
formant_timbre,
|
| 726 |
-
f0_file,
|
| 727 |
-
embedders_mode,
|
| 728 |
-
proposal_pitch,
|
| 729 |
-
proposal_pitch_threshold,
|
| 730 |
-
audio_processing,
|
| 731 |
-
alpha,
|
| 732 |
-
sid,
|
| 733 |
-
embedders_mix,
|
| 734 |
-
embedders_mix_layers,
|
| 735 |
-
embedders_mix_ratio,
|
| 736 |
-
noise_scale,
|
| 737 |
-
nprobe,
|
| 738 |
-
audio_upscaler
|
| 739 |
-
)
|
| 740 |
-
|
| 741 |
-
return [
|
| 742 |
-
{
|
| 743 |
-
"choices": [],
|
| 744 |
-
"value": "",
|
| 745 |
-
"interactive": False,
|
| 746 |
-
"visible": False if gradio_version else "hidden",
|
| 747 |
-
"__type__": "update"
|
| 748 |
-
},
|
| 749 |
-
main_convert[0],
|
| 750 |
-
None,
|
| 751 |
-
None,
|
| 752 |
-
None,
|
| 753 |
-
None,
|
| 754 |
-
{
|
| 755 |
-
"visible": True,
|
| 756 |
-
"__type__": "update"
|
| 757 |
-
},
|
| 758 |
-
{
|
| 759 |
-
"visible": False if gradio_version else "hidden",
|
| 760 |
-
"__type__": "update"
|
| 761 |
-
}
|
| 762 |
-
]
|
| 763 |
-
|
| 764 |
-
def convert_with_vad(
|
| 765 |
-
num_spk,
|
| 766 |
-
cleaner,
|
| 767 |
-
clean_strength,
|
| 768 |
-
autotune,
|
| 769 |
-
f0_autotune_strength,
|
| 770 |
-
checkpointing,
|
| 771 |
-
model_1,
|
| 772 |
-
model_2,
|
| 773 |
-
model_index_1,
|
| 774 |
-
model_index_2,
|
| 775 |
-
pitch_1,
|
| 776 |
-
pitch_2,
|
| 777 |
-
index_strength_1,
|
| 778 |
-
index_strength_2,
|
| 779 |
-
export_format,
|
| 780 |
-
input_audio,
|
| 781 |
-
output_audio,
|
| 782 |
-
predictor_onnx,
|
| 783 |
-
f0_method,
|
| 784 |
-
hybrid_method,
|
| 785 |
-
hop_length,
|
| 786 |
-
embed_mode,
|
| 787 |
-
embedders,
|
| 788 |
-
custom_embedders,
|
| 789 |
-
resample_sr,
|
| 790 |
-
filter_radius,
|
| 791 |
-
rms_mix_rate,
|
| 792 |
-
protect,
|
| 793 |
-
formant_shifting,
|
| 794 |
-
formant_qfrency_1,
|
| 795 |
-
formant_timbre_1,
|
| 796 |
-
formant_qfrency_2,
|
| 797 |
-
formant_timbre_2,
|
| 798 |
-
proposal_pitch,
|
| 799 |
-
proposal_pitch_threshold,
|
| 800 |
-
audio_processing=False,
|
| 801 |
-
alpha=0.5,
|
| 802 |
-
sid_1=0,
|
| 803 |
-
sid_2=0,
|
| 804 |
-
embedders_mix = False,
|
| 805 |
-
embedders_mix_layers = 9,
|
| 806 |
-
embedders_mix_ratio = 0.5,
|
| 807 |
-
noise_scale_1 = 0.35,
|
| 808 |
-
noise_scale_2 = 0.35,
|
| 809 |
-
vad_sensitivity = 3,
|
| 810 |
-
vad_frame_ms = 30,
|
| 811 |
-
nprobe_1 = 1,
|
| 812 |
-
nprobe_2 = 1
|
| 813 |
-
):
|
| 814 |
-
from pydub import AudioSegment
|
| 815 |
-
from sklearn.cluster import AgglomerativeClustering
|
| 816 |
-
|
| 817 |
-
from main.library.utils import clear_gpu_cache
|
| 818 |
-
from main.library.utils import check_spk_diarization
|
| 819 |
-
from main.library.speaker_diarization.audio import Audio
|
| 820 |
-
from main.inference.realtime.vad_utils import VADProcessor
|
| 821 |
-
from main.library.audio.audio import load_audio, pydub_load
|
| 822 |
-
from main.library.speaker_diarization.segment import Segment
|
| 823 |
-
from main.library.speaker_diarization.embedding import SpeechBrainPretrainedSpeakerEmbedding
|
| 824 |
-
|
| 825 |
-
check_spk_diarization(model_size=None)
|
| 826 |
-
model_pth_1, model_pth_2 = (
|
| 827 |
-
os.path.join(configs["weights_path"], model_1) if not os.path.exists(model_1) else model_1,
|
| 828 |
-
os.path.join(configs["weights_path"], model_2) if not os.path.exists(model_2) else model_2
|
| 829 |
-
)
|
| 830 |
-
|
| 831 |
-
if (
|
| 832 |
-
not model_1 or
|
| 833 |
-
not os.path.exists(model_pth_1) or
|
| 834 |
-
os.path.isdir(model_pth_1) or
|
| 835 |
-
not model_pth_1.endswith((".pth", ".onnx"))
|
| 836 |
-
) and (
|
| 837 |
-
not model_2 or
|
| 838 |
-
not os.path.exists(model_pth_2) or
|
| 839 |
-
os.path.isdir(model_pth_2) or
|
| 840 |
-
not model_pth_2.endswith((".pth", ".onnx"))
|
| 841 |
-
):
|
| 842 |
-
gr_warning(translations["provide_file"].format(filename=translations["model"]))
|
| 843 |
-
return None
|
| 844 |
-
|
| 845 |
-
if not model_1: model_pth_1 = model_pth_2
|
| 846 |
-
if not model_2: model_pth_2 = model_pth_1
|
| 847 |
-
|
| 848 |
-
if not input_audio or not os.path.exists(input_audio) or os.path.isdir(input_audio):
|
| 849 |
-
gr_warning(translations["input_not_valid"])
|
| 850 |
-
return None
|
| 851 |
-
|
| 852 |
-
if not output_audio:
|
| 853 |
-
gr_warning(translations["output_not_valid"])
|
| 854 |
-
return None
|
| 855 |
-
|
| 856 |
-
output_audio = process_output(output_audio)
|
| 857 |
-
gr_info(translations["start_vad"])
|
| 858 |
-
|
| 859 |
-
try:
|
| 860 |
-
y, sr = load_audio(input_audio, sample_rate=48000, return_sr=True)
|
| 861 |
-
|
| 862 |
-
vad_processor = VADProcessor(sensitivity_mode=vad_sensitivity, frame_duration_ms=vad_frame_ms, sample_rate=sr)
|
| 863 |
-
segments = vad_processor.get_speech(y)
|
| 864 |
-
|
| 865 |
-
if not segments:
|
| 866 |
-
gr_warning(translations["speech_not_in_segments"])
|
| 867 |
-
return None
|
| 868 |
-
|
| 869 |
-
audio = Audio()
|
| 870 |
-
|
| 871 |
-
embedding_model = SpeechBrainPretrainedSpeakerEmbedding(
|
| 872 |
-
embedding=os.path.join(configs["speaker_diarization_path"], "models", "speechbrain"),
|
| 873 |
-
device=config.device
|
| 874 |
-
)
|
| 875 |
-
|
| 876 |
-
def segment_embedding(segment):
|
| 877 |
-
waveform, _ = audio.crop(
|
| 878 |
-
input_audio,
|
| 879 |
-
Segment(
|
| 880 |
-
segment["start"],
|
| 881 |
-
segment["end"]
|
| 882 |
-
)
|
| 883 |
-
)
|
| 884 |
-
|
| 885 |
-
return embedding_model(
|
| 886 |
-
waveform.mean(dim=0, keepdim=True)[None] if waveform.shape[0] == 2 else waveform[None]
|
| 887 |
-
)
|
| 888 |
-
|
| 889 |
-
def get_formatted_stats(merged_segments):
|
| 890 |
-
rows, lines = [], []
|
| 891 |
-
speaker_stats = {}
|
| 892 |
-
headers = translations["headers"].split(" ")
|
| 893 |
-
|
| 894 |
-
for seg in merged_segments:
|
| 895 |
-
spk = seg["speaker"]
|
| 896 |
-
start_t = seg["start"]
|
| 897 |
-
end_t = seg["end"]
|
| 898 |
-
dur = end_t - start_t
|
| 899 |
-
|
| 900 |
-
time_range = f"{str(datetime.timedelta(seconds=int(start_t)))} -> {str(datetime.timedelta(seconds=int(end_t)))}"
|
| 901 |
-
dur_str = f"{dur:.2f}s"
|
| 902 |
-
|
| 903 |
-
rows.append([spk, time_range, dur_str])
|
| 904 |
-
speaker_stats[spk] = speaker_stats.get(spk, 0.0) + dur
|
| 905 |
-
col_widths = []
|
| 906 |
-
for i in range(3):
|
| 907 |
-
max_len = max(len(headers[i].replace("-", " ")), *(len(row[i]) for row in rows))
|
| 908 |
-
col_widths.append(max_len)
|
| 909 |
-
|
| 910 |
-
def make_line(left, mid, right):
|
| 911 |
-
return left + mid.join("─" * (w + 2) for w in col_widths) + right
|
| 912 |
-
|
| 913 |
-
def format_row(row):
|
| 914 |
-
return "│ " + " │ ".join(f"{cell:<{col_widths[i]}}" for i, cell in enumerate(row)) + " │"
|
| 915 |
-
|
| 916 |
-
lines.append("\n")
|
| 917 |
-
lines.append(make_line("┌", "┬", "┐"))
|
| 918 |
-
lines.append(format_row(headers))
|
| 919 |
-
lines.append(make_line("├", "┼", "┤"))
|
| 920 |
-
|
| 921 |
-
for row in rows:
|
| 922 |
-
lines.append(format_row(row))
|
| 923 |
-
|
| 924 |
-
lines.append(make_line("└", "┴", "┘"))
|
| 925 |
-
return "\n".join(lines)
|
| 926 |
-
|
| 927 |
-
def merge_audio(
|
| 928 |
-
files_list,
|
| 929 |
-
time_stamps,
|
| 930 |
-
original_file_path,
|
| 931 |
-
output_path,
|
| 932 |
-
export_format
|
| 933 |
-
):
|
| 934 |
-
def extract_number(filename):
|
| 935 |
-
match = re.search(r'_(\d+)', filename)
|
| 936 |
-
return int(match.group(1)) if match else 0
|
| 937 |
-
|
| 938 |
-
total_duration = len(pydub_load(original_file_path))
|
| 939 |
-
combined = AudioSegment.empty()
|
| 940 |
-
current_position = 0
|
| 941 |
-
|
| 942 |
-
for file, (start_i, end_i) in zip(sorted(files_list, key=extract_number), time_stamps):
|
| 943 |
-
if start_i > current_position:
|
| 944 |
-
combined += AudioSegment.silent(
|
| 945 |
-
duration=start_i - current_position
|
| 946 |
-
)
|
| 947 |
-
|
| 948 |
-
combined += pydub_load(file)
|
| 949 |
-
current_position = end_i
|
| 950 |
-
|
| 951 |
-
if current_position < total_duration:
|
| 952 |
-
combined += AudioSegment.silent(
|
| 953 |
-
duration=total_duration - current_position
|
| 954 |
-
)
|
| 955 |
-
|
| 956 |
-
combined.export(output_path, format=export_format)
|
| 957 |
-
return output_path
|
| 958 |
-
|
| 959 |
-
embeddings = np.zeros(shape=(len(segments), 192))
|
| 960 |
-
for i, segment in enumerate(segments):
|
| 961 |
-
embeddings[i] = segment_embedding(segment)
|
| 962 |
-
|
| 963 |
-
labels = AgglomerativeClustering(num_spk).fit(np.nan_to_num(embeddings)).labels_
|
| 964 |
-
for i in range(len(segments)):
|
| 965 |
-
segments[i]["speaker"] = f"SPEAKER {labels[i] + 1}"
|
| 966 |
-
|
| 967 |
-
merged_segments = []
|
| 968 |
-
|
| 969 |
-
if segments:
|
| 970 |
-
curr = segments[0].copy()
|
| 971 |
-
|
| 972 |
-
for i in range(1, len(segments)):
|
| 973 |
-
if segments[i]["speaker"] == curr["speaker"]: curr["end"] = segments[i]["end"]
|
| 974 |
-
else:
|
| 975 |
-
merged_segments.append(curr)
|
| 976 |
-
curr = segments[i].copy()
|
| 977 |
-
|
| 978 |
-
merged_segments.append(curr)
|
| 979 |
-
|
| 980 |
-
gr_info(translations["analysis_completed"].format(length=len(merged_segments)))
|
| 981 |
-
|
| 982 |
-
del audio, embedding_model, segments, labels
|
| 983 |
-
clear_gpu_cache()
|
| 984 |
-
gc.collect()
|
| 985 |
-
|
| 986 |
-
gr_info(translations["process_audio"])
|
| 987 |
-
|
| 988 |
-
pydub_audio = pydub_load(input_audio)
|
| 989 |
-
output_folder = "audios_temp"
|
| 990 |
-
|
| 991 |
-
if os.path.exists(output_folder): shutil.rmtree(output_folder, ignore_errors=True)
|
| 992 |
-
|
| 993 |
-
for f in [
|
| 994 |
-
output_folder,
|
| 995 |
-
os.path.join(output_folder, "1"),
|
| 996 |
-
os.path.join(output_folder, "2")
|
| 997 |
-
]:
|
| 998 |
-
os.makedirs(f, exist_ok=True)
|
| 999 |
-
|
| 1000 |
-
time_stamps, processed_segments = [], []
|
| 1001 |
-
for i, seg in enumerate(merged_segments):
|
| 1002 |
-
model_id = 1 if int(seg["speaker"].split()[-1]) % 2 != 0 else 2
|
| 1003 |
-
start_ms, end_ms = int(seg["start"] * 1000), int(seg["end"] * 1000)
|
| 1004 |
-
|
| 1005 |
-
target_path = os.path.join(output_folder, str(model_id), f"segment_{i+1}.wav")
|
| 1006 |
-
pydub_audio[start_ms:end_ms].export(target_path, format="wav")
|
| 1007 |
-
|
| 1008 |
-
processed_segments.append(os.path.join(output_folder, str(model_id), f"segment_{i+1}_output.wav"))
|
| 1009 |
-
time_stamps.append((start_ms, end_ms))
|
| 1010 |
-
|
| 1011 |
-
logger.info(get_formatted_stats(merged_segments))
|
| 1012 |
-
|
| 1013 |
-
f0method, embedder_model = (
|
| 1014 |
-
f0_method if f0_method != "hybrid" else hybrid_method,
|
| 1015 |
-
embedders if embedders != "custom" else custom_embedders
|
| 1016 |
-
)
|
| 1017 |
-
|
| 1018 |
-
gr_info(translations["process_done_start_convert"])
|
| 1019 |
-
|
| 1020 |
-
convert(
|
| 1021 |
-
pitch_1,
|
| 1022 |
-
filter_radius,
|
| 1023 |
-
index_strength_1,
|
| 1024 |
-
rms_mix_rate,
|
| 1025 |
-
protect,
|
| 1026 |
-
hop_length,
|
| 1027 |
-
f0method,
|
| 1028 |
-
os.path.join(output_folder, "1"),
|
| 1029 |
-
output_folder,
|
| 1030 |
-
model_pth_1,
|
| 1031 |
-
model_index_1,
|
| 1032 |
-
autotune,
|
| 1033 |
-
cleaner,
|
| 1034 |
-
clean_strength,
|
| 1035 |
-
"wav",
|
| 1036 |
-
embedder_model,
|
| 1037 |
-
48000 if resample_sr == 0 else resample_sr,
|
| 1038 |
-
False,
|
| 1039 |
-
f0_autotune_strength,
|
| 1040 |
-
checkpointing,
|
| 1041 |
-
predictor_onnx,
|
| 1042 |
-
embed_mode,
|
| 1043 |
-
formant_shifting,
|
| 1044 |
-
formant_qfrency_1,
|
| 1045 |
-
formant_timbre_1,
|
| 1046 |
-
"",
|
| 1047 |
-
proposal_pitch,
|
| 1048 |
-
proposal_pitch_threshold,
|
| 1049 |
-
audio_processing,
|
| 1050 |
-
alpha,
|
| 1051 |
-
sid_1,
|
| 1052 |
-
embedders_mix,
|
| 1053 |
-
embedders_mix_layers,
|
| 1054 |
-
embedders_mix_ratio,
|
| 1055 |
-
noise_scale_1,
|
| 1056 |
-
nprobe_1,
|
| 1057 |
-
False
|
| 1058 |
-
)
|
| 1059 |
-
|
| 1060 |
-
convert(
|
| 1061 |
-
pitch_2,
|
| 1062 |
-
filter_radius,
|
| 1063 |
-
index_strength_2,
|
| 1064 |
-
rms_mix_rate,
|
| 1065 |
-
protect,
|
| 1066 |
-
hop_length,
|
| 1067 |
-
f0method,
|
| 1068 |
-
os.path.join(output_folder, "2"),
|
| 1069 |
-
output_folder,
|
| 1070 |
-
model_pth_2,
|
| 1071 |
-
model_index_2,
|
| 1072 |
-
autotune,
|
| 1073 |
-
cleaner,
|
| 1074 |
-
clean_strength,
|
| 1075 |
-
"wav",
|
| 1076 |
-
embedder_model,
|
| 1077 |
-
48000 if resample_sr == 0 else resample_sr,
|
| 1078 |
-
False,
|
| 1079 |
-
f0_autotune_strength,
|
| 1080 |
-
checkpointing,
|
| 1081 |
-
predictor_onnx,
|
| 1082 |
-
embed_mode,
|
| 1083 |
-
formant_shifting,
|
| 1084 |
-
formant_qfrency_2,
|
| 1085 |
-
formant_timbre_2,
|
| 1086 |
-
"",
|
| 1087 |
-
proposal_pitch,
|
| 1088 |
-
proposal_pitch_threshold,
|
| 1089 |
-
audio_processing,
|
| 1090 |
-
alpha,
|
| 1091 |
-
sid_2,
|
| 1092 |
-
embedders_mix,
|
| 1093 |
-
embedders_mix_layers,
|
| 1094 |
-
embedders_mix_ratio,
|
| 1095 |
-
noise_scale_2,
|
| 1096 |
-
nprobe_2,
|
| 1097 |
-
False
|
| 1098 |
-
)
|
| 1099 |
-
|
| 1100 |
-
gr_info(translations["convert_success"])
|
| 1101 |
-
|
| 1102 |
-
return merge_audio(
|
| 1103 |
-
processed_segments,
|
| 1104 |
-
time_stamps,
|
| 1105 |
-
input_audio,
|
| 1106 |
-
replace_export_format(output_audio, export_format),
|
| 1107 |
-
export_format
|
| 1108 |
-
)
|
| 1109 |
-
except Exception as e:
|
| 1110 |
-
import traceback
|
| 1111 |
-
|
| 1112 |
-
gr_error(translations["error_occurred"].format(e=e))
|
| 1113 |
-
logger.debug(traceback.format_exc())
|
| 1114 |
-
|
| 1115 |
-
return None
|
| 1116 |
-
finally:
|
| 1117 |
-
if os.path.exists("audios_temp"):
|
| 1118 |
-
shutil.rmtree("audios_temp", ignore_errors=True)
|
| 1119 |
-
|
| 1120 |
-
def convert_tts(
|
| 1121 |
-
clean_audio,
|
| 1122 |
-
autotune,
|
| 1123 |
-
pitch,
|
| 1124 |
-
clean_strength,
|
| 1125 |
-
model,
|
| 1126 |
-
index,
|
| 1127 |
-
index_rate,
|
| 1128 |
-
input_path,
|
| 1129 |
-
output_path,
|
| 1130 |
-
export_format,
|
| 1131 |
-
method,
|
| 1132 |
-
hybrid_method,
|
| 1133 |
-
hop_length,
|
| 1134 |
-
embedders,
|
| 1135 |
-
custom_embedders,
|
| 1136 |
-
resample_sr,
|
| 1137 |
-
filter_radius,
|
| 1138 |
-
rms_mix_rate,
|
| 1139 |
-
protect,
|
| 1140 |
-
split_audio,
|
| 1141 |
-
f0_autotune_strength,
|
| 1142 |
-
checkpointing,
|
| 1143 |
-
predictor_onnx,
|
| 1144 |
-
formant_shifting,
|
| 1145 |
-
formant_qfrency,
|
| 1146 |
-
formant_timbre,
|
| 1147 |
-
f0_file,
|
| 1148 |
-
embedders_mode,
|
| 1149 |
-
proposal_pitch,
|
| 1150 |
-
proposal_pitch_threshold,
|
| 1151 |
-
audio_processing=False,
|
| 1152 |
-
alpha=0.5,
|
| 1153 |
-
sid=0,
|
| 1154 |
-
embedders_mix = False,
|
| 1155 |
-
embedders_mix_layers = 9,
|
| 1156 |
-
embedders_mix_ratio = 0.5,
|
| 1157 |
-
noise_scale = 0.35,
|
| 1158 |
-
nprobe = 1,
|
| 1159 |
-
audio_upscaler = False
|
| 1160 |
-
):
|
| 1161 |
-
model_path = os.path.join(configs["weights_path"], model) if not os.path.exists(model) else model
|
| 1162 |
-
|
| 1163 |
-
if (
|
| 1164 |
-
not model_path or
|
| 1165 |
-
not os.path.exists(model_path) or
|
| 1166 |
-
os.path.isdir(model_path) or
|
| 1167 |
-
not model.endswith((".pth", ".onnx"))
|
| 1168 |
-
):
|
| 1169 |
-
gr_warning(translations["provide_file"].format(filename=translations["model"]))
|
| 1170 |
-
return None
|
| 1171 |
-
|
| 1172 |
-
if not input_path or not os.path.exists(input_path):
|
| 1173 |
-
gr_warning(translations["input_not_valid"])
|
| 1174 |
-
return None
|
| 1175 |
-
|
| 1176 |
-
if os.path.isdir(input_path):
|
| 1177 |
-
input_audio = [
|
| 1178 |
-
f for f in os.listdir(input_path)
|
| 1179 |
-
if "tts" in f and f.lower().endswith(tuple(file_types))
|
| 1180 |
-
]
|
| 1181 |
-
|
| 1182 |
-
if not input_audio:
|
| 1183 |
-
gr_warning(translations["not_found_in_folder"])
|
| 1184 |
-
return None
|
| 1185 |
-
|
| 1186 |
-
input_path = os.path.join(input_path, input_audio[0])
|
| 1187 |
-
|
| 1188 |
-
if not output_path:
|
| 1189 |
-
gr_warning(translations["output_not_valid"])
|
| 1190 |
-
return None
|
| 1191 |
-
|
| 1192 |
-
output_path = replace_export_format(output_path, export_format)
|
| 1193 |
-
if os.path.isdir(output_path): output_path = os.path.join(output_path, f"tts.{export_format}")
|
| 1194 |
-
|
| 1195 |
-
output_dir = os.path.dirname(output_path)
|
| 1196 |
-
if not os.path.exists(output_dir): os.makedirs(output_dir, exist_ok=True)
|
| 1197 |
-
|
| 1198 |
-
output_path = process_output(output_path)
|
| 1199 |
-
|
| 1200 |
-
f0method, embedder_model = (
|
| 1201 |
-
method if method != "hybrid" else hybrid_method,
|
| 1202 |
-
embedders if embedders != "custom" else custom_embedders
|
| 1203 |
-
)
|
| 1204 |
-
|
| 1205 |
-
gr_info(translations["convert_vocal"])
|
| 1206 |
-
|
| 1207 |
-
convert(
|
| 1208 |
-
pitch,
|
| 1209 |
-
filter_radius,
|
| 1210 |
-
index_rate,
|
| 1211 |
-
rms_mix_rate,
|
| 1212 |
-
protect,
|
| 1213 |
-
hop_length,
|
| 1214 |
-
f0method,
|
| 1215 |
-
input_path,
|
| 1216 |
-
output_path,
|
| 1217 |
-
model_path,
|
| 1218 |
-
index,
|
| 1219 |
-
autotune,
|
| 1220 |
-
clean_audio,
|
| 1221 |
-
clean_strength,
|
| 1222 |
-
export_format,
|
| 1223 |
-
embedder_model,
|
| 1224 |
-
resample_sr,
|
| 1225 |
-
split_audio,
|
| 1226 |
-
f0_autotune_strength,
|
| 1227 |
-
checkpointing,
|
| 1228 |
-
predictor_onnx,
|
| 1229 |
-
embedders_mode,
|
| 1230 |
-
formant_shifting,
|
| 1231 |
-
formant_qfrency,
|
| 1232 |
-
formant_timbre,
|
| 1233 |
-
f0_file,
|
| 1234 |
-
proposal_pitch,
|
| 1235 |
-
proposal_pitch_threshold,
|
| 1236 |
-
audio_processing,
|
| 1237 |
-
alpha,
|
| 1238 |
-
sid,
|
| 1239 |
-
embedders_mix,
|
| 1240 |
-
embedders_mix_layers,
|
| 1241 |
-
embedders_mix_ratio,
|
| 1242 |
-
noise_scale,
|
| 1243 |
-
nprobe,
|
| 1244 |
-
audio_upscaler
|
| 1245 |
-
)
|
| 1246 |
-
|
| 1247 |
-
gr_info(translations["convert_success"])
|
| 1248 |
-
return output_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/model_utils.py
DELETED
|
@@ -1,301 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import json
|
| 4 |
-
import torch
|
| 5 |
-
import datetime
|
| 6 |
-
|
| 7 |
-
sys.path.append(os.getcwd())
|
| 8 |
-
|
| 9 |
-
from main.app.core.ui import gr_info, gr_warning, gr_error
|
| 10 |
-
from main.app.variables import config, logger, translations, configs
|
| 11 |
-
|
| 12 |
-
def fushion_model_pth(
|
| 13 |
-
name,
|
| 14 |
-
model_path_1,
|
| 15 |
-
model_path_2,
|
| 16 |
-
ratio
|
| 17 |
-
):
|
| 18 |
-
if not name.endswith(".pth"): name = name + ".pth"
|
| 19 |
-
|
| 20 |
-
model_path_1 = os.path.join(configs["weights_path"], model_path_1) if not os.path.exists(model_path_1) else model_path_1
|
| 21 |
-
model_path_2 = os.path.join(configs["weights_path"], model_path_2) if not os.path.exists(model_path_2) else model_path_2
|
| 22 |
-
|
| 23 |
-
if (
|
| 24 |
-
not model_path_1 or
|
| 25 |
-
not os.path.exists(model_path_1) or
|
| 26 |
-
not model_path_1.endswith(".pth")
|
| 27 |
-
):
|
| 28 |
-
gr_warning(translations["provide_file"].format(filename=translations["model"] + " 1"))
|
| 29 |
-
return [translations["provide_file"].format(filename=translations["model"] + " 1"), None]
|
| 30 |
-
|
| 31 |
-
if (
|
| 32 |
-
not model_path_2 or
|
| 33 |
-
not os.path.exists(model_path_2) or
|
| 34 |
-
not model_path_2.endswith(".pth")
|
| 35 |
-
):
|
| 36 |
-
gr_warning(translations["provide_file"].format(filename=translations["model"] + " 2"))
|
| 37 |
-
return [translations["provide_file"].format(filename=translations["model"] + " 2"), None]
|
| 38 |
-
|
| 39 |
-
from collections import OrderedDict
|
| 40 |
-
|
| 41 |
-
def extract(ckpt):
|
| 42 |
-
a = ckpt["model"]
|
| 43 |
-
opt = OrderedDict()
|
| 44 |
-
opt["weight"] = {}
|
| 45 |
-
|
| 46 |
-
for key in a.keys():
|
| 47 |
-
if "enc_q" in key: continue
|
| 48 |
-
|
| 49 |
-
opt["weight"][key] = a[key]
|
| 50 |
-
|
| 51 |
-
return opt
|
| 52 |
-
|
| 53 |
-
try:
|
| 54 |
-
ckpt1 = torch.load(model_path_1, map_location="cpu", weights_only=True)
|
| 55 |
-
ckpt2 = torch.load(model_path_2, map_location="cpu", weights_only=True)
|
| 56 |
-
|
| 57 |
-
if ckpt1["sr"] != ckpt2["sr"]:
|
| 58 |
-
gr_warning(translations["sr_not_same"])
|
| 59 |
-
return [translations["sr_not_same"], None]
|
| 60 |
-
|
| 61 |
-
cfg = ckpt1["config"]
|
| 62 |
-
cfg_f0 = ckpt1["f0"]
|
| 63 |
-
cfg_version = ckpt1["version"]
|
| 64 |
-
cfg_sr = ckpt1["sr"]
|
| 65 |
-
|
| 66 |
-
vocoder = ckpt1.get("vocoder", "Default")
|
| 67 |
-
rms_extract = ckpt1.get("energy", False)
|
| 68 |
-
|
| 69 |
-
ckpt1 = extract(ckpt1) if "model" in ckpt1 else ckpt1["weight"]
|
| 70 |
-
ckpt2 = extract(ckpt2) if "model" in ckpt2 else ckpt2["weight"]
|
| 71 |
-
|
| 72 |
-
if sorted(list(ckpt1.keys())) != sorted(list(ckpt2.keys())):
|
| 73 |
-
gr_warning(translations["architectures_not_same"])
|
| 74 |
-
|
| 75 |
-
return [translations["architectures_not_same"], None]
|
| 76 |
-
|
| 77 |
-
gr_info(translations["start"].format(start=translations["fushion_model"]))
|
| 78 |
-
|
| 79 |
-
opt = OrderedDict()
|
| 80 |
-
opt["weight"] = {}
|
| 81 |
-
|
| 82 |
-
for key in ckpt1.keys():
|
| 83 |
-
if key == "emb_g.weight" and ckpt1[key].shape != ckpt2[key].shape:
|
| 84 |
-
min_shape0 = min(ckpt1[key].shape[0], ckpt2[key].shape[0])
|
| 85 |
-
|
| 86 |
-
opt["weight"][key] = (
|
| 87 |
-
ratio * (ckpt1[key][:min_shape0].float()) + (1 - ratio) * (ckpt2[key][:min_shape0].float())
|
| 88 |
-
).half()
|
| 89 |
-
else:
|
| 90 |
-
opt["weight"][key] = (
|
| 91 |
-
ratio * (ckpt1[key].float()) + (1 - ratio) * (ckpt2[key].float())
|
| 92 |
-
).half()
|
| 93 |
-
|
| 94 |
-
opt["config"] = cfg
|
| 95 |
-
opt["sr"] = cfg_sr
|
| 96 |
-
opt["f0"] = cfg_f0
|
| 97 |
-
opt["version"] = cfg_version
|
| 98 |
-
|
| 99 |
-
opt["infos"] = translations["model_fushion_info"].format(
|
| 100 |
-
name=name,
|
| 101 |
-
model_path_1=model_path_1,
|
| 102 |
-
model_path_2=model_path_2,
|
| 103 |
-
ratio=ratio
|
| 104 |
-
)
|
| 105 |
-
|
| 106 |
-
opt["vocoder"] = vocoder
|
| 107 |
-
opt["energy"] = rms_extract
|
| 108 |
-
|
| 109 |
-
output_model = configs["weights_path"]
|
| 110 |
-
if not os.path.exists(output_model): os.makedirs(output_model, exist_ok=True)
|
| 111 |
-
|
| 112 |
-
torch.save(opt, os.path.join(output_model, name))
|
| 113 |
-
|
| 114 |
-
gr_info(translations["success"])
|
| 115 |
-
return [translations["success"], os.path.join(output_model, name)]
|
| 116 |
-
except Exception as e:
|
| 117 |
-
gr_error(message=translations["error_occurred"].format(e=e))
|
| 118 |
-
return [e, None]
|
| 119 |
-
|
| 120 |
-
def fushion_model(
|
| 121 |
-
modelname,
|
| 122 |
-
model_path_1,
|
| 123 |
-
model_path_2,
|
| 124 |
-
ratio
|
| 125 |
-
):
|
| 126 |
-
if not modelname:
|
| 127 |
-
gr_warning(translations["provide_name_is_save"])
|
| 128 |
-
return [translations["provide_name_is_save"], None]
|
| 129 |
-
|
| 130 |
-
if model_path_1.endswith(".pth") and model_path_2.endswith(".pth"):
|
| 131 |
-
return fushion_model_pth(
|
| 132 |
-
modelname,
|
| 133 |
-
model_path_1,
|
| 134 |
-
model_path_2,
|
| 135 |
-
ratio
|
| 136 |
-
)
|
| 137 |
-
else:
|
| 138 |
-
gr_warning(translations["format_not_valid"])
|
| 139 |
-
return [None, None]
|
| 140 |
-
|
| 141 |
-
def onnx_export(model_path):
|
| 142 |
-
if not model_path.endswith(".pth"): model_path += ".pth"
|
| 143 |
-
model_path = os.path.join(configs["weights_path"], model_path) if not os.path.exists(model_path) else model_path
|
| 144 |
-
|
| 145 |
-
if (
|
| 146 |
-
not model_path or
|
| 147 |
-
not os.path.exists(model_path) or
|
| 148 |
-
not model_path.endswith(".pth")
|
| 149 |
-
):
|
| 150 |
-
return gr_warning(translations["provide_file"].format(filename=translations["model"]))
|
| 151 |
-
|
| 152 |
-
try:
|
| 153 |
-
gr_info(translations["start_onnx_export"])
|
| 154 |
-
|
| 155 |
-
from main.library.onnx.onnx_export import onnx_exporter
|
| 156 |
-
|
| 157 |
-
output = onnx_exporter(
|
| 158 |
-
model_path,
|
| 159 |
-
model_path.replace(".pth", ".onnx"),
|
| 160 |
-
is_half=config.is_half,
|
| 161 |
-
device=config.device
|
| 162 |
-
)
|
| 163 |
-
|
| 164 |
-
gr_info(translations["success"])
|
| 165 |
-
return output
|
| 166 |
-
except Exception as e:
|
| 167 |
-
return gr_error(e)
|
| 168 |
-
|
| 169 |
-
def svc_export(model_path, config_path, modelname, delete_when_success):
|
| 170 |
-
if not model_path.endswith(".pth"): model_path += ".pth"
|
| 171 |
-
model_path = os.path.join(configs["weights_path"], model_path) if not os.path.exists(model_path) else model_path
|
| 172 |
-
|
| 173 |
-
if (
|
| 174 |
-
not model_path or
|
| 175 |
-
not os.path.exists(model_path) or
|
| 176 |
-
not model_path.endswith(".pth")
|
| 177 |
-
):
|
| 178 |
-
gr_warning(translations["provide_file"].format(filename=translations["model"]))
|
| 179 |
-
return None
|
| 180 |
-
|
| 181 |
-
if (
|
| 182 |
-
not config_path or
|
| 183 |
-
not os.path.exists(config_path) or
|
| 184 |
-
not config_path.endswith(".json")
|
| 185 |
-
):
|
| 186 |
-
gr_warning(translations["provide_file"].format(filename=translations["config"]))
|
| 187 |
-
return None
|
| 188 |
-
|
| 189 |
-
if modelname is None: modelname = os.path.basename(model_path)
|
| 190 |
-
if not modelname.endswith(".pth"): modelname += ".pth"
|
| 191 |
-
output_path = os.path.join(configs["weights_path"], modelname) if not os.path.exists(modelname) else modelname
|
| 192 |
-
|
| 193 |
-
if (
|
| 194 |
-
not model_path or
|
| 195 |
-
not os.path.exists(model_path) or
|
| 196 |
-
not model_path.endswith(".pth")
|
| 197 |
-
):
|
| 198 |
-
return gr_warning(translations["provide_file"].format(filename=translations["model"]))
|
| 199 |
-
|
| 200 |
-
try:
|
| 201 |
-
gr_info(translations["start_convert_svc"])
|
| 202 |
-
|
| 203 |
-
from main.tools.export_svc import svc_converter
|
| 204 |
-
|
| 205 |
-
output = svc_converter(
|
| 206 |
-
model_path,
|
| 207 |
-
config_path,
|
| 208 |
-
output_path,
|
| 209 |
-
is_half=config.is_half
|
| 210 |
-
)
|
| 211 |
-
|
| 212 |
-
if output == translations["not_svc"]:
|
| 213 |
-
gr_warning(output)
|
| 214 |
-
return None
|
| 215 |
-
|
| 216 |
-
if delete_when_success: os.remove(model_path); os.remove(config_path)
|
| 217 |
-
gr_info(translations["success"])
|
| 218 |
-
return output
|
| 219 |
-
except Exception as e:
|
| 220 |
-
return gr_error(e)
|
| 221 |
-
|
| 222 |
-
def model_info(model_path):
|
| 223 |
-
model_path = os.path.join(configs["weights_path"], model_path) if not os.path.exists(model_path) else model_path
|
| 224 |
-
|
| 225 |
-
if (
|
| 226 |
-
not model_path or
|
| 227 |
-
not os.path.exists(model_path) or
|
| 228 |
-
os.path.isdir(model_path) or
|
| 229 |
-
not model_path.endswith((".pth", ".onnx"))
|
| 230 |
-
):
|
| 231 |
-
return gr_warning(translations["provide_file"].format(filename=translations["model"]))
|
| 232 |
-
|
| 233 |
-
def prettify_date(date_str):
|
| 234 |
-
if date_str == translations["not_found_create_time"]: return None
|
| 235 |
-
|
| 236 |
-
try:
|
| 237 |
-
return datetime.datetime.strptime(
|
| 238 |
-
date_str,
|
| 239 |
-
"%Y-%m-%dT%H:%M:%S.%f"
|
| 240 |
-
).strftime("%Y-%m-%d %H:%M:%S")
|
| 241 |
-
except ValueError as e:
|
| 242 |
-
logger.debug(e)
|
| 243 |
-
return translations["format_not_valid"]
|
| 244 |
-
|
| 245 |
-
if model_path.endswith(".pth"):
|
| 246 |
-
model_data = torch.load(model_path, map_location="cpu")
|
| 247 |
-
else:
|
| 248 |
-
import onnx
|
| 249 |
-
|
| 250 |
-
model = onnx.load(model_path)
|
| 251 |
-
model_data = None
|
| 252 |
-
|
| 253 |
-
for prop in model.metadata_props:
|
| 254 |
-
if prop.key == "model_info":
|
| 255 |
-
model_data = json.loads(prop.value)
|
| 256 |
-
break
|
| 257 |
-
|
| 258 |
-
gr_info(translations["read_info"])
|
| 259 |
-
|
| 260 |
-
epochs = model_data.get("epoch", None)
|
| 261 |
-
if not epochs:
|
| 262 |
-
epochs = model_data.get("info", None)
|
| 263 |
-
|
| 264 |
-
try:
|
| 265 |
-
epochs = int(epochs.split("e")[0].isdigit())
|
| 266 |
-
if not epochs: epochs = translations["not_found"].format(name=translations["epoch"])
|
| 267 |
-
except:
|
| 268 |
-
epochs = translations["not_found"].format(name=translations["epoch"])
|
| 269 |
-
|
| 270 |
-
steps = model_data.get("step", translations["not_found"].format(name=translations["step"]))
|
| 271 |
-
sr = model_data.get("sr", translations["not_found"].format(name=translations["sr"]))
|
| 272 |
-
f0 = model_data.get("f0", translations["not_found"].format(name=translations["f0"]))
|
| 273 |
-
version = model_data.get("version", translations["not_found"].format(name=translations["version"]))
|
| 274 |
-
creation_date = model_data.get("creation_date", translations["not_found_create_time"])
|
| 275 |
-
model_hash = model_data.get("model_hash", translations["not_found"].format(name="model_hash"))
|
| 276 |
-
pitch_guidance = translations["trained_f0"] if f0 else translations["not_f0"]
|
| 277 |
-
creation_date_str = prettify_date(creation_date) if creation_date else translations["not_found_create_time"]
|
| 278 |
-
model_name = model_data.get("model_name", translations["unregistered"])
|
| 279 |
-
model_author = model_data.get("author", translations["not_author"])
|
| 280 |
-
vocoder = model_data.get("vocoder", "Default")
|
| 281 |
-
rms_extract = model_data.get("energy", False)
|
| 282 |
-
speakers_id = model_data.get("speakers_id", 1)
|
| 283 |
-
architecture = model_data.get("architecture", "RVC")
|
| 284 |
-
|
| 285 |
-
gr_info(translations["success"])
|
| 286 |
-
|
| 287 |
-
return translations["model_info"].format(
|
| 288 |
-
model_name=model_name,
|
| 289 |
-
model_author=model_author,
|
| 290 |
-
epochs=epochs,
|
| 291 |
-
steps=steps,
|
| 292 |
-
version=version,
|
| 293 |
-
sr=sr,
|
| 294 |
-
pitch_guidance=pitch_guidance,
|
| 295 |
-
model_hash=model_hash,
|
| 296 |
-
creation_date_str=creation_date_str,
|
| 297 |
-
vocoder=vocoder,
|
| 298 |
-
rms_extract=rms_extract,
|
| 299 |
-
speakers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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/presets.py
DELETED
|
@@ -1,744 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import json
|
| 4 |
-
|
| 5 |
-
sys.path.append(os.getcwd())
|
| 6 |
-
|
| 7 |
-
from main.app.variables import translations, configs
|
| 8 |
-
from main.app.core.ui import gr_info, gr_warning, change_preset_choices, change_effect_preset_choices, change_realtime_preset_choices
|
| 9 |
-
|
| 10 |
-
def load_presets(
|
| 11 |
-
presets,
|
| 12 |
-
cleaner,
|
| 13 |
-
autotune,
|
| 14 |
-
pitch,
|
| 15 |
-
clean_strength,
|
| 16 |
-
index_strength,
|
| 17 |
-
resample_sr,
|
| 18 |
-
filter_radius,
|
| 19 |
-
rms_mix_rate,
|
| 20 |
-
protect,
|
| 21 |
-
split_audio,
|
| 22 |
-
f0_autotune_strength,
|
| 23 |
-
formant_shifting,
|
| 24 |
-
formant_qfrency,
|
| 25 |
-
formant_timbre,
|
| 26 |
-
proposal_pitch,
|
| 27 |
-
proposal_pitch_threshold,
|
| 28 |
-
embedders_mix,
|
| 29 |
-
embedders_mix_layers,
|
| 30 |
-
embedders_mix_ratio
|
| 31 |
-
):
|
| 32 |
-
if not presets: gr_warning(translations["provide_file_settings"])
|
| 33 |
-
|
| 34 |
-
file = {}
|
| 35 |
-
if presets:
|
| 36 |
-
with open(os.path.join(configs["presets_path"], presets)) as f:
|
| 37 |
-
file = json.load(f)
|
| 38 |
-
|
| 39 |
-
gr_info(translations["load_presets"].format(presets=presets))
|
| 40 |
-
|
| 41 |
-
return [
|
| 42 |
-
file.get("cleaner", cleaner),
|
| 43 |
-
file.get("autotune", autotune),
|
| 44 |
-
file.get("pitch", pitch),
|
| 45 |
-
file.get("clean_strength", clean_strength),
|
| 46 |
-
file.get("index_strength", index_strength),
|
| 47 |
-
file.get("resample_sr", resample_sr),
|
| 48 |
-
file.get("filter_radius", filter_radius),
|
| 49 |
-
file.get("rms_mix_rate", rms_mix_rate),
|
| 50 |
-
file.get("protect", protect),
|
| 51 |
-
file.get("split_audio", split_audio),
|
| 52 |
-
file.get("f0_autotune_strength", f0_autotune_strength),
|
| 53 |
-
file.get("formant_shifting", formant_shifting),
|
| 54 |
-
file.get("formant_qfrency", formant_qfrency),
|
| 55 |
-
file.get("formant_timbre", formant_timbre),
|
| 56 |
-
file.get("proposal_pitch", proposal_pitch),
|
| 57 |
-
file.get("proposal_pitch_threshold", proposal_pitch_threshold),
|
| 58 |
-
file.get("embedders_mix", embedders_mix),
|
| 59 |
-
file.get("embedders_mix_layers", embedders_mix_layers),
|
| 60 |
-
file.get("embedders_mix_ratio", embedders_mix_ratio)
|
| 61 |
-
]
|
| 62 |
-
|
| 63 |
-
def save_presets(
|
| 64 |
-
name,
|
| 65 |
-
cleaner,
|
| 66 |
-
autotune,
|
| 67 |
-
pitch,
|
| 68 |
-
clean_strength,
|
| 69 |
-
index_strength,
|
| 70 |
-
resample_sr,
|
| 71 |
-
filter_radius,
|
| 72 |
-
rms_mix_rate,
|
| 73 |
-
protect,
|
| 74 |
-
split_audio,
|
| 75 |
-
f0_autotune_strength,
|
| 76 |
-
cleaner_checkbox,
|
| 77 |
-
autotune_checkbox,
|
| 78 |
-
pitch_checkbox,
|
| 79 |
-
index_strength_checkbox,
|
| 80 |
-
resample_sr_checkbox,
|
| 81 |
-
filter_radius_checkbox,
|
| 82 |
-
rms_mix_rate_checkbox,
|
| 83 |
-
protect_checkbox,
|
| 84 |
-
split_audio_checkbox,
|
| 85 |
-
formant_shifting_checkbox,
|
| 86 |
-
formant_shifting,
|
| 87 |
-
formant_qfrency,
|
| 88 |
-
formant_timbre,
|
| 89 |
-
proposal_pitch,
|
| 90 |
-
proposal_pitch_threshold,
|
| 91 |
-
embedders_mix,
|
| 92 |
-
embedders_mix_layers,
|
| 93 |
-
embedders_mix_ratio
|
| 94 |
-
):
|
| 95 |
-
if not name: return gr_warning(translations["provide_filename_settings"])
|
| 96 |
-
|
| 97 |
-
if not any([
|
| 98 |
-
cleaner_checkbox,
|
| 99 |
-
autotune_checkbox,
|
| 100 |
-
pitch_checkbox,
|
| 101 |
-
index_strength_checkbox,
|
| 102 |
-
resample_sr_checkbox,
|
| 103 |
-
filter_radius_checkbox,
|
| 104 |
-
rms_mix_rate_checkbox,
|
| 105 |
-
protect_checkbox,
|
| 106 |
-
split_audio_checkbox,
|
| 107 |
-
formant_shifting_checkbox
|
| 108 |
-
]):
|
| 109 |
-
return gr_warning(translations["choose1"])
|
| 110 |
-
|
| 111 |
-
settings = {}
|
| 112 |
-
|
| 113 |
-
for checkbox, data in [
|
| 114 |
-
(
|
| 115 |
-
cleaner_checkbox,
|
| 116 |
-
{"cleaner": cleaner, "clean_strength": clean_strength}
|
| 117 |
-
),
|
| 118 |
-
(
|
| 119 |
-
autotune_checkbox,
|
| 120 |
-
{"autotune": autotune, "f0_autotune_strength": f0_autotune_strength}),
|
| 121 |
-
(
|
| 122 |
-
pitch_checkbox,
|
| 123 |
-
{"pitch": pitch}
|
| 124 |
-
),
|
| 125 |
-
(
|
| 126 |
-
index_strength_checkbox,
|
| 127 |
-
{"index_strength": index_strength}
|
| 128 |
-
),
|
| 129 |
-
(
|
| 130 |
-
resample_sr_checkbox,
|
| 131 |
-
{"resample_sr": resample_sr}
|
| 132 |
-
),
|
| 133 |
-
(
|
| 134 |
-
filter_radius_checkbox,
|
| 135 |
-
{"filter_radius": filter_radius}
|
| 136 |
-
),
|
| 137 |
-
(
|
| 138 |
-
rms_mix_rate_checkbox,
|
| 139 |
-
{"rms_mix_rate": rms_mix_rate}
|
| 140 |
-
),
|
| 141 |
-
(
|
| 142 |
-
protect_checkbox,
|
| 143 |
-
{"protect": protect}
|
| 144 |
-
),
|
| 145 |
-
(
|
| 146 |
-
split_audio_checkbox,
|
| 147 |
-
{"split_audio": split_audio}
|
| 148 |
-
),
|
| 149 |
-
(
|
| 150 |
-
formant_shifting_checkbox,
|
| 151 |
-
{"formant_shifting": formant_shifting, "formant_qfrency": formant_qfrency, "formant_timbre": formant_timbre}
|
| 152 |
-
),
|
| 153 |
-
(
|
| 154 |
-
proposal_pitch,
|
| 155 |
-
{"proposal_pitch": proposal_pitch, "proposal_pitch_threshold": proposal_pitch_threshold}
|
| 156 |
-
),
|
| 157 |
-
(
|
| 158 |
-
embedders_mix,
|
| 159 |
-
{"embedders_mix_layers": embedders_mix_layers, "embedders_mix_ratio": embedders_mix_ratio}
|
| 160 |
-
)
|
| 161 |
-
]:
|
| 162 |
-
if checkbox: settings.update(data)
|
| 163 |
-
|
| 164 |
-
with open(os.path.join(configs["presets_path"], name + ".conversion.json"), "w") as f:
|
| 165 |
-
json.dump(settings, f, indent=4)
|
| 166 |
-
|
| 167 |
-
gr_info(translations["export_settings"].format(name=name))
|
| 168 |
-
return change_preset_choices()
|
| 169 |
-
|
| 170 |
-
def audio_effect_load_presets(
|
| 171 |
-
presets,
|
| 172 |
-
resample_checkbox,
|
| 173 |
-
audio_effect_resample_sr,
|
| 174 |
-
chorus_depth,
|
| 175 |
-
chorus_rate_hz,
|
| 176 |
-
chorus_mix,
|
| 177 |
-
chorus_center_delay_ms,
|
| 178 |
-
chorus_feedback,
|
| 179 |
-
distortion_drive_db,
|
| 180 |
-
reverb_room_size,
|
| 181 |
-
reverb_damping,
|
| 182 |
-
reverb_wet_level,
|
| 183 |
-
reverb_dry_level,
|
| 184 |
-
reverb_width,
|
| 185 |
-
reverb_freeze_mode,
|
| 186 |
-
pitch_shift_semitones,
|
| 187 |
-
delay_second,
|
| 188 |
-
delay_feedback,
|
| 189 |
-
delay_mix,
|
| 190 |
-
compressor_threshold_db,
|
| 191 |
-
compressor_ratio,
|
| 192 |
-
compressor_attack_ms,
|
| 193 |
-
compressor_release_ms,
|
| 194 |
-
limiter_threshold_db,
|
| 195 |
-
limiter_release_ms,
|
| 196 |
-
gain_db,
|
| 197 |
-
bitcrush_bit_depth,
|
| 198 |
-
clipping_threshold_db,
|
| 199 |
-
phaser_rate_hz,
|
| 200 |
-
phaser_depth,
|
| 201 |
-
phaser_centre_frequency_hz,
|
| 202 |
-
phaser_feedback,
|
| 203 |
-
phaser_mix,
|
| 204 |
-
bass_boost,
|
| 205 |
-
bass_frequency,
|
| 206 |
-
treble_boost,
|
| 207 |
-
treble_frequency,
|
| 208 |
-
fade_in,
|
| 209 |
-
fade_out,
|
| 210 |
-
chorus_check_box,
|
| 211 |
-
distortion_checkbox,
|
| 212 |
-
reverb_check_box,
|
| 213 |
-
delay_check_box,
|
| 214 |
-
compressor_check_box,
|
| 215 |
-
limiter,
|
| 216 |
-
gain_checkbox,
|
| 217 |
-
bitcrush_checkbox,
|
| 218 |
-
clipping_checkbox,
|
| 219 |
-
phaser_check_box,
|
| 220 |
-
bass_or_treble,
|
| 221 |
-
fade
|
| 222 |
-
):
|
| 223 |
-
if not presets: gr_warning(translations["provide_file_settings"])
|
| 224 |
-
|
| 225 |
-
file = {}
|
| 226 |
-
if presets:
|
| 227 |
-
with open(os.path.join(configs["presets_path"], presets)) as f:
|
| 228 |
-
file = json.load(f)
|
| 229 |
-
|
| 230 |
-
gr_info(translations["load_presets"].format(presets=presets))
|
| 231 |
-
|
| 232 |
-
return [
|
| 233 |
-
file.get("resample_checkbox", resample_checkbox),
|
| 234 |
-
file.get("audio_effect_resample_sr", audio_effect_resample_sr),
|
| 235 |
-
file.get("chorus_depth", chorus_depth),
|
| 236 |
-
file.get("chorus_rate_hz", chorus_rate_hz),
|
| 237 |
-
file.get("chorus_mix", chorus_mix),
|
| 238 |
-
file.get("chorus_center_delay_ms", chorus_center_delay_ms),
|
| 239 |
-
file.get("chorus_feedback", chorus_feedback),
|
| 240 |
-
file.get("distortion_drive_db", distortion_drive_db),
|
| 241 |
-
file.get("reverb_room_size", reverb_room_size),
|
| 242 |
-
file.get("reverb_damping", reverb_damping),
|
| 243 |
-
file.get("reverb_wet_level", reverb_wet_level),
|
| 244 |
-
file.get("reverb_dry_level", reverb_dry_level),
|
| 245 |
-
file.get("reverb_width", reverb_width),
|
| 246 |
-
file.get("reverb_freeze_mode", reverb_freeze_mode),
|
| 247 |
-
file.get("pitch_shift_semitones", pitch_shift_semitones),
|
| 248 |
-
file.get("delay_second", delay_second),
|
| 249 |
-
file.get("delay_feedback", delay_feedback),
|
| 250 |
-
file.get("delay_mix", delay_mix),
|
| 251 |
-
file.get("compressor_threshold_db", compressor_threshold_db),
|
| 252 |
-
file.get("compressor_ratio", compressor_ratio),
|
| 253 |
-
file.get("compressor_attack_ms", compressor_attack_ms),
|
| 254 |
-
file.get("compressor_release_ms", compressor_release_ms),
|
| 255 |
-
file.get("limiter_threshold_db", limiter_threshold_db),
|
| 256 |
-
file.get("limiter_release_ms", limiter_release_ms),
|
| 257 |
-
file.get("gain_db", gain_db),
|
| 258 |
-
file.get("bitcrush_bit_depth", bitcrush_bit_depth),
|
| 259 |
-
file.get("clipping_threshold_db", clipping_threshold_db),
|
| 260 |
-
file.get("phaser_rate_hz", phaser_rate_hz),
|
| 261 |
-
file.get("phaser_depth", phaser_depth),
|
| 262 |
-
file.get("phaser_centre_frequency_hz", phaser_centre_frequency_hz),
|
| 263 |
-
file.get("phaser_feedback", phaser_feedback),
|
| 264 |
-
file.get("phaser_mix", phaser_mix),
|
| 265 |
-
file.get("bass_boost", bass_boost),
|
| 266 |
-
file.get("bass_frequency", bass_frequency),
|
| 267 |
-
file.get("treble_boost", treble_boost),
|
| 268 |
-
file.get("treble_frequency", treble_frequency),
|
| 269 |
-
file.get("fade_in", fade_in),
|
| 270 |
-
file.get("fade_out", fade_out),
|
| 271 |
-
file.get("chorus_check_box", chorus_check_box),
|
| 272 |
-
file.get("distortion_checkbox", distortion_checkbox),
|
| 273 |
-
file.get("reverb_check_box", reverb_check_box),
|
| 274 |
-
file.get("delay_check_box", delay_check_box),
|
| 275 |
-
file.get("compressor_check_box", compressor_check_box),
|
| 276 |
-
file.get("limiter", limiter),
|
| 277 |
-
file.get("gain_checkbox", gain_checkbox),
|
| 278 |
-
file.get("bitcrush_checkbox", bitcrush_checkbox),
|
| 279 |
-
file.get("clipping_checkbox", clipping_checkbox),
|
| 280 |
-
file.get("phaser_check_box", phaser_check_box),
|
| 281 |
-
file.get("bass_or_treble", bass_or_treble),
|
| 282 |
-
file.get("fade", fade)
|
| 283 |
-
]
|
| 284 |
-
|
| 285 |
-
def audio_effect_save_presets(
|
| 286 |
-
name,
|
| 287 |
-
resample_checkbox,
|
| 288 |
-
audio_effect_resample_sr,
|
| 289 |
-
chorus_depth,
|
| 290 |
-
chorus_rate_hz,
|
| 291 |
-
chorus_mix,
|
| 292 |
-
chorus_center_delay_ms,
|
| 293 |
-
chorus_feedback,
|
| 294 |
-
distortion_drive_db,
|
| 295 |
-
reverb_room_size,
|
| 296 |
-
reverb_damping,
|
| 297 |
-
reverb_wet_level,
|
| 298 |
-
reverb_dry_level,
|
| 299 |
-
reverb_width,
|
| 300 |
-
reverb_freeze_mode,
|
| 301 |
-
pitch_shift_semitones,
|
| 302 |
-
delay_second,
|
| 303 |
-
delay_feedback,
|
| 304 |
-
delay_mix,
|
| 305 |
-
compressor_threshold_db,
|
| 306 |
-
compressor_ratio,
|
| 307 |
-
compressor_attack_ms,
|
| 308 |
-
compressor_release_ms,
|
| 309 |
-
limiter_threshold_db,
|
| 310 |
-
limiter_release_ms,
|
| 311 |
-
gain_db,
|
| 312 |
-
bitcrush_bit_depth,
|
| 313 |
-
clipping_threshold_db,
|
| 314 |
-
phaser_rate_hz,
|
| 315 |
-
phaser_depth,
|
| 316 |
-
phaser_centre_frequency_hz,
|
| 317 |
-
phaser_feedback,
|
| 318 |
-
phaser_mix,
|
| 319 |
-
bass_boost,
|
| 320 |
-
bass_frequency,
|
| 321 |
-
treble_boost,
|
| 322 |
-
treble_frequency,
|
| 323 |
-
fade_in,
|
| 324 |
-
fade_out,
|
| 325 |
-
chorus_check_box,
|
| 326 |
-
distortion_checkbox,
|
| 327 |
-
reverb_check_box,
|
| 328 |
-
delay_check_box,
|
| 329 |
-
compressor_check_box,
|
| 330 |
-
limiter,
|
| 331 |
-
gain_checkbox,
|
| 332 |
-
bitcrush_checkbox,
|
| 333 |
-
clipping_checkbox,
|
| 334 |
-
phaser_check_box,
|
| 335 |
-
bass_or_treble,
|
| 336 |
-
fade
|
| 337 |
-
):
|
| 338 |
-
if not name: return gr_warning(translations["provide_filename_settings"])
|
| 339 |
-
|
| 340 |
-
if not any([
|
| 341 |
-
resample_checkbox,
|
| 342 |
-
chorus_check_box,
|
| 343 |
-
distortion_checkbox,
|
| 344 |
-
reverb_check_box,
|
| 345 |
-
delay_check_box,
|
| 346 |
-
compressor_check_box,
|
| 347 |
-
limiter,
|
| 348 |
-
gain_checkbox,
|
| 349 |
-
bitcrush_checkbox,
|
| 350 |
-
clipping_checkbox,
|
| 351 |
-
phaser_check_box,
|
| 352 |
-
bass_or_treble,
|
| 353 |
-
fade,
|
| 354 |
-
pitch_shift_semitones != 0
|
| 355 |
-
]):
|
| 356 |
-
return gr_warning(translations["choose1"])
|
| 357 |
-
|
| 358 |
-
settings = {}
|
| 359 |
-
|
| 360 |
-
for checkbox, data in [
|
| 361 |
-
(resample_checkbox, {
|
| 362 |
-
"resample_checkbox": resample_checkbox,
|
| 363 |
-
"audio_effect_resample_sr": audio_effect_resample_sr
|
| 364 |
-
}),
|
| 365 |
-
(chorus_check_box, {
|
| 366 |
-
"chorus_check_box": chorus_check_box,
|
| 367 |
-
"chorus_depth": chorus_depth,
|
| 368 |
-
"chorus_rate_hz": chorus_rate_hz,
|
| 369 |
-
"chorus_mix": chorus_mix,
|
| 370 |
-
"chorus_center_delay_ms": chorus_center_delay_ms,
|
| 371 |
-
"chorus_feedback": chorus_feedback
|
| 372 |
-
}),
|
| 373 |
-
(distortion_checkbox, {
|
| 374 |
-
"distortion_checkbox": distortion_checkbox,
|
| 375 |
-
"distortion_drive_db": distortion_drive_db
|
| 376 |
-
}),
|
| 377 |
-
(reverb_check_box, {
|
| 378 |
-
"reverb_check_box": reverb_check_box,
|
| 379 |
-
"reverb_room_size": reverb_room_size,
|
| 380 |
-
"reverb_damping": reverb_damping,
|
| 381 |
-
"reverb_wet_level": reverb_wet_level,
|
| 382 |
-
"reverb_dry_level": reverb_dry_level,
|
| 383 |
-
"reverb_width": reverb_width,
|
| 384 |
-
"reverb_freeze_mode": reverb_freeze_mode
|
| 385 |
-
}),
|
| 386 |
-
(pitch_shift_semitones != 0, {
|
| 387 |
-
"pitch_shift_semitones": pitch_shift_semitones
|
| 388 |
-
}),
|
| 389 |
-
(delay_check_box, {
|
| 390 |
-
"delay_check_box": delay_check_box,
|
| 391 |
-
"delay_second": delay_second,
|
| 392 |
-
"delay_feedback": delay_feedback,
|
| 393 |
-
"delay_mix": delay_mix
|
| 394 |
-
}),
|
| 395 |
-
(compressor_check_box, {
|
| 396 |
-
"compressor_check_box": compressor_check_box,
|
| 397 |
-
"compressor_threshold_db": compressor_threshold_db,
|
| 398 |
-
"compressor_ratio": compressor_ratio,
|
| 399 |
-
"compressor_attack_ms": compressor_attack_ms,
|
| 400 |
-
"compressor_release_ms": compressor_release_ms
|
| 401 |
-
}),
|
| 402 |
-
(limiter, {
|
| 403 |
-
"limiter": limiter,
|
| 404 |
-
"limiter_threshold_db": limiter_threshold_db,
|
| 405 |
-
"limiter_release_ms": limiter_release_ms
|
| 406 |
-
}),
|
| 407 |
-
(gain_checkbox, {
|
| 408 |
-
"gain_checkbox": gain_checkbox,
|
| 409 |
-
"gain_db": gain_db
|
| 410 |
-
}),
|
| 411 |
-
(bitcrush_checkbox, {
|
| 412 |
-
"bitcrush_checkbox": bitcrush_checkbox,
|
| 413 |
-
"bitcrush_bit_depth": bitcrush_bit_depth
|
| 414 |
-
}),
|
| 415 |
-
(clipping_checkbox, {
|
| 416 |
-
"clipping_checkbox": clipping_checkbox,
|
| 417 |
-
"clipping_threshold_db": clipping_threshold_db
|
| 418 |
-
}),
|
| 419 |
-
(phaser_check_box, {
|
| 420 |
-
"phaser_check_box": phaser_check_box,
|
| 421 |
-
"phaser_rate_hz": phaser_rate_hz,
|
| 422 |
-
"phaser_depth": phaser_depth,
|
| 423 |
-
"phaser_centre_frequency_hz": phaser_centre_frequency_hz,
|
| 424 |
-
"phaser_feedback": phaser_feedback,
|
| 425 |
-
"phaser_mix": phaser_mix
|
| 426 |
-
}),
|
| 427 |
-
(bass_or_treble, {
|
| 428 |
-
"bass_or_treble": bass_or_treble,
|
| 429 |
-
"bass_boost": bass_boost,
|
| 430 |
-
"bass_frequency": bass_frequency,
|
| 431 |
-
"treble_boost": treble_boost,
|
| 432 |
-
"treble_frequency": treble_frequency
|
| 433 |
-
}),
|
| 434 |
-
(fade, {
|
| 435 |
-
"fade": fade,
|
| 436 |
-
"fade_in": fade_in,
|
| 437 |
-
"fade_out": fade_out
|
| 438 |
-
})
|
| 439 |
-
]:
|
| 440 |
-
if checkbox: settings.update(data)
|
| 441 |
-
|
| 442 |
-
with open(os.path.join(configs["presets_path"], name + ".effect.json"), "w") as f:
|
| 443 |
-
json.dump(settings, f, indent=4)
|
| 444 |
-
|
| 445 |
-
gr_info(translations["export_settings"].format(name=name))
|
| 446 |
-
return change_effect_preset_choices()
|
| 447 |
-
|
| 448 |
-
def save_realtime_config(
|
| 449 |
-
name,
|
| 450 |
-
exclusive_mode,
|
| 451 |
-
vad_enabled,
|
| 452 |
-
chunk_size,
|
| 453 |
-
pitch,
|
| 454 |
-
index_strength,
|
| 455 |
-
predictor_onnx,
|
| 456 |
-
hop_length,
|
| 457 |
-
embedder_mode,
|
| 458 |
-
f0_autotune,
|
| 459 |
-
proposal_pitch,
|
| 460 |
-
f0_autotune_strength,
|
| 461 |
-
proposal_pitch_threshold,
|
| 462 |
-
rms_mix_rate,
|
| 463 |
-
protect,
|
| 464 |
-
filter_radius,
|
| 465 |
-
silent_threshold,
|
| 466 |
-
extra_convert_size,
|
| 467 |
-
cross_fade_overlap_size,
|
| 468 |
-
vad_sensitivity,
|
| 469 |
-
vad_frame_ms,
|
| 470 |
-
clean_audio,
|
| 471 |
-
clean_strength,
|
| 472 |
-
post_process,
|
| 473 |
-
embedders_mix,
|
| 474 |
-
embedders_mix_layers,
|
| 475 |
-
embedders_mix_ratio,
|
| 476 |
-
chorus,
|
| 477 |
-
distortion,
|
| 478 |
-
reverb,
|
| 479 |
-
pitch_shift,
|
| 480 |
-
delay,
|
| 481 |
-
compressor,
|
| 482 |
-
limiter,
|
| 483 |
-
gain,
|
| 484 |
-
bitcrush,
|
| 485 |
-
clipping,
|
| 486 |
-
phaser,
|
| 487 |
-
chorus_depth,
|
| 488 |
-
chorus_rate,
|
| 489 |
-
chorus_mix,
|
| 490 |
-
chorus_center_delay,
|
| 491 |
-
chorus_feedback,
|
| 492 |
-
distortion_gain,
|
| 493 |
-
reverb_room_size,
|
| 494 |
-
reverb_damping,
|
| 495 |
-
reverb_wet_gain,
|
| 496 |
-
reverb_dry_gain,
|
| 497 |
-
reverb_width,
|
| 498 |
-
reverb_freeze_mode,
|
| 499 |
-
pitch_shift_semitones,
|
| 500 |
-
delay_seconds,
|
| 501 |
-
delay_feedback,
|
| 502 |
-
delay_mix,
|
| 503 |
-
compressor_threshold,
|
| 504 |
-
compressor_ratio,
|
| 505 |
-
compressor_attack,
|
| 506 |
-
compressor_release,
|
| 507 |
-
limiter_threshold,
|
| 508 |
-
limiter_release_time,
|
| 509 |
-
gain_db,
|
| 510 |
-
bitcrush_bit_depth,
|
| 511 |
-
clipping_threshold,
|
| 512 |
-
phaser_rate_hz,
|
| 513 |
-
phaser_depth,
|
| 514 |
-
phaser_centre_frequency_hz,
|
| 515 |
-
phaser_feedback,
|
| 516 |
-
phaser_mix
|
| 517 |
-
):
|
| 518 |
-
if not name: return gr_warning(translations["provide_filename_settings"])
|
| 519 |
-
|
| 520 |
-
settings = {
|
| 521 |
-
"exclusive_mode": exclusive_mode,
|
| 522 |
-
"vad_enabled": vad_enabled,
|
| 523 |
-
"chunk_size": chunk_size,
|
| 524 |
-
"pitch": pitch,
|
| 525 |
-
"index_strength": index_strength,
|
| 526 |
-
"predictor_onnx": predictor_onnx,
|
| 527 |
-
"hop_length": hop_length,
|
| 528 |
-
"embedder_mode": embedder_mode,
|
| 529 |
-
"embedders_mix": embedders_mix,
|
| 530 |
-
"embedders_mix_layers": embedders_mix_layers,
|
| 531 |
-
"embedders_mix_ratio": embedders_mix_ratio,
|
| 532 |
-
"f0_autotune": f0_autotune,
|
| 533 |
-
"proposal_pitch": proposal_pitch,
|
| 534 |
-
"f0_autotune_strength": f0_autotune_strength,
|
| 535 |
-
"proposal_pitch_threshold": proposal_pitch_threshold,
|
| 536 |
-
"rms_mix_rate": rms_mix_rate,
|
| 537 |
-
"protect": protect,
|
| 538 |
-
"filter_radius": filter_radius,
|
| 539 |
-
"silent_threshold": silent_threshold,
|
| 540 |
-
"extra_convert_size": extra_convert_size,
|
| 541 |
-
"cross_fade_overlap_size": cross_fade_overlap_size,
|
| 542 |
-
"vad_sensitivity": vad_sensitivity,
|
| 543 |
-
"vad_frame_ms": vad_frame_ms,
|
| 544 |
-
"clean_audio": clean_audio,
|
| 545 |
-
"clean_strength": clean_strength,
|
| 546 |
-
"post_process": post_process,
|
| 547 |
-
"chorus": chorus,
|
| 548 |
-
"distortion": distortion,
|
| 549 |
-
"reverb": reverb,
|
| 550 |
-
"pitch_shift": pitch_shift,
|
| 551 |
-
"delay": delay,
|
| 552 |
-
"compressor": compressor,
|
| 553 |
-
"limiter": limiter,
|
| 554 |
-
"gain": gain,
|
| 555 |
-
"bitcrush": bitcrush,
|
| 556 |
-
"clipping": clipping,
|
| 557 |
-
"phaser": phaser,
|
| 558 |
-
"chorus_depth": chorus_depth,
|
| 559 |
-
"chorus_rate": chorus_rate,
|
| 560 |
-
"chorus_mix": chorus_mix,
|
| 561 |
-
"chorus_center_delay": chorus_center_delay,
|
| 562 |
-
"chorus_feedback": chorus_feedback,
|
| 563 |
-
"distortion_gain": distortion_gain,
|
| 564 |
-
"reverb_room_size": reverb_room_size,
|
| 565 |
-
"reverb_damping": reverb_damping,
|
| 566 |
-
"reverb_wet_gain": reverb_wet_gain,
|
| 567 |
-
"reverb_dry_gain": reverb_dry_gain,
|
| 568 |
-
"reverb_width": reverb_width,
|
| 569 |
-
"reverb_freeze_mode": reverb_freeze_mode,
|
| 570 |
-
"pitch_shift_semitones": pitch_shift_semitones,
|
| 571 |
-
"delay_seconds": delay_seconds,
|
| 572 |
-
"delay_feedback": delay_feedback,
|
| 573 |
-
"delay_mix": delay_mix,
|
| 574 |
-
"compressor_threshold": compressor_threshold,
|
| 575 |
-
"compressor_ratio": compressor_ratio,
|
| 576 |
-
"compressor_attack": compressor_attack,
|
| 577 |
-
"compressor_release": compressor_release,
|
| 578 |
-
"limiter_threshold": limiter_threshold,
|
| 579 |
-
"limiter_release_time": limiter_release_time,
|
| 580 |
-
"gain_db": gain_db,
|
| 581 |
-
"bitcrush_bit_depth": bitcrush_bit_depth,
|
| 582 |
-
"clipping_threshold": clipping_threshold,
|
| 583 |
-
"phaser_rate_hz": phaser_rate_hz,
|
| 584 |
-
"phaser_depth": phaser_depth,
|
| 585 |
-
"phaser_centre_frequency_hz": phaser_centre_frequency_hz,
|
| 586 |
-
"phaser_feedback": phaser_feedback,
|
| 587 |
-
"phaser_mix": phaser_mix
|
| 588 |
-
}
|
| 589 |
-
|
| 590 |
-
path = os.path.join(configs["presets_path"], name + ".realtime.json")
|
| 591 |
-
with open(path, "w") as f:
|
| 592 |
-
json.dump(settings, f, indent=4)
|
| 593 |
-
|
| 594 |
-
gr_info(translations["export_settings"].format(name=name))
|
| 595 |
-
return change_realtime_preset_choices()
|
| 596 |
-
|
| 597 |
-
def load_realtime_config(
|
| 598 |
-
presets,
|
| 599 |
-
exclusive_mode,
|
| 600 |
-
vad_enabled,
|
| 601 |
-
chunk_size,
|
| 602 |
-
pitch,
|
| 603 |
-
index_strength,
|
| 604 |
-
predictor_onnx,
|
| 605 |
-
hop_length,
|
| 606 |
-
embedder_mode,
|
| 607 |
-
f0_autotune,
|
| 608 |
-
proposal_pitch,
|
| 609 |
-
f0_autotune_strength,
|
| 610 |
-
proposal_pitch_threshold,
|
| 611 |
-
rms_mix_rate,
|
| 612 |
-
protect,
|
| 613 |
-
filter_radius,
|
| 614 |
-
silent_threshold,
|
| 615 |
-
extra_convert_size,
|
| 616 |
-
cross_fade_overlap_size,
|
| 617 |
-
vad_sensitivity,
|
| 618 |
-
vad_frame_ms,
|
| 619 |
-
clean_audio,
|
| 620 |
-
clean_strength,
|
| 621 |
-
post_process,
|
| 622 |
-
embedders_mix,
|
| 623 |
-
embedders_mix_layers,
|
| 624 |
-
embedders_mix_ratio,
|
| 625 |
-
chorus,
|
| 626 |
-
distortion,
|
| 627 |
-
reverb,
|
| 628 |
-
pitch_shift,
|
| 629 |
-
delay,
|
| 630 |
-
compressor,
|
| 631 |
-
limiter,
|
| 632 |
-
gain,
|
| 633 |
-
bitcrush,
|
| 634 |
-
clipping,
|
| 635 |
-
phaser,
|
| 636 |
-
chorus_depth,
|
| 637 |
-
chorus_rate,
|
| 638 |
-
chorus_mix,
|
| 639 |
-
chorus_center_delay,
|
| 640 |
-
chorus_feedback,
|
| 641 |
-
distortion_gain,
|
| 642 |
-
reverb_room_size,
|
| 643 |
-
reverb_damping,
|
| 644 |
-
reverb_wet_gain,
|
| 645 |
-
reverb_dry_gain,
|
| 646 |
-
reverb_width,
|
| 647 |
-
reverb_freeze_mode,
|
| 648 |
-
pitch_shift_semitones,
|
| 649 |
-
delay_seconds,
|
| 650 |
-
delay_feedback,
|
| 651 |
-
delay_mix,
|
| 652 |
-
compressor_threshold,
|
| 653 |
-
compressor_ratio,
|
| 654 |
-
compressor_attack,
|
| 655 |
-
compressor_release,
|
| 656 |
-
limiter_threshold,
|
| 657 |
-
limiter_release_time,
|
| 658 |
-
gain_db,
|
| 659 |
-
bitcrush_bit_depth,
|
| 660 |
-
clipping_threshold,
|
| 661 |
-
phaser_rate_hz,
|
| 662 |
-
phaser_depth,
|
| 663 |
-
phaser_centre_frequency_hz,
|
| 664 |
-
phaser_feedback,
|
| 665 |
-
phaser_mix
|
| 666 |
-
):
|
| 667 |
-
if not presets: gr_warning(translations["provide_file_settings"])
|
| 668 |
-
|
| 669 |
-
file = {}
|
| 670 |
-
if presets:
|
| 671 |
-
with open(os.path.join(configs["presets_path"], presets)) as f:
|
| 672 |
-
file = json.load(f)
|
| 673 |
-
|
| 674 |
-
gr_info(translations["load_presets"].format(presets=presets))
|
| 675 |
-
|
| 676 |
-
return [
|
| 677 |
-
file.get("exclusive_mode", exclusive_mode),
|
| 678 |
-
file.get("vad_enabled", vad_enabled),
|
| 679 |
-
file.get("chunk_size", chunk_size),
|
| 680 |
-
file.get("pitch", pitch),
|
| 681 |
-
file.get("index_strength", index_strength),
|
| 682 |
-
file.get("predictor_onnx", predictor_onnx),
|
| 683 |
-
file.get("hop_length", hop_length),
|
| 684 |
-
file.get("embedder_mode", embedder_mode),
|
| 685 |
-
file.get("f0_autotune", f0_autotune),
|
| 686 |
-
file.get("proposal_pitch", proposal_pitch),
|
| 687 |
-
file.get("f0_autotune_strength", f0_autotune_strength),
|
| 688 |
-
file.get("proposal_pitch_threshold", proposal_pitch_threshold),
|
| 689 |
-
file.get("rms_mix_rate", rms_mix_rate),
|
| 690 |
-
file.get("protect", protect),
|
| 691 |
-
file.get("filter_radius", filter_radius),
|
| 692 |
-
file.get("silent_threshold", silent_threshold),
|
| 693 |
-
file.get("extra_convert_size", extra_convert_size),
|
| 694 |
-
file.get("cross_fade_overlap_size", cross_fade_overlap_size),
|
| 695 |
-
file.get("vad_sensitivity", vad_sensitivity),
|
| 696 |
-
file.get("vad_frame_ms", vad_frame_ms),
|
| 697 |
-
file.get("clean_audio", clean_audio),
|
| 698 |
-
file.get("clean_strength", clean_strength),
|
| 699 |
-
file.get("post_process", post_process),
|
| 700 |
-
file.get("embedders_mix", embedders_mix),
|
| 701 |
-
file.get("embedders_mix_layers", embedders_mix_layers),
|
| 702 |
-
file.get("embedders_mix_ratio", embedders_mix_ratio),
|
| 703 |
-
file.get("chorus", chorus),
|
| 704 |
-
file.get("distortion", distortion),
|
| 705 |
-
file.get("reverb", reverb),
|
| 706 |
-
file.get("pitch_shift", pitch_shift),
|
| 707 |
-
file.get("delay", delay),
|
| 708 |
-
file.get("compressor", compressor),
|
| 709 |
-
file.get("limiter", limiter),
|
| 710 |
-
file.get("gain", gain),
|
| 711 |
-
file.get("bitcrush", bitcrush),
|
| 712 |
-
file.get("clipping", clipping),
|
| 713 |
-
file.get("phaser", phaser),
|
| 714 |
-
file.get("chorus_depth", chorus_depth),
|
| 715 |
-
file.get("chorus_rate", chorus_rate),
|
| 716 |
-
file.get("chorus_mix", chorus_mix),
|
| 717 |
-
file.get("chorus_center_delay", chorus_center_delay),
|
| 718 |
-
file.get("chorus_feedback", chorus_feedback),
|
| 719 |
-
file.get("distortion_gain", distortion_gain),
|
| 720 |
-
file.get("reverb_room_size", reverb_room_size),
|
| 721 |
-
file.get("reverb_damping", reverb_damping),
|
| 722 |
-
file.get("reverb_wet_gain", reverb_wet_gain),
|
| 723 |
-
file.get("reverb_dry_gain", reverb_dry_gain),
|
| 724 |
-
file.get("reverb_width", reverb_width),
|
| 725 |
-
file.get("reverb_freeze_mode", reverb_freeze_mode),
|
| 726 |
-
file.get("pitch_shift_semitones", pitch_shift_semitones),
|
| 727 |
-
file.get("delay_seconds", delay_seconds),
|
| 728 |
-
file.get("delay_feedback", delay_feedback),
|
| 729 |
-
file.get("delay_mix", delay_mix),
|
| 730 |
-
file.get("compressor_threshold", compressor_threshold),
|
| 731 |
-
file.get("compressor_ratio", compressor_ratio),
|
| 732 |
-
file.get("compressor_attack", compressor_attack),
|
| 733 |
-
file.get("compressor_release", compressor_release),
|
| 734 |
-
file.get("limiter_threshold", limiter_threshold),
|
| 735 |
-
file.get("limiter_release_time", limiter_release_time),
|
| 736 |
-
file.get("gain_db", gain_db),
|
| 737 |
-
file.get("bitcrush_bit_depth", bitcrush_bit_depth),
|
| 738 |
-
file.get("clipping_threshold", clipping_threshold),
|
| 739 |
-
file.get("phaser_rate_hz", phaser_rate_hz),
|
| 740 |
-
file.get("phaser_depth", phaser_depth),
|
| 741 |
-
file.get("phaser_centre_frequency_hz", phaser_centre_frequency_hz),
|
| 742 |
-
file.get("phaser_feedback", phaser_feedback),
|
| 743 |
-
file.get("phaser_mix", phaser_mix)
|
| 744 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/process.py
DELETED
|
@@ -1,192 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import re
|
| 3 |
-
import sys
|
| 4 |
-
import shutil
|
| 5 |
-
import codecs
|
| 6 |
-
import zipfile
|
| 7 |
-
import requests
|
| 8 |
-
|
| 9 |
-
sys.path.append(os.getcwd())
|
| 10 |
-
|
| 11 |
-
from main.app.variables import logger, translations, configs
|
| 12 |
-
from main.app.core.ui import gr_info, gr_warning, gr_error, process_output, replace_punctuation
|
| 13 |
-
|
| 14 |
-
def read_docx_text(path):
|
| 15 |
-
import xml.etree.ElementTree
|
| 16 |
-
|
| 17 |
-
with zipfile.ZipFile(path) as docx:
|
| 18 |
-
with docx.open("word/document.xml") as document_xml:
|
| 19 |
-
xml_content = document_xml.read()
|
| 20 |
-
|
| 21 |
-
WORD_NAMESPACE = codecs.decode(
|
| 22 |
-
"{uggc://fpurznf.bcrakzysbezngf.bet/jbeqcebprffvatzy/2006/znva}",
|
| 23 |
-
"rot13"
|
| 24 |
-
)
|
| 25 |
-
paragraphs = []
|
| 26 |
-
|
| 27 |
-
for paragraph in xml.etree.ElementTree.XML(xml_content).iter(WORD_NAMESPACE + 'p'):
|
| 28 |
-
texts = [node.text for node in paragraph.iter(WORD_NAMESPACE + 't') if node.text]
|
| 29 |
-
if texts: paragraphs.append(''.join(texts))
|
| 30 |
-
|
| 31 |
-
return '\n'.join(paragraphs)
|
| 32 |
-
|
| 33 |
-
def process_input(file_path):
|
| 34 |
-
if file_path.endswith(".srt"):
|
| 35 |
-
file_contents = ""
|
| 36 |
-
elif file_path.endswith(".docx"):
|
| 37 |
-
file_contents = read_docx_text(file_path)
|
| 38 |
-
else:
|
| 39 |
-
try:
|
| 40 |
-
with open(file_path, "r", encoding="utf-8") as file:
|
| 41 |
-
file_contents = file.read()
|
| 42 |
-
except Exception as e:
|
| 43 |
-
gr_warning(translations["read_error"])
|
| 44 |
-
|
| 45 |
-
logger.debug(e)
|
| 46 |
-
file_contents = ""
|
| 47 |
-
|
| 48 |
-
gr_info(translations["upload_success"].format(name=translations["text"]))
|
| 49 |
-
return file_contents
|
| 50 |
-
|
| 51 |
-
def move_files_from_directory(
|
| 52 |
-
src_dir,
|
| 53 |
-
dest_weights,
|
| 54 |
-
dest_logs,
|
| 55 |
-
model_name,
|
| 56 |
-
use_orig_weight_name=False
|
| 57 |
-
):
|
| 58 |
-
for root, _, files in os.walk(src_dir):
|
| 59 |
-
for file in files:
|
| 60 |
-
file_path = os.path.join(root, file)
|
| 61 |
-
|
| 62 |
-
if file.endswith(".index"):
|
| 63 |
-
model_log_dir = os.path.join(dest_logs, model_name)
|
| 64 |
-
os.makedirs(model_log_dir, exist_ok=True)
|
| 65 |
-
|
| 66 |
-
filepath = process_output(os.path.join(model_log_dir, replace_punctuation(file)))
|
| 67 |
-
|
| 68 |
-
shutil.move(file_path, filepath)
|
| 69 |
-
elif file.endswith(".pth") and not file.startswith("D_") and not file.startswith("G_"):
|
| 70 |
-
pth_path = process_output(os.path.join(dest_weights, model_name + ".pth"))
|
| 71 |
-
|
| 72 |
-
shutil.move(file_path, pth_path if not use_orig_weight_name else dest_weights)
|
| 73 |
-
elif file.endswith(".onnx") and not file.startswith("D_") and not file.startswith("G_"):
|
| 74 |
-
pth_path = process_output(os.path.join(dest_weights, model_name + ".onnx"))
|
| 75 |
-
|
| 76 |
-
shutil.move(file_path, pth_path if not use_orig_weight_name else dest_weights)
|
| 77 |
-
|
| 78 |
-
def extract_name_model(filename):
|
| 79 |
-
match = re.search(
|
| 80 |
-
r"_([A-Za-z0-9]+)(?=_v\d*)",
|
| 81 |
-
replace_punctuation(filename)
|
| 82 |
-
)
|
| 83 |
-
|
| 84 |
-
return match.group(1) if match else None
|
| 85 |
-
|
| 86 |
-
def save_drop_model(dropboxs):
|
| 87 |
-
weight_folder = configs["weights_path"]
|
| 88 |
-
logs_folder = configs["logs_path"]
|
| 89 |
-
save_model_temp = "save_model_temp"
|
| 90 |
-
|
| 91 |
-
if not os.path.exists(weight_folder): os.makedirs(weight_folder, exist_ok=True)
|
| 92 |
-
if not os.path.exists(logs_folder): os.makedirs(logs_folder, exist_ok=True)
|
| 93 |
-
if not os.path.exists(save_model_temp): os.makedirs(save_model_temp, exist_ok=True)
|
| 94 |
-
|
| 95 |
-
try:
|
| 96 |
-
for dropbox in dropboxs:
|
| 97 |
-
shutil.move(dropbox, save_model_temp)
|
| 98 |
-
file_name = os.path.basename(dropbox)
|
| 99 |
-
|
| 100 |
-
if file_name.endswith(".zip"):
|
| 101 |
-
shutil.unpack_archive(
|
| 102 |
-
os.path.join(save_model_temp, file_name),
|
| 103 |
-
save_model_temp
|
| 104 |
-
)
|
| 105 |
-
|
| 106 |
-
move_files_from_directory(
|
| 107 |
-
save_model_temp,
|
| 108 |
-
weight_folder,
|
| 109 |
-
logs_folder,
|
| 110 |
-
file_name.replace(".zip", "")
|
| 111 |
-
)
|
| 112 |
-
elif file_name.endswith((".pth", ".onnx")):
|
| 113 |
-
output_file = process_output(os.path.join(weight_folder, file_name))
|
| 114 |
-
|
| 115 |
-
shutil.move(os.path.join(save_model_temp, file_name), output_file)
|
| 116 |
-
elif file_name.endswith(".index"):
|
| 117 |
-
modelname = extract_name_model(file_name)
|
| 118 |
-
if modelname is None:
|
| 119 |
-
modelname = os.path.splitext(os.path.basename(file_name))[0]
|
| 120 |
-
|
| 121 |
-
model_logs = os.path.join(logs_folder, modelname)
|
| 122 |
-
if not os.path.exists(model_logs):
|
| 123 |
-
os.makedirs(model_logs, exist_ok=True)
|
| 124 |
-
|
| 125 |
-
shutil.move(
|
| 126 |
-
os.path.join(save_model_temp, file_name),
|
| 127 |
-
model_logs
|
| 128 |
-
)
|
| 129 |
-
else:
|
| 130 |
-
gr_warning(translations["unable_analyze_model"])
|
| 131 |
-
return None
|
| 132 |
-
|
| 133 |
-
gr_info(translations["upload_success"].format(name=translations["model"]))
|
| 134 |
-
return None
|
| 135 |
-
except Exception as e:
|
| 136 |
-
gr_error(message=translations["error_occurred"].format(e=e))
|
| 137 |
-
return None
|
| 138 |
-
finally:
|
| 139 |
-
shutil.rmtree(save_model_temp, ignore_errors=True)
|
| 140 |
-
|
| 141 |
-
def zip_file(
|
| 142 |
-
modelname,
|
| 143 |
-
pth_name,
|
| 144 |
-
index_path
|
| 145 |
-
):
|
| 146 |
-
pth_path = os.path.join(configs["weights_path"], pth_name)
|
| 147 |
-
|
| 148 |
-
if (
|
| 149 |
-
not pth_name or
|
| 150 |
-
not os.path.exists(pth_path) or
|
| 151 |
-
not pth_name.endswith((".pth", ".onnx"))
|
| 152 |
-
):
|
| 153 |
-
return gr_warning(translations["provide_file"].format(filename=translations["model"]))
|
| 154 |
-
|
| 155 |
-
zip_file_path = os.path.join(configs["logs_path"], modelname, modelname + ".zip")
|
| 156 |
-
gr_info(translations["start"].format(start=translations["zip"]))
|
| 157 |
-
|
| 158 |
-
with zipfile.ZipFile(zip_file_path, 'w') as zipf:
|
| 159 |
-
zipf.write(pth_path, os.path.basename(pth_path))
|
| 160 |
-
if index_path: zipf.write(index_path, os.path.basename(index_path))
|
| 161 |
-
|
| 162 |
-
gr_info(translations["success"])
|
| 163 |
-
|
| 164 |
-
return {
|
| 165 |
-
"visible": True,
|
| 166 |
-
"value": zip_file_path,
|
| 167 |
-
"__type__": "update"
|
| 168 |
-
}
|
| 169 |
-
|
| 170 |
-
def fetch_pretrained_data():
|
| 171 |
-
try:
|
| 172 |
-
response = requests.get(
|
| 173 |
-
codecs.decode(
|
| 174 |
-
"uggcf://uhttvatsnpr.pb/NauC/Ivrganzrfr-EIP-Cebwrpg/erfbyir/znva/wfba/phfgbz_cergenvarq.wfba",
|
| 175 |
-
"rot13"
|
| 176 |
-
)
|
| 177 |
-
)
|
| 178 |
-
response.raise_for_status()
|
| 179 |
-
|
| 180 |
-
return response.json()
|
| 181 |
-
except:
|
| 182 |
-
return {}
|
| 183 |
-
|
| 184 |
-
def update_sample_rate_dropdown(model):
|
| 185 |
-
data = fetch_pretrained_data()
|
| 186 |
-
|
| 187 |
-
if model != translations["success"]:
|
| 188 |
-
return {
|
| 189 |
-
"choices": list(data[model].keys()),
|
| 190 |
-
"value": list(data[model].keys())[0],
|
| 191 |
-
"__type__": "update"
|
| 192 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/realtime.py
DELETED
|
@@ -1,1142 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import time
|
| 4 |
-
|
| 5 |
-
sys.path.append(os.getcwd())
|
| 6 |
-
|
| 7 |
-
from main.app.core.ui import gr_info, gr_warning
|
| 8 |
-
from main.app.variables import translations, configs, config, logger
|
| 9 |
-
|
| 10 |
-
running, callbacks, audio_manager = False, None, None
|
| 11 |
-
|
| 12 |
-
PIPELINE_SAMPLE_RATE = 16000
|
| 13 |
-
|
| 14 |
-
interactive_true = {"interactive": True, "__type__": "update"}
|
| 15 |
-
interactive_false = {"interactive": False, "__type__": "update"}
|
| 16 |
-
callbacks_kwargs = {}
|
| 17 |
-
|
| 18 |
-
js_code = """
|
| 19 |
-
window._activeStream = null;
|
| 20 |
-
window._audioCtx = null;
|
| 21 |
-
window._workletNode = null;
|
| 22 |
-
window._playbackNode = null;
|
| 23 |
-
window._ws = null;
|
| 24 |
-
window.OutputAudioRoute = null;
|
| 25 |
-
window.MonitorAudioRoute = null;
|
| 26 |
-
window.lastSend = 0;
|
| 27 |
-
window.responseMs = 0;
|
| 28 |
-
|
| 29 |
-
function setStatus(msg, use_alert = true) {
|
| 30 |
-
const realtimeStatus = document.querySelector("#realtime-status-info h2.output-class");
|
| 31 |
-
if (use_alert) alert(msg);
|
| 32 |
-
|
| 33 |
-
if (realtimeStatus) {
|
| 34 |
-
realtimeStatus.innerText = msg;
|
| 35 |
-
realtimeStatus.style.whiteSpace = "nowrap";
|
| 36 |
-
realtimeStatus.style.textAlign = "center";
|
| 37 |
-
}
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
async function addModuleFromString(ctx, codeStr) {
|
| 41 |
-
const blob = new Blob([codeStr], {type: 'application/javascript'});
|
| 42 |
-
const url = URL.createObjectURL(blob);
|
| 43 |
-
|
| 44 |
-
await ctx.audioWorklet.addModule(url);
|
| 45 |
-
URL.revokeObjectURL(url);
|
| 46 |
-
};
|
| 47 |
-
|
| 48 |
-
function createOutputRoute(audioCtx, playbackNode, sinkId, gainValue = 1.0) {
|
| 49 |
-
const dest = audioCtx.createMediaStreamDestination();
|
| 50 |
-
const gainNode = audioCtx.createGain();
|
| 51 |
-
gainNode.gain.value = gainValue;
|
| 52 |
-
|
| 53 |
-
playbackNode.connect(gainNode);
|
| 54 |
-
gainNode.connect(dest);
|
| 55 |
-
|
| 56 |
-
const el = document.createElement('audio');
|
| 57 |
-
el.autoplay = true;
|
| 58 |
-
el.srcObject = dest.stream;
|
| 59 |
-
el.style.display = 'none';
|
| 60 |
-
document.body.appendChild(el);
|
| 61 |
-
|
| 62 |
-
if (el.setSinkId) el.setSinkId(sinkId).catch(err => console.error(err));
|
| 63 |
-
return { dest, gainNode, el };
|
| 64 |
-
}
|
| 65 |
-
|
| 66 |
-
const inputWorkletSource = `
|
| 67 |
-
class InputProcessor extends AudioWorkletProcessor {
|
| 68 |
-
constructor() {
|
| 69 |
-
super();
|
| 70 |
-
this.buffer = new Float32Array(0);
|
| 71 |
-
this.block_frame = 128;
|
| 72 |
-
this.port.onmessage = (e) => {
|
| 73 |
-
if (e.data && e.data.block_frame) this.block_frame = e.data.block_frame;
|
| 74 |
-
};
|
| 75 |
-
}
|
| 76 |
-
|
| 77 |
-
process(inputs) {
|
| 78 |
-
const input = inputs[0];
|
| 79 |
-
if (!input || !input[0]) return true;
|
| 80 |
-
const frame = input[0];
|
| 81 |
-
|
| 82 |
-
const newBuf = new Float32Array(this.buffer.length + frame.length);
|
| 83 |
-
newBuf.set(this.buffer, 0);
|
| 84 |
-
newBuf.set(frame, this.buffer.length);
|
| 85 |
-
this.buffer = newBuf;
|
| 86 |
-
|
| 87 |
-
while (this.buffer.length >= this.block_frame) {
|
| 88 |
-
const chunk = this.buffer.slice(0, this.block_frame);
|
| 89 |
-
|
| 90 |
-
this.port.postMessage({chunk}, [chunk.buffer]);
|
| 91 |
-
this.buffer = this.buffer.slice(this.block_frame);
|
| 92 |
-
}
|
| 93 |
-
|
| 94 |
-
return true;
|
| 95 |
-
}
|
| 96 |
-
}
|
| 97 |
-
registerProcessor('input-processor', InputProcessor);
|
| 98 |
-
`;
|
| 99 |
-
|
| 100 |
-
const playbackWorkletSource = `
|
| 101 |
-
class PlaybackProcessor extends AudioWorkletProcessor {
|
| 102 |
-
constructor(options) {
|
| 103 |
-
super(options);
|
| 104 |
-
const bufferSize = options.processorOptions && options.processorOptions.bufferSize ? options.processorOptions.bufferSize: 98304;
|
| 105 |
-
this.buffer = new Float32Array(bufferSize);
|
| 106 |
-
this.bufferCapacity = bufferSize;
|
| 107 |
-
this.writePointer = 0;
|
| 108 |
-
this.readPointer = 0;
|
| 109 |
-
this.availableSamples = 0;
|
| 110 |
-
this.port.onmessage = (e) => {
|
| 111 |
-
if (e.data && e.data.chunk) {
|
| 112 |
-
const chunk = new Float32Array(e.data.chunk);
|
| 113 |
-
const chunkSize = chunk.length;
|
| 114 |
-
|
| 115 |
-
if (this.availableSamples + chunkSize > this.bufferCapacity) return;
|
| 116 |
-
|
| 117 |
-
for (let i = 0; i < chunkSize; i++) {
|
| 118 |
-
this.buffer[this.writePointer] = chunk[i];
|
| 119 |
-
this.writePointer = (this.writePointer + 1) % this.bufferCapacity;
|
| 120 |
-
}
|
| 121 |
-
|
| 122 |
-
this.availableSamples += chunkSize;
|
| 123 |
-
}
|
| 124 |
-
};
|
| 125 |
-
}
|
| 126 |
-
|
| 127 |
-
process(inputs, outputs) {
|
| 128 |
-
const output = outputs[0];
|
| 129 |
-
if (!output || !output[0]) return true;
|
| 130 |
-
|
| 131 |
-
const frame = output[0];
|
| 132 |
-
const frameSize = frame.length;
|
| 133 |
-
|
| 134 |
-
if (this.availableSamples >= frameSize) {
|
| 135 |
-
for (let i = 0; i < frameSize; i++) {
|
| 136 |
-
frame[i] = this.buffer[this.readPointer];
|
| 137 |
-
this.readPointer = (this.readPointer + 1) % this.bufferCapacity;
|
| 138 |
-
}
|
| 139 |
-
this.availableSamples -= frameSize;
|
| 140 |
-
} else {
|
| 141 |
-
frame.fill(0);
|
| 142 |
-
}
|
| 143 |
-
|
| 144 |
-
if (output.length > 1) output[1].set(output[0]);
|
| 145 |
-
return true;
|
| 146 |
-
}
|
| 147 |
-
}
|
| 148 |
-
registerProcessor('playback-processor', PlaybackProcessor);
|
| 149 |
-
`;
|
| 150 |
-
|
| 151 |
-
window.getAudioDevices = async function() {
|
| 152 |
-
if (!navigator.mediaDevices) {
|
| 153 |
-
setStatus("__MEDIA_DEVICES__");
|
| 154 |
-
return {"inputs": {}, "outputs": {}};
|
| 155 |
-
}
|
| 156 |
-
|
| 157 |
-
try {
|
| 158 |
-
await navigator.mediaDevices.getUserMedia({ audio: true });
|
| 159 |
-
} catch (err) {
|
| 160 |
-
console.error(err);
|
| 161 |
-
setStatus("__MIC_INACCESSIBLE__")
|
| 162 |
-
|
| 163 |
-
return {"inputs": {}, "outputs": {}};
|
| 164 |
-
}
|
| 165 |
-
|
| 166 |
-
const devices = await navigator.mediaDevices.enumerateDevices();
|
| 167 |
-
const inputs = {};
|
| 168 |
-
const outputs = {};
|
| 169 |
-
|
| 170 |
-
for (const device of devices) {
|
| 171 |
-
if (device.kind === "audioinput") {
|
| 172 |
-
inputs[device.label] = device.deviceId
|
| 173 |
-
} else if (device.kind === "audiooutput") {
|
| 174 |
-
outputs[device.label] = device.deviceId
|
| 175 |
-
}
|
| 176 |
-
}
|
| 177 |
-
|
| 178 |
-
if (!Object.keys(inputs).length && !Object.keys(outputs).length) return {"inputs": {}, "outputs": {}};
|
| 179 |
-
return {"inputs": inputs, "outputs": outputs};
|
| 180 |
-
};
|
| 181 |
-
|
| 182 |
-
window.StreamAudioRealtime = async function(
|
| 183 |
-
monitor,
|
| 184 |
-
vad_enabled,
|
| 185 |
-
input_audio_device,
|
| 186 |
-
output_audio_device,
|
| 187 |
-
monitor_output_device,
|
| 188 |
-
input_audio_gain,
|
| 189 |
-
output_audio_gain,
|
| 190 |
-
monitor_audio_gain,
|
| 191 |
-
chunk_size,
|
| 192 |
-
pitch,
|
| 193 |
-
model_pth,
|
| 194 |
-
model_index,
|
| 195 |
-
index_strength,
|
| 196 |
-
predictor_onnx,
|
| 197 |
-
f0_method,
|
| 198 |
-
hop_length,
|
| 199 |
-
embed_mode,
|
| 200 |
-
embedders,
|
| 201 |
-
custom_embedders,
|
| 202 |
-
f0_autotune,
|
| 203 |
-
proposal_pitch,
|
| 204 |
-
f0_autotune_strength,
|
| 205 |
-
proposal_pitch_threshold,
|
| 206 |
-
rms_mix_rate,
|
| 207 |
-
protect,
|
| 208 |
-
filter_radius,
|
| 209 |
-
silent_threshold,
|
| 210 |
-
extra_convert_size,
|
| 211 |
-
cross_fade_overlap_size,
|
| 212 |
-
vad_sensitivity,
|
| 213 |
-
vad_frame_ms,
|
| 214 |
-
clean_audio,
|
| 215 |
-
clean_strength,
|
| 216 |
-
exclusive_mode,
|
| 217 |
-
post_process,
|
| 218 |
-
sid,
|
| 219 |
-
noise_scale,
|
| 220 |
-
embedders_mix,
|
| 221 |
-
embedders_mix_layers,
|
| 222 |
-
embedders_mix_ratio,
|
| 223 |
-
chorus,
|
| 224 |
-
distortion,
|
| 225 |
-
reverb,
|
| 226 |
-
pitch_shift,
|
| 227 |
-
delay,
|
| 228 |
-
compressor,
|
| 229 |
-
limiter,
|
| 230 |
-
gain,
|
| 231 |
-
bitcrush,
|
| 232 |
-
clipping,
|
| 233 |
-
phaser,
|
| 234 |
-
chorus_depth,
|
| 235 |
-
chorus_rate,
|
| 236 |
-
chorus_mix,
|
| 237 |
-
chorus_center_delay,
|
| 238 |
-
chorus_feedback,
|
| 239 |
-
distortion_gain,
|
| 240 |
-
reverb_room_size,
|
| 241 |
-
reverb_damping,
|
| 242 |
-
reverb_wet_gain,
|
| 243 |
-
reverb_dry_gain,
|
| 244 |
-
reverb_width,
|
| 245 |
-
reverb_freeze_mode,
|
| 246 |
-
pitch_shift_semitones,
|
| 247 |
-
delay_seconds,
|
| 248 |
-
delay_feedback,
|
| 249 |
-
delay_mix,
|
| 250 |
-
compressor_threshold,
|
| 251 |
-
compressor_ratio,
|
| 252 |
-
compressor_attack,
|
| 253 |
-
compressor_release,
|
| 254 |
-
limiter_threshold,
|
| 255 |
-
limiter_release_time,
|
| 256 |
-
gain_db,
|
| 257 |
-
bitcrush_bit_depth,
|
| 258 |
-
clipping_threshold,
|
| 259 |
-
phaser_rate_hz,
|
| 260 |
-
phaser_depth,
|
| 261 |
-
phaser_centre_frequency_hz,
|
| 262 |
-
phaser_feedback,
|
| 263 |
-
phaser_mix,
|
| 264 |
-
nprobe
|
| 265 |
-
) {
|
| 266 |
-
const SampleRate = 48000;
|
| 267 |
-
const ReadChunkSize = Math.round(chunk_size * SampleRate / 1000 / 128);
|
| 268 |
-
const block_frame = parseInt(ReadChunkSize) * 128;
|
| 269 |
-
const ButtonState = { start_button: true, stop_button: false };
|
| 270 |
-
const devices = await window.getAudioDevices();
|
| 271 |
-
|
| 272 |
-
input_audio_device = devices["inputs"][input_audio_device];
|
| 273 |
-
output_audio_device = devices["outputs"][output_audio_device];
|
| 274 |
-
if (monitor && devices["outputs"][monitor_output_device]) monitor_output_device = devices["outputs"][monitor_output_device];
|
| 275 |
-
|
| 276 |
-
try {
|
| 277 |
-
if (!input_audio_device || !output_audio_device) {
|
| 278 |
-
setStatus("__PROVIDE_AUDIO_DEVICE__");
|
| 279 |
-
return ButtonState;
|
| 280 |
-
}
|
| 281 |
-
|
| 282 |
-
if (monitor && !monitor_output_device) {
|
| 283 |
-
setStatus("__PROVIDE_MONITOR_DEVICE__");
|
| 284 |
-
return ButtonState;
|
| 285 |
-
}
|
| 286 |
-
|
| 287 |
-
if (!model_pth) {
|
| 288 |
-
setStatus("__PROVIDE_MODEL__")
|
| 289 |
-
return ButtonState;
|
| 290 |
-
}
|
| 291 |
-
|
| 292 |
-
setStatus("__START_REALTIME__", false)
|
| 293 |
-
|
| 294 |
-
const stream = await navigator.mediaDevices.getUserMedia({
|
| 295 |
-
audio: {
|
| 296 |
-
deviceId: { exact: input_audio_device },
|
| 297 |
-
channelCount: 1,
|
| 298 |
-
sampleRate: SampleRate,
|
| 299 |
-
echoCancellation: !exclusive_mode,
|
| 300 |
-
noiseSuppression: !exclusive_mode,
|
| 301 |
-
autoGainControl: !exclusive_mode
|
| 302 |
-
}
|
| 303 |
-
});
|
| 304 |
-
|
| 305 |
-
let latencyHint = "playback";
|
| 306 |
-
if (exclusive_mode) latencyHint = "interactive";
|
| 307 |
-
|
| 308 |
-
window._activeStream = stream;
|
| 309 |
-
window._audioCtx = new AudioContext({ sampleRate: SampleRate, latencyHint: latencyHint });
|
| 310 |
-
|
| 311 |
-
await addModuleFromString(window._audioCtx, inputWorkletSource);
|
| 312 |
-
await addModuleFromString(window._audioCtx, playbackWorkletSource);
|
| 313 |
-
|
| 314 |
-
const src = window._audioCtx.createMediaStreamSource(stream);
|
| 315 |
-
const inputNode = new AudioWorkletNode(window._audioCtx, 'input-processor');
|
| 316 |
-
const playbackNode = new AudioWorkletNode(window._audioCtx, 'playback-processor', {
|
| 317 |
-
processorOptions: {
|
| 318 |
-
bufferSize: block_frame * 2
|
| 319 |
-
}
|
| 320 |
-
});
|
| 321 |
-
|
| 322 |
-
inputNode.port.postMessage({ block_frame: block_frame });
|
| 323 |
-
src.connect(inputNode);
|
| 324 |
-
|
| 325 |
-
window.OutputAudioRoute = createOutputRoute(window._audioCtx, playbackNode, output_audio_device, output_audio_gain / 100);
|
| 326 |
-
if (monitor && monitor_output_device) window.MonitorAudioRoute = createOutputRoute(window._audioCtx, playbackNode, monitor_output_device, monitor_audio_gain / 100);
|
| 327 |
-
|
| 328 |
-
const protocol = (location.protocol === "https:") ? "wss:" : "ws:";
|
| 329 |
-
const wsUrl = protocol + '//' + location.hostname + `:${location.port}` + '/api/ws-audio';
|
| 330 |
-
const ws = new WebSocket(wsUrl);
|
| 331 |
-
|
| 332 |
-
ButtonState.start_button = false;
|
| 333 |
-
ButtonState.stop_button = true;
|
| 334 |
-
|
| 335 |
-
ws.binaryType = "arraybuffer";
|
| 336 |
-
window._ws = ws;
|
| 337 |
-
|
| 338 |
-
ws.onopen = () => {
|
| 339 |
-
console.log("__WS_CONNECTED__")
|
| 340 |
-
|
| 341 |
-
ws.send(
|
| 342 |
-
JSON.stringify({
|
| 343 |
-
type: 'init',
|
| 344 |
-
chunk_size: ReadChunkSize,
|
| 345 |
-
embedders: embedders,
|
| 346 |
-
model_pth: model_pth,
|
| 347 |
-
custom_embedders: custom_embedders,
|
| 348 |
-
cross_fade_overlap_size: cross_fade_overlap_size,
|
| 349 |
-
extra_convert_size: extra_convert_size,
|
| 350 |
-
model_index: model_index,
|
| 351 |
-
f0_method: f0_method,
|
| 352 |
-
predictor_onnx: predictor_onnx,
|
| 353 |
-
embedders_mode: embed_mode,
|
| 354 |
-
hop_length: hop_length,
|
| 355 |
-
silent_threshold: silent_threshold,
|
| 356 |
-
vad_enabled: vad_enabled,
|
| 357 |
-
vad_sensitivity: vad_sensitivity,
|
| 358 |
-
vad_frame_ms: vad_frame_ms,
|
| 359 |
-
clean_audio: clean_audio,
|
| 360 |
-
clean_strength: clean_strength,
|
| 361 |
-
f0_up_key: pitch,
|
| 362 |
-
index_rate: index_strength,
|
| 363 |
-
protect: protect,
|
| 364 |
-
filter_radius: filter_radius,
|
| 365 |
-
rms_mix_rate: rms_mix_rate,
|
| 366 |
-
f0_autotune: f0_autotune,
|
| 367 |
-
f0_autotune_strength: f0_autotune_strength,
|
| 368 |
-
proposal_pitch: proposal_pitch,
|
| 369 |
-
proposal_pitch_threshold: proposal_pitch_threshold,
|
| 370 |
-
input_audio_gain: input_audio_gain,
|
| 371 |
-
post_process: post_process,
|
| 372 |
-
sid: sid,
|
| 373 |
-
noise_scale: noise_scale,
|
| 374 |
-
embedders_mix: embedders_mix,
|
| 375 |
-
embedders_mix_layers: embedders_mix_layers,
|
| 376 |
-
embedders_mix_ratio: embedders_mix_ratio,
|
| 377 |
-
nprobe: nprobe,
|
| 378 |
-
kwargs: {
|
| 379 |
-
chorus: chorus,
|
| 380 |
-
distortion: distortion,
|
| 381 |
-
reverb: reverb,
|
| 382 |
-
pitch_shift: pitch_shift,
|
| 383 |
-
delay: delay,
|
| 384 |
-
compressor: compressor,
|
| 385 |
-
limiter: limiter,
|
| 386 |
-
gain: gain,
|
| 387 |
-
bitcrush: bitcrush,
|
| 388 |
-
clipping: clipping,
|
| 389 |
-
phaser: phaser,
|
| 390 |
-
chorus_depth: chorus_depth,
|
| 391 |
-
chorus_rate: chorus_rate,
|
| 392 |
-
chorus_mix: chorus_mix,
|
| 393 |
-
chorus_delay: chorus_center_delay,
|
| 394 |
-
chorus_feedback: chorus_feedback,
|
| 395 |
-
distortion_gain: distortion_gain,
|
| 396 |
-
reverb_room_size: reverb_room_size,
|
| 397 |
-
reverb_damping: reverb_damping,
|
| 398 |
-
reverb_wet_level: reverb_wet_gain,
|
| 399 |
-
reverb_dry_level: reverb_dry_gain,
|
| 400 |
-
reverb_width: reverb_width,
|
| 401 |
-
reverb_freeze_mode: reverb_freeze_mode,
|
| 402 |
-
pitch_shift_semitones: pitch_shift_semitones,
|
| 403 |
-
delay_seconds: delay_seconds,
|
| 404 |
-
delay_feedback: delay_feedback,
|
| 405 |
-
delay_mix: delay_mix,
|
| 406 |
-
compressor_threshold: compressor_threshold,
|
| 407 |
-
compressor_ratio: compressor_ratio,
|
| 408 |
-
compressor_attack: compressor_attack,
|
| 409 |
-
compressor_release: compressor_release,
|
| 410 |
-
limiter_threshold: limiter_threshold,
|
| 411 |
-
limiter_release: limiter_release_time,
|
| 412 |
-
gain_db: gain_db,
|
| 413 |
-
bitcrush_bit_depth: bitcrush_bit_depth,
|
| 414 |
-
clipping_threshold: clipping_threshold,
|
| 415 |
-
phaser_rate_hz: phaser_rate_hz,
|
| 416 |
-
phaser_depth: phaser_depth,
|
| 417 |
-
phaser_centre_frequency_hz: phaser_centre_frequency_hz,
|
| 418 |
-
phaser_feedback: phaser_feedback,
|
| 419 |
-
phaser_mix: phaser_mix
|
| 420 |
-
}
|
| 421 |
-
})
|
| 422 |
-
);
|
| 423 |
-
};
|
| 424 |
-
|
| 425 |
-
inputNode.port.onmessage = (e) => {
|
| 426 |
-
const chunk = e.data && e.data.chunk;
|
| 427 |
-
|
| 428 |
-
if (!chunk) return;
|
| 429 |
-
if (ws.readyState === WebSocket.OPEN) {
|
| 430 |
-
window.lastSend = performance.now();
|
| 431 |
-
ws.send(chunk);
|
| 432 |
-
}
|
| 433 |
-
};
|
| 434 |
-
|
| 435 |
-
ws.onmessage = (ev) => {
|
| 436 |
-
if (typeof ev.data === 'string') {
|
| 437 |
-
const msg = JSON.parse(ev.data);
|
| 438 |
-
|
| 439 |
-
if (msg.type === 'latency') setStatus(`__LATENCY__: ${msg.value.toFixed(2)} ms | __VOLUME__: ${msg.volume.toFixed(2)} dB | __RESPONSE__: ${window.responseMs.toFixed(2)} ms`, use_alert=false)
|
| 440 |
-
if (msg.type === 'warnings') {
|
| 441 |
-
setStatus(msg.value);
|
| 442 |
-
StopAudioStream();
|
| 443 |
-
}
|
| 444 |
-
|
| 445 |
-
return;
|
| 446 |
-
}
|
| 447 |
-
|
| 448 |
-
const ab = ev.data;
|
| 449 |
-
playbackNode.port.postMessage({ chunk: ab }, [ab]);
|
| 450 |
-
window.responseMs = performance.now() - window.lastSend;
|
| 451 |
-
};
|
| 452 |
-
|
| 453 |
-
ws.onclose = () => console.log("__WS_CLOSED__");
|
| 454 |
-
window._workletNode = inputNode;
|
| 455 |
-
window._playbackNode = playbackNode;
|
| 456 |
-
|
| 457 |
-
if (window._audioCtx.state === 'suspended') await window._audioCtx.resume();
|
| 458 |
-
|
| 459 |
-
console.log("__REALTIME_STARTED__");
|
| 460 |
-
return ButtonState;
|
| 461 |
-
} catch (err) {
|
| 462 |
-
console.error("__ERROR__", err);
|
| 463 |
-
alert("__ERROR__" + err.message);
|
| 464 |
-
|
| 465 |
-
return StopAudioStream();
|
| 466 |
-
}
|
| 467 |
-
};
|
| 468 |
-
|
| 469 |
-
window.ChangeConfig = async function(value, key, if_kwargs=false) {
|
| 470 |
-
if (key === "output_audio_gain") {
|
| 471 |
-
window.OutputAudioRoute.gainNode.gain.value = value / 100
|
| 472 |
-
} else if (key == "monitor_audio_gain") {
|
| 473 |
-
if (window.MonitorAudioRoute) window.MonitorAudioRoute.gainNode.gain.value = value / 100
|
| 474 |
-
} else {
|
| 475 |
-
const protocol = (location.protocol === "https:") ? "wss:" : "ws:";
|
| 476 |
-
const wsUrl = protocol + '//' + location.hostname + `:${location.port}` + '/api/change-config';
|
| 477 |
-
const ws = new WebSocket(wsUrl);
|
| 478 |
-
|
| 479 |
-
ws.binaryType = "arraybuffer";
|
| 480 |
-
ws.onopen = () => {
|
| 481 |
-
ws.send(
|
| 482 |
-
JSON.stringify({
|
| 483 |
-
type: 'init',
|
| 484 |
-
key: key,
|
| 485 |
-
value: value,
|
| 486 |
-
if_kwargs: if_kwargs
|
| 487 |
-
})
|
| 488 |
-
);
|
| 489 |
-
|
| 490 |
-
ws.close();
|
| 491 |
-
};
|
| 492 |
-
}
|
| 493 |
-
}
|
| 494 |
-
|
| 495 |
-
window.StopAudioStream = async function() {
|
| 496 |
-
try {
|
| 497 |
-
if (window._ws) {
|
| 498 |
-
window._ws.close();
|
| 499 |
-
window._ws = null;
|
| 500 |
-
}
|
| 501 |
-
|
| 502 |
-
if (window._activeStream) {
|
| 503 |
-
window._activeStream.getTracks().forEach(t => t.stop());
|
| 504 |
-
window._activeStream = null;
|
| 505 |
-
}
|
| 506 |
-
|
| 507 |
-
if (window._workletNode) {
|
| 508 |
-
window._workletNode.disconnect();
|
| 509 |
-
window._workletNode = null;
|
| 510 |
-
}
|
| 511 |
-
|
| 512 |
-
if (window._playbackNode) {
|
| 513 |
-
window._playbackNode.disconnect();
|
| 514 |
-
window._playbackNode = null;
|
| 515 |
-
}
|
| 516 |
-
|
| 517 |
-
if (window._audioCtx) {
|
| 518 |
-
await window._audioCtx.close();
|
| 519 |
-
window._audioCtx = null;
|
| 520 |
-
}
|
| 521 |
-
|
| 522 |
-
if (window.OutputAudioRoute) window.OutputAudioRoute = null;
|
| 523 |
-
if (window.MonitorAudioRoute) window.MonitorAudioRoute = null;
|
| 524 |
-
|
| 525 |
-
document.querySelectorAll('audio').forEach(a => a.remove());
|
| 526 |
-
setStatus("__REALTIME_HAS_STOP__", false);
|
| 527 |
-
|
| 528 |
-
return {"start_button": true, "stop_button": false};
|
| 529 |
-
} catch (e) {
|
| 530 |
-
setStatus(`__ERROR__ ${e}`);
|
| 531 |
-
|
| 532 |
-
return {"start_button": false, "stop_button": true}
|
| 533 |
-
}
|
| 534 |
-
};
|
| 535 |
-
|
| 536 |
-
window.SoundfileRecordAudio = async function (RecordButton, RecordAudioPath, ExportFormat) {
|
| 537 |
-
const protocol = (location.protocol === "https:") ? "https:" : "http:";
|
| 538 |
-
const url = protocol + '//' + location.hostname + `:${location.port}` + '/api/record';
|
| 539 |
-
|
| 540 |
-
const res = await fetch(url, {
|
| 541 |
-
method: "POST",
|
| 542 |
-
headers: {
|
| 543 |
-
"Content-Type": "application/json"
|
| 544 |
-
},
|
| 545 |
-
body: JSON.stringify({
|
| 546 |
-
record_button: RecordButton,
|
| 547 |
-
record_audio_path: RecordAudioPath,
|
| 548 |
-
export_format: ExportFormat
|
| 549 |
-
})
|
| 550 |
-
});
|
| 551 |
-
|
| 552 |
-
const msg = await res.json();
|
| 553 |
-
|
| 554 |
-
if (msg.type === "info" || msg.type === "warnings") {
|
| 555 |
-
alert(msg.value);
|
| 556 |
-
|
| 557 |
-
return {
|
| 558 |
-
"button": msg.button,
|
| 559 |
-
"path": msg.path
|
| 560 |
-
};
|
| 561 |
-
}
|
| 562 |
-
};
|
| 563 |
-
""".replace(
|
| 564 |
-
"__MEDIA_DEVICES__", translations["media_devices"]
|
| 565 |
-
).replace(
|
| 566 |
-
"__MIC_INACCESSIBLE__", translations["mic_inaccessible"]
|
| 567 |
-
).replace(
|
| 568 |
-
"__PROVIDE_AUDIO_DEVICE__", translations["provide_audio_device"]
|
| 569 |
-
).replace(
|
| 570 |
-
"__PROVIDE_MONITOR_DEVICE__", translations["provide_monitor_device"]
|
| 571 |
-
).replace(
|
| 572 |
-
"__START_REALTIME__", translations["start_realtime"]
|
| 573 |
-
).replace(
|
| 574 |
-
"__LATENCY__", translations['latency']
|
| 575 |
-
).replace(
|
| 576 |
-
"__WS_CONNECTED__", translations["ws_connected"]
|
| 577 |
-
).replace(
|
| 578 |
-
"__WS_CLOSED__", translations["ws_closed"]
|
| 579 |
-
).replace(
|
| 580 |
-
"__REALTIME_STARTED__", translations["realtime_is_ready"]
|
| 581 |
-
).replace(
|
| 582 |
-
"__ERROR__", translations["error_occurred"].format(e="")
|
| 583 |
-
).replace(
|
| 584 |
-
"__REALTIME_HAS_STOP__", translations["realtime_has_stop"]
|
| 585 |
-
).replace(
|
| 586 |
-
"__PROVIDE_MODEL__", translations["provide_file"].format(filename=translations["model"])
|
| 587 |
-
).replace(
|
| 588 |
-
"__VOLUME__", translations["volume"]
|
| 589 |
-
).replace(
|
| 590 |
-
"__RESPONSE__", translations["response"]
|
| 591 |
-
)
|
| 592 |
-
|
| 593 |
-
def realtime_start(
|
| 594 |
-
monitor,
|
| 595 |
-
exclusive_mode,
|
| 596 |
-
vad_enabled,
|
| 597 |
-
input_audio_device,
|
| 598 |
-
output_audio_device,
|
| 599 |
-
monitor_output_device,
|
| 600 |
-
input_audio_gain,
|
| 601 |
-
output_audio_gain,
|
| 602 |
-
monitor_audio_gain,
|
| 603 |
-
input_asio_channels,
|
| 604 |
-
output_asio_channels,
|
| 605 |
-
monitor_asio_channels,
|
| 606 |
-
input_audio_sample_rate,
|
| 607 |
-
output_audio_sample_rate,
|
| 608 |
-
monitor_audio_sample_rate,
|
| 609 |
-
chunk_size,
|
| 610 |
-
pitch,
|
| 611 |
-
model_pth,
|
| 612 |
-
model_index,
|
| 613 |
-
index_strength,
|
| 614 |
-
predictor_onnx,
|
| 615 |
-
f0_method,
|
| 616 |
-
hop_length,
|
| 617 |
-
embed_mode,
|
| 618 |
-
embedders,
|
| 619 |
-
custom_embedders,
|
| 620 |
-
f0_autotune,
|
| 621 |
-
proposal_pitch,
|
| 622 |
-
f0_autotune_strength,
|
| 623 |
-
proposal_pitch_threshold,
|
| 624 |
-
rms_mix_rate,
|
| 625 |
-
protect,
|
| 626 |
-
filter_radius,
|
| 627 |
-
silent_threshold,
|
| 628 |
-
extra_convert_size,
|
| 629 |
-
cross_fade_overlap_size,
|
| 630 |
-
vad_sensitivity,
|
| 631 |
-
vad_frame_ms,
|
| 632 |
-
clean_audio,
|
| 633 |
-
clean_strength,
|
| 634 |
-
post_process,
|
| 635 |
-
sid,
|
| 636 |
-
noise_scale,
|
| 637 |
-
embedders_mix,
|
| 638 |
-
embedders_mix_layers,
|
| 639 |
-
embedders_mix_ratio,
|
| 640 |
-
chorus,
|
| 641 |
-
distortion,
|
| 642 |
-
reverb,
|
| 643 |
-
pitch_shift,
|
| 644 |
-
delay,
|
| 645 |
-
compressor,
|
| 646 |
-
limiter,
|
| 647 |
-
gain,
|
| 648 |
-
bitcrush,
|
| 649 |
-
clipping,
|
| 650 |
-
phaser,
|
| 651 |
-
chorus_depth,
|
| 652 |
-
chorus_rate,
|
| 653 |
-
chorus_mix,
|
| 654 |
-
chorus_center_delay,
|
| 655 |
-
chorus_feedback,
|
| 656 |
-
distortion_gain,
|
| 657 |
-
reverb_room_size,
|
| 658 |
-
reverb_damping,
|
| 659 |
-
reverb_wet_gain,
|
| 660 |
-
reverb_dry_gain,
|
| 661 |
-
reverb_width,
|
| 662 |
-
reverb_freeze_mode,
|
| 663 |
-
pitch_shift_semitones,
|
| 664 |
-
delay_seconds,
|
| 665 |
-
delay_feedback,
|
| 666 |
-
delay_mix,
|
| 667 |
-
compressor_threshold,
|
| 668 |
-
compressor_ratio,
|
| 669 |
-
compressor_attack,
|
| 670 |
-
compressor_release,
|
| 671 |
-
limiter_threshold,
|
| 672 |
-
limiter_release_time,
|
| 673 |
-
gain_db,
|
| 674 |
-
bitcrush_bit_depth,
|
| 675 |
-
clipping_threshold,
|
| 676 |
-
phaser_rate_hz,
|
| 677 |
-
phaser_depth,
|
| 678 |
-
phaser_centre_frequency_hz,
|
| 679 |
-
phaser_feedback,
|
| 680 |
-
phaser_mix,
|
| 681 |
-
nprobe = 1
|
| 682 |
-
):
|
| 683 |
-
global running, callbacks, audio_manager, callbacks_kwargs
|
| 684 |
-
running = True
|
| 685 |
-
|
| 686 |
-
gr_info(translations["start_realtime"])
|
| 687 |
-
|
| 688 |
-
yield (
|
| 689 |
-
translations["start_realtime"],
|
| 690 |
-
interactive_false,
|
| 691 |
-
interactive_true
|
| 692 |
-
)
|
| 693 |
-
|
| 694 |
-
if not input_audio_device or not output_audio_device:
|
| 695 |
-
gr_warning(translations["provide_audio_device"])
|
| 696 |
-
|
| 697 |
-
yield (
|
| 698 |
-
translations["provide_audio_device"],
|
| 699 |
-
interactive_true,
|
| 700 |
-
interactive_false
|
| 701 |
-
)
|
| 702 |
-
return
|
| 703 |
-
|
| 704 |
-
if monitor and not monitor_output_device:
|
| 705 |
-
gr_warning(translations["provide_monitor_device"])
|
| 706 |
-
|
| 707 |
-
yield (
|
| 708 |
-
translations["provide_monitor_device"],
|
| 709 |
-
interactive_true,
|
| 710 |
-
interactive_false
|
| 711 |
-
)
|
| 712 |
-
return
|
| 713 |
-
|
| 714 |
-
model_pth = os.path.join(configs["weights_path"], model_pth) if not os.path.exists(model_pth) else model_pth
|
| 715 |
-
embedder_model = (embedders if embedders != "custom" else custom_embedders)
|
| 716 |
-
|
| 717 |
-
if (
|
| 718 |
-
not model_pth or
|
| 719 |
-
not os.path.exists(model_pth) or
|
| 720 |
-
os.path.isdir(model_pth) or
|
| 721 |
-
not model_pth.endswith((".pth", ".onnx"))
|
| 722 |
-
):
|
| 723 |
-
gr_warning(translations["provide_file"].format(filename=translations["model"]))
|
| 724 |
-
|
| 725 |
-
yield (
|
| 726 |
-
translations["provide_file"].format(filename=translations["model"]),
|
| 727 |
-
interactive_true,
|
| 728 |
-
interactive_false
|
| 729 |
-
)
|
| 730 |
-
return
|
| 731 |
-
|
| 732 |
-
input_is_asio = "ASIO" in input_audio_device
|
| 733 |
-
output_is_asio = "ASIO" in output_audio_device
|
| 734 |
-
monitor_is_asio = "ASIO" in monitor_output_device
|
| 735 |
-
|
| 736 |
-
if input_is_asio or output_is_asio or monitor_is_asio:
|
| 737 |
-
import main.library.audio.sounddevice as sd
|
| 738 |
-
|
| 739 |
-
sd.terminate()
|
| 740 |
-
sd.initialize()
|
| 741 |
-
|
| 742 |
-
import main.app.core.ui as ui
|
| 743 |
-
|
| 744 |
-
input_device_id = ui.input_channels_map[input_audio_device][0]
|
| 745 |
-
output_device_id = ui.output_channels_map[output_audio_device][0]
|
| 746 |
-
output_monitor_id = ui.output_channels_map[monitor_output_device][0] if monitor else None
|
| 747 |
-
|
| 748 |
-
input_audio_gain /= 100.0
|
| 749 |
-
output_audio_gain /= 100.0
|
| 750 |
-
monitor_audio_gain /= 100.0
|
| 751 |
-
|
| 752 |
-
chunk_size = int(chunk_size * input_audio_sample_rate / 1000 / 128)
|
| 753 |
-
|
| 754 |
-
from main.inference.realtime.callbacks import AudioCallbacks
|
| 755 |
-
|
| 756 |
-
callbacks_kwargs = {
|
| 757 |
-
"pass_through": False,
|
| 758 |
-
"read_chunk_size": chunk_size,
|
| 759 |
-
"cross_fade_overlap_size": cross_fade_overlap_size,
|
| 760 |
-
"input_sample_rate": input_audio_sample_rate,
|
| 761 |
-
"output_sample_rate": input_audio_sample_rate,
|
| 762 |
-
"extra_convert_size": extra_convert_size,
|
| 763 |
-
"model_path": model_pth,
|
| 764 |
-
"index_path": model_index,
|
| 765 |
-
"f0_method": f0_method,
|
| 766 |
-
"predictor_onnx": predictor_onnx,
|
| 767 |
-
"embedder_model": embedder_model,
|
| 768 |
-
"embedders_mode": embed_mode,
|
| 769 |
-
"sample_rate": PIPELINE_SAMPLE_RATE,
|
| 770 |
-
"hop_length": hop_length,
|
| 771 |
-
"silent_threshold": silent_threshold,
|
| 772 |
-
"f0_up_key": pitch,
|
| 773 |
-
"index_rate": index_strength,
|
| 774 |
-
"protect": protect,
|
| 775 |
-
"filter_radius": filter_radius,
|
| 776 |
-
"rms_mix_rate": rms_mix_rate,
|
| 777 |
-
"f0_autotune": f0_autotune,
|
| 778 |
-
"f0_autotune_strength": f0_autotune_strength,
|
| 779 |
-
"proposal_pitch": proposal_pitch,
|
| 780 |
-
"proposal_pitch_threshold": proposal_pitch_threshold,
|
| 781 |
-
"input_audio_gain": input_audio_gain,
|
| 782 |
-
"output_audio_gain": output_audio_gain,
|
| 783 |
-
"monitor_audio_gain": monitor_audio_gain,
|
| 784 |
-
"monitor": monitor,
|
| 785 |
-
"vad_enabled": vad_enabled,
|
| 786 |
-
"vad_sensitivity": vad_sensitivity,
|
| 787 |
-
"vad_frame_ms": vad_frame_ms,
|
| 788 |
-
"clean_audio": clean_audio,
|
| 789 |
-
"clean_strength": clean_strength,
|
| 790 |
-
"post_process": post_process,
|
| 791 |
-
"sid": sid,
|
| 792 |
-
"noise_scale": noise_scale,
|
| 793 |
-
"nprobe": nprobe,
|
| 794 |
-
"embedders_mix": embedders_mix,
|
| 795 |
-
"embedders_mix_layers": embedders_mix_layers,
|
| 796 |
-
"embedders_mix_ratio": embedders_mix_ratio,
|
| 797 |
-
"kwargs": {
|
| 798 |
-
"chorus": chorus,
|
| 799 |
-
"distortion": distortion,
|
| 800 |
-
"reverb": reverb,
|
| 801 |
-
"pitch_shift": pitch_shift,
|
| 802 |
-
"delay": delay,
|
| 803 |
-
"compressor": compressor,
|
| 804 |
-
"limiter": limiter,
|
| 805 |
-
"gain": gain,
|
| 806 |
-
"bitcrush": bitcrush,
|
| 807 |
-
"clipping": clipping,
|
| 808 |
-
"phaser": phaser,
|
| 809 |
-
"chorus_depth": chorus_depth,
|
| 810 |
-
"chorus_rate": chorus_rate,
|
| 811 |
-
"chorus_mix": chorus_mix,
|
| 812 |
-
"chorus_delay": chorus_center_delay,
|
| 813 |
-
"chorus_feedback": chorus_feedback,
|
| 814 |
-
"distortion_gain": distortion_gain,
|
| 815 |
-
"reverb_room_size": reverb_room_size,
|
| 816 |
-
"reverb_damping": reverb_damping,
|
| 817 |
-
"reverb_wet_level": reverb_wet_gain,
|
| 818 |
-
"reverb_dry_level": reverb_dry_gain,
|
| 819 |
-
"reverb_width": reverb_width,
|
| 820 |
-
"reverb_freeze_mode": reverb_freeze_mode,
|
| 821 |
-
"pitch_shift_semitones": pitch_shift_semitones,
|
| 822 |
-
"delay_seconds": delay_seconds,
|
| 823 |
-
"delay_feedback": delay_feedback,
|
| 824 |
-
"delay_mix": delay_mix,
|
| 825 |
-
"compressor_threshold": compressor_threshold,
|
| 826 |
-
"compressor_ratio": compressor_ratio,
|
| 827 |
-
"compressor_attack": compressor_attack,
|
| 828 |
-
"compressor_release": compressor_release,
|
| 829 |
-
"limiter_threshold": limiter_threshold,
|
| 830 |
-
"limiter_release": limiter_release_time,
|
| 831 |
-
"gain_db": gain_db,
|
| 832 |
-
"bitcrush_bit_depth": bitcrush_bit_depth,
|
| 833 |
-
"clipping_threshold": clipping_threshold,
|
| 834 |
-
"phaser_rate_hz": phaser_rate_hz,
|
| 835 |
-
"phaser_depth": phaser_depth,
|
| 836 |
-
"phaser_centre_frequency_hz": phaser_centre_frequency_hz,
|
| 837 |
-
"phaser_feedback": phaser_feedback,
|
| 838 |
-
"phaser_mix": phaser_mix
|
| 839 |
-
}
|
| 840 |
-
}
|
| 841 |
-
|
| 842 |
-
callbacks = AudioCallbacks(**callbacks_kwargs)
|
| 843 |
-
|
| 844 |
-
def stop_with_error():
|
| 845 |
-
global running
|
| 846 |
-
|
| 847 |
-
realtime_stop()
|
| 848 |
-
running = False
|
| 849 |
-
|
| 850 |
-
return (
|
| 851 |
-
translations["realtime_has_stop_with_error"],
|
| 852 |
-
interactive_true,
|
| 853 |
-
interactive_false
|
| 854 |
-
)
|
| 855 |
-
|
| 856 |
-
try:
|
| 857 |
-
audio_manager = callbacks.audio
|
| 858 |
-
audio_manager.start(
|
| 859 |
-
input_device_id=input_device_id,
|
| 860 |
-
output_device_id=output_device_id,
|
| 861 |
-
output_monitor_id=output_monitor_id,
|
| 862 |
-
exclusive_mode=exclusive_mode,
|
| 863 |
-
asio_input_channel=input_asio_channels,
|
| 864 |
-
asio_output_channel=output_asio_channels,
|
| 865 |
-
asio_output_monitor_channel=monitor_asio_channels,
|
| 866 |
-
read_chunk_size=chunk_size,
|
| 867 |
-
input_audio_sample_rate=input_audio_sample_rate,
|
| 868 |
-
output_audio_sample_rate=output_audio_sample_rate,
|
| 869 |
-
output_monitor_sample_rate=monitor_audio_sample_rate
|
| 870 |
-
)
|
| 871 |
-
except Exception as e:
|
| 872 |
-
import traceback
|
| 873 |
-
|
| 874 |
-
logger.error(e)
|
| 875 |
-
logger.debug(traceback.format_exc())
|
| 876 |
-
|
| 877 |
-
return stop_with_error()
|
| 878 |
-
|
| 879 |
-
gr_info(translations["realtime_is_ready"])
|
| 880 |
-
|
| 881 |
-
while running and callbacks is not None and audio_manager is not None:
|
| 882 |
-
time.sleep(0.1)
|
| 883 |
-
if hasattr(callbacks, "audio") and hasattr(callbacks.audio, "performance") and hasattr(callbacks.audio, "volume"):
|
| 884 |
-
yield (
|
| 885 |
-
f"{translations['latency']}: {callbacks.audio.performance:.2f} ms | {translations['volume']}: {callbacks.audio.volume:.2f} dB",
|
| 886 |
-
interactive_false,
|
| 887 |
-
interactive_true
|
| 888 |
-
)
|
| 889 |
-
|
| 890 |
-
return (
|
| 891 |
-
translations["realtime_has_stop"],
|
| 892 |
-
interactive_true,
|
| 893 |
-
interactive_false
|
| 894 |
-
)
|
| 895 |
-
|
| 896 |
-
def change_callbacks_config():
|
| 897 |
-
global callbacks
|
| 898 |
-
|
| 899 |
-
if running and audio_manager is not None and callbacks is not None:
|
| 900 |
-
crossfade_frame = int(callbacks_kwargs.get("cross_fade_overlap_size", 0.1) * callbacks.input_sample_rate)
|
| 901 |
-
extra_frame = int(callbacks_kwargs.get("extra_convert_size", 0.5) * callbacks.input_sample_rate)
|
| 902 |
-
|
| 903 |
-
if (
|
| 904 |
-
callbacks.vc.crossfade_frame != crossfade_frame or
|
| 905 |
-
callbacks.vc.extra_frame != extra_frame
|
| 906 |
-
):
|
| 907 |
-
del (
|
| 908 |
-
callbacks.vc.fade_in_window,
|
| 909 |
-
callbacks.vc.fade_out_window,
|
| 910 |
-
callbacks.vc.sola_buffer
|
| 911 |
-
)
|
| 912 |
-
|
| 913 |
-
callbacks.vc.vc_model.realloc(
|
| 914 |
-
callbacks.vc.block_frame,
|
| 915 |
-
callbacks.vc.extra_frame,
|
| 916 |
-
callbacks.vc.crossfade_frame,
|
| 917 |
-
callbacks.vc.sola_search_frame,
|
| 918 |
-
)
|
| 919 |
-
callbacks.vc.generate_strength()
|
| 920 |
-
|
| 921 |
-
callbacks.vc.vc_model.input_sensitivity = 10 ** (callbacks_kwargs.get("silent_threshold", -90) / 20)
|
| 922 |
-
|
| 923 |
-
vad_enabled = callbacks_kwargs.get("vad_enabled", True)
|
| 924 |
-
sensitivity_mode = callbacks_kwargs.get("vad_sensitivity", 3)
|
| 925 |
-
vad_frame_ms = callbacks_kwargs.get("vad_frame_ms", 30)
|
| 926 |
-
|
| 927 |
-
if vad_enabled is False:
|
| 928 |
-
callbacks.vc.vc_model.vad = None
|
| 929 |
-
elif vad_enabled and callbacks.vc.vc_model.vad is None:
|
| 930 |
-
from main.inference.realtime.vad_utils import VADProcessor
|
| 931 |
-
|
| 932 |
-
callbacks.vc.vc_model.vad = VADProcessor(
|
| 933 |
-
sensitivity_mode=sensitivity_mode,
|
| 934 |
-
sample_rate=callbacks.vc.vc_model.sample_rate,
|
| 935 |
-
frame_duration_ms=vad_frame_ms
|
| 936 |
-
)
|
| 937 |
-
|
| 938 |
-
if callbacks.vc.vc_model.vad is not None:
|
| 939 |
-
callbacks.vc.vc_model.vad.vad.set_mode(sensitivity_mode)
|
| 940 |
-
callbacks.vc.vc_model.vad.frame_length = int(callbacks.vc.vc_model.sample_rate * (vad_frame_ms / 1000.0))
|
| 941 |
-
|
| 942 |
-
clean_audio = callbacks_kwargs.get("clean_audio", False)
|
| 943 |
-
clean_strength = callbacks_kwargs.get("clean_strength", 0.5)
|
| 944 |
-
|
| 945 |
-
if clean_audio is False:
|
| 946 |
-
callbacks.vc.vc_model.tg = None
|
| 947 |
-
elif clean_audio and callbacks.vc.vc_model.tg is None:
|
| 948 |
-
from main.library.audio.noisereduce import TorchGate
|
| 949 |
-
|
| 950 |
-
callbacks.vc.vc_model.tg = (
|
| 951 |
-
TorchGate(
|
| 952 |
-
callbacks.vc.vc_model.pipeline.tgt_sr,
|
| 953 |
-
prop_decrease=clean_strength,
|
| 954 |
-
).to(config.device)
|
| 955 |
-
)
|
| 956 |
-
|
| 957 |
-
if callbacks.vc.vc_model.tg is not None:
|
| 958 |
-
callbacks.vc.vc_model.tg.prop_decrease = clean_strength
|
| 959 |
-
|
| 960 |
-
post_process = callbacks_kwargs.get("post_process", False)
|
| 961 |
-
kwargs = callbacks_kwargs.get("kwargs", {})
|
| 962 |
-
|
| 963 |
-
if post_process is False:
|
| 964 |
-
callbacks.vc.vc_model.board = None
|
| 965 |
-
callbacks.vc.vc_model.kwargs = None
|
| 966 |
-
elif post_process and callbacks.vc.vc_model.kwargs != kwargs:
|
| 967 |
-
new_board = callbacks.vc.vc_model.setup_pedalboard(**kwargs)
|
| 968 |
-
callbacks.vc.vc_model.board = new_board
|
| 969 |
-
callbacks.vc.vc_model.kwargs = kwargs.copy()
|
| 970 |
-
|
| 971 |
-
callbacks.audio.f0_up_key = callbacks_kwargs.get("f0_up_key", 0)
|
| 972 |
-
callbacks.audio.index_rate = callbacks_kwargs.get("index_rate", 0.75)
|
| 973 |
-
callbacks.audio.protect = callbacks_kwargs.get("protect", 0.5)
|
| 974 |
-
callbacks.audio.rms_mix_rate = callbacks_kwargs.get("rms_mix_rate", 1)
|
| 975 |
-
|
| 976 |
-
callbacks.audio.f0_autotune = callbacks_kwargs.get("f0_autotune", False)
|
| 977 |
-
callbacks.audio.f0_autotune_strength = callbacks_kwargs.get("f0_autotune_strength", 1.0)
|
| 978 |
-
callbacks.audio.proposal_pitch = callbacks_kwargs.get("proposal_pitch", False)
|
| 979 |
-
callbacks.audio.proposal_pitch_threshold = callbacks_kwargs.get("proposal_pitch_threshold", 155.0)
|
| 980 |
-
|
| 981 |
-
callbacks.audio.input_audio_gain = callbacks_kwargs.get("input_audio_gain", 1.0)
|
| 982 |
-
callbacks.audio.output_audio_gain = callbacks_kwargs.get("output_audio_gain", 1.0)
|
| 983 |
-
callbacks.audio.monitor_audio_gain = callbacks_kwargs.get("monitor_audio_gain", 1.0)
|
| 984 |
-
|
| 985 |
-
callbacks.audio.embedders_mix = callbacks_kwargs.get("embedders_mix", False)
|
| 986 |
-
callbacks.audio.embedders_mix_layers = callbacks_kwargs.get("embedders_mix_layers", 9)
|
| 987 |
-
callbacks.audio.embedders_mix_ratio = callbacks_kwargs.get("embedders_mix_ratio", 0.5)
|
| 988 |
-
|
| 989 |
-
noise_scale = callbacks_kwargs.get("noise_scale", 0.35)
|
| 990 |
-
model_pth = callbacks_kwargs.get("model_path", callbacks.vc.vc_model.model_path)
|
| 991 |
-
model_pth = os.path.join(configs["weights_path"], model_pth) if not os.path.exists(model_pth) else model_pth
|
| 992 |
-
|
| 993 |
-
if model_pth and callbacks.vc.vc_model.model_path != model_pth:
|
| 994 |
-
callbacks.vc.vc_model.model_path = model_pth
|
| 995 |
-
callbacks.vc.vc_model.pipeline.vc.setup(model_pth, noise_scale)
|
| 996 |
-
callbacks.vc.vc_model.pipeline.version = callbacks.vc.vc_model.pipeline.vc.version
|
| 997 |
-
callbacks.vc.vc_model.pipeline.energy = callbacks.vc.vc_model.pipeline.vc.energy
|
| 998 |
-
callbacks.vc.vc_model.pipeline.rms = callbacks.vc.vc_model.pipeline.setup_rms() if callbacks.vc.vc_model.pipeline.vc.energy else None
|
| 999 |
-
|
| 1000 |
-
sid = callbacks_kwargs.get("sid", callbacks.vc.vc_model.pipeline.sid)
|
| 1001 |
-
if callbacks.vc.vc_model.pipeline.sid != sid:
|
| 1002 |
-
import torch
|
| 1003 |
-
callbacks.vc.vc_model.pipeline.torch_sid = torch.tensor(
|
| 1004 |
-
[sid], device=callbacks.vc.vc_model.pipeline.device, dtype=torch.int64
|
| 1005 |
-
)
|
| 1006 |
-
|
| 1007 |
-
index_path = callbacks_kwargs.get("index_path", None)
|
| 1008 |
-
if index_path:
|
| 1009 |
-
if callbacks.vc.vc_model.index_path != index_path:
|
| 1010 |
-
from main.library.utils import load_faiss_index
|
| 1011 |
-
|
| 1012 |
-
nprobe = callbacks_kwargs.get("nprobe", 1)
|
| 1013 |
-
index, index_reconstruct = load_faiss_index(
|
| 1014 |
-
index_path.strip().strip('"').strip("\n").strip('"').strip().replace("trained", "added"),
|
| 1015 |
-
nprobe=nprobe
|
| 1016 |
-
)
|
| 1017 |
-
|
| 1018 |
-
callbacks.vc.vc_model.pipeline.index = index
|
| 1019 |
-
if callbacks.vc.vc_model.pipeline.index.index is not None: callbacks.vc.vc_model.pipeline.index.index.nprobe = nprobe
|
| 1020 |
-
callbacks.vc.vc_model.pipeline.big_tsr = index_reconstruct
|
| 1021 |
-
callbacks.vc.vc_model.index_path = index_path
|
| 1022 |
-
else:
|
| 1023 |
-
callbacks.vc.vc_model.pipeline.index = None
|
| 1024 |
-
callbacks.vc.vc_model.pipeline.big_tsr = None
|
| 1025 |
-
callbacks.vc.vc_model.index_path = None
|
| 1026 |
-
|
| 1027 |
-
f0_method = callbacks_kwargs.get("f0_method", callbacks.vc.vc_model.pipeline.f0_method)
|
| 1028 |
-
predictor_onnx = callbacks_kwargs.get("predictor_onnx", callbacks.vc.vc_model.pipeline.predictor.predictor_onnx)
|
| 1029 |
-
embedders = callbacks_kwargs.get("embedder_model", callbacks.vc.vc_model.embedder_model)
|
| 1030 |
-
embedders_mode = callbacks_kwargs.get("embedders_mode", callbacks.vc.vc_model.embedders_mode)
|
| 1031 |
-
custom_embedders = callbacks_kwargs.get("embedder_model_custom", None)
|
| 1032 |
-
embedder_model = (embedders if embedders != "custom" else custom_embedders)
|
| 1033 |
-
|
| 1034 |
-
from main.library.utils import check_assets
|
| 1035 |
-
check_assets(f0_method, embedders, predictor_onnx, embedders_mode)
|
| 1036 |
-
|
| 1037 |
-
if (
|
| 1038 |
-
callbacks.vc.vc_model.pipeline.f0_method != f0_method or
|
| 1039 |
-
callbacks.vc.vc_model.pipeline.predictor.predictor_onnx != predictor_onnx
|
| 1040 |
-
):
|
| 1041 |
-
old_predictor = callbacks.vc.vc_model.pipeline.predictor
|
| 1042 |
-
del old_predictor
|
| 1043 |
-
|
| 1044 |
-
callbacks.vc.vc_model.pipeline.predictor = callbacks.vc.vc_model.pipeline.setup_predictor(PIPELINE_SAMPLE_RATE, callbacks_kwargs.get("hop_length", callbacks.vc.vc_model.pipeline.predictor.hop_length), predictor_onnx)
|
| 1045 |
-
callbacks.vc.vc_model.pipeline.f0_method = f0_method
|
| 1046 |
-
callbacks.vc.vc_model.pipeline.predictor.predictor_onnx = predictor_onnx
|
| 1047 |
-
|
| 1048 |
-
if embedder_model:
|
| 1049 |
-
if (
|
| 1050 |
-
callbacks.vc.vc_model.embedder_model != embedder_model or
|
| 1051 |
-
callbacks.vc.vc_model.embedders_mode != embedders_mode
|
| 1052 |
-
):
|
| 1053 |
-
old_embedder = callbacks.vc.vc_model.pipeline.embedder
|
| 1054 |
-
del old_embedder
|
| 1055 |
-
|
| 1056 |
-
callbacks.vc.vc_model.pipeline.embedder = callbacks.vc.vc_model.pipeline.setup_embedder(embedder_model, embedders_mode)
|
| 1057 |
-
callbacks.vc.vc_model.embedder_model = embedder_model
|
| 1058 |
-
callbacks.vc.vc_model.embedders_mode = embedders_mode
|
| 1059 |
-
|
| 1060 |
-
if (
|
| 1061 |
-
callbacks.vc.vc_model.pipeline.vc.architecture == "SVC" and
|
| 1062 |
-
callbacks.vc.vc_model.pipeline.vc.net_g.noise_scale != noise_scale
|
| 1063 |
-
):
|
| 1064 |
-
callbacks.vc.vc_model.pipeline.vc.net_g.noise_scale = noise_scale
|
| 1065 |
-
|
| 1066 |
-
def change_config(value, key, if_kwargs=False):
|
| 1067 |
-
global callbacks_kwargs
|
| 1068 |
-
|
| 1069 |
-
if running and audio_manager is not None and callbacks is not None:
|
| 1070 |
-
if if_kwargs:
|
| 1071 |
-
callbacks_kwargs["kwargs"][key] = value
|
| 1072 |
-
else:
|
| 1073 |
-
callbacks_kwargs[key] = value
|
| 1074 |
-
|
| 1075 |
-
change_callbacks_config()
|
| 1076 |
-
|
| 1077 |
-
def realtime_stop():
|
| 1078 |
-
global running, callbacks, audio_manager
|
| 1079 |
-
|
| 1080 |
-
if running and audio_manager is not None and callbacks is not None:
|
| 1081 |
-
gr_info(translations["stop_realtime"])
|
| 1082 |
-
|
| 1083 |
-
audio_manager.stop()
|
| 1084 |
-
running = False
|
| 1085 |
-
|
| 1086 |
-
if hasattr(callbacks.audio, "performance"): del callbacks.audio.performance
|
| 1087 |
-
if hasattr(callbacks.audio, "volume"): del callbacks.audio.volume
|
| 1088 |
-
|
| 1089 |
-
del callbacks.vc.vc_model.pipeline, callbacks.vc.vc_model
|
| 1090 |
-
del audio_manager, callbacks
|
| 1091 |
-
|
| 1092 |
-
audio_manager = callbacks = None
|
| 1093 |
-
gr_info(translations["realtime_has_stop"])
|
| 1094 |
-
|
| 1095 |
-
from main.library.utils import clear_gpu_cache
|
| 1096 |
-
clear_gpu_cache()
|
| 1097 |
-
|
| 1098 |
-
return (
|
| 1099 |
-
translations["realtime_has_stop"],
|
| 1100 |
-
interactive_true,
|
| 1101 |
-
interactive_false
|
| 1102 |
-
)
|
| 1103 |
-
else:
|
| 1104 |
-
gr_warning(translations["realtime_not_found"])
|
| 1105 |
-
|
| 1106 |
-
return (
|
| 1107 |
-
translations["realtime_not_found"],
|
| 1108 |
-
interactive_true,
|
| 1109 |
-
interactive_false
|
| 1110 |
-
)
|
| 1111 |
-
|
| 1112 |
-
def soundfile_record_audio(
|
| 1113 |
-
record_button,
|
| 1114 |
-
record_audio_path = None,
|
| 1115 |
-
export_format = "wav"
|
| 1116 |
-
):
|
| 1117 |
-
global callbacks
|
| 1118 |
-
|
| 1119 |
-
if running and audio_manager is not None and callbacks is not None:
|
| 1120 |
-
if record_button == translations["start_record"]:
|
| 1121 |
-
gr_info(translations["starting_record"])
|
| 1122 |
-
|
| 1123 |
-
if not record_audio_path:
|
| 1124 |
-
record_audio_path = os.path.join(configs["audios_path"], "record_audio.wav")
|
| 1125 |
-
|
| 1126 |
-
callbacks.vc.record_audio = True
|
| 1127 |
-
callbacks.vc.record_audio_path = record_audio_path
|
| 1128 |
-
callbacks.vc.export_format = export_format
|
| 1129 |
-
callbacks.vc.setup_soundfile_record()
|
| 1130 |
-
|
| 1131 |
-
return translations["stop_record"], None
|
| 1132 |
-
else:
|
| 1133 |
-
gr_info(translations["stopping_record"])
|
| 1134 |
-
|
| 1135 |
-
callbacks.vc.record_audio = False
|
| 1136 |
-
callbacks.vc.record_audio_path = None
|
| 1137 |
-
callbacks.vc.soundfile = None
|
| 1138 |
-
|
| 1139 |
-
return translations["start_record"], record_audio_path
|
| 1140 |
-
|
| 1141 |
-
gr_warning(translations["realtime_not_found"])
|
| 1142 |
-
return translations["start_record"], None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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gr_info
|
| 10 |
-
from main.app.variables import python, translations, configs_json
|
| 11 |
-
|
| 12 |
-
def restart_app(app):
|
| 13 |
-
gr_info(translations["restart"])
|
| 14 |
-
os.system("cls" if platform.system() == "Windows" else "clear")
|
| 15 |
-
|
| 16 |
-
app.close()
|
| 17 |
-
subprocess.run([
|
| 18 |
-
python,
|
| 19 |
-
os.path.join("main", "app", "app.py")
|
| 20 |
-
] + [arg for arg in sys.argv[1:] if arg != "--open"])
|
| 21 |
-
|
| 22 |
-
def restart(lang, theme, font, app):
|
| 23 |
-
configs = json.load(open(configs_json, "r"))
|
| 24 |
-
|
| 25 |
-
if lang != configs["language"]:
|
| 26 |
-
configs["language"] = lang
|
| 27 |
-
|
| 28 |
-
with open(configs_json, "w") as f:
|
| 29 |
-
json.dump(configs, f, indent=4)
|
| 30 |
-
|
| 31 |
-
if theme != configs["theme"]:
|
| 32 |
-
configs["theme"] = theme
|
| 33 |
-
|
| 34 |
-
with open(configs_json, "w") as f:
|
| 35 |
-
json.dump(configs, f, indent=4)
|
| 36 |
-
|
| 37 |
-
if font != configs["font"]:
|
| 38 |
-
configs["font"] = font
|
| 39 |
-
|
| 40 |
-
with open(configs_json, "w") as f:
|
| 41 |
-
json.dump(configs, f, indent=4)
|
| 42 |
-
|
| 43 |
-
restart_app(app)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/separate.py
DELETED
|
@@ -1,96 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import subprocess
|
| 4 |
-
|
| 5 |
-
sys.path.append(os.getcwd())
|
| 6 |
-
|
| 7 |
-
from main.app.core.ui import gr_info, gr_warning
|
| 8 |
-
from main.app.variables import python, translations, configs
|
| 9 |
-
|
| 10 |
-
def separate_music(
|
| 11 |
-
input_path,
|
| 12 |
-
output_dirs,
|
| 13 |
-
export_format,
|
| 14 |
-
model_name,
|
| 15 |
-
karaoke_model,
|
| 16 |
-
reverb_model,
|
| 17 |
-
denoise_model,
|
| 18 |
-
sample_rate,
|
| 19 |
-
shifts,
|
| 20 |
-
batch_size,
|
| 21 |
-
overlap,
|
| 22 |
-
aggression,
|
| 23 |
-
hop_length,
|
| 24 |
-
window_size,
|
| 25 |
-
segments_size,
|
| 26 |
-
post_process_threshold,
|
| 27 |
-
enable_tta,
|
| 28 |
-
enable_denoise,
|
| 29 |
-
high_end_process,
|
| 30 |
-
enable_post_process,
|
| 31 |
-
separate_backing,
|
| 32 |
-
separate_reverb
|
| 33 |
-
):
|
| 34 |
-
output_dirs = os.path.dirname(output_dirs) or output_dirs
|
| 35 |
-
|
| 36 |
-
if not input_path or not os.path.exists(input_path) or os.path.isdir(input_path):
|
| 37 |
-
gr_warning(translations["input_not_valid"])
|
| 38 |
-
return [None]*4
|
| 39 |
-
|
| 40 |
-
if not os.path.exists(output_dirs):
|
| 41 |
-
gr_warning(translations["output_not_valid"])
|
| 42 |
-
return [None]*4
|
| 43 |
-
|
| 44 |
-
if not os.path.exists(output_dirs): os.makedirs(output_dirs)
|
| 45 |
-
gr_info(translations["start"].format(start=translations["separator_music"]))
|
| 46 |
-
|
| 47 |
-
subprocess.run([
|
| 48 |
-
python,
|
| 49 |
-
configs["separate_path"],
|
| 50 |
-
"--input_path", input_path,
|
| 51 |
-
"--output_dirs", output_dirs,
|
| 52 |
-
"--export_format", export_format,
|
| 53 |
-
"--model_name", model_name,
|
| 54 |
-
"--karaoke_model", karaoke_model,
|
| 55 |
-
"--reverb_model", reverb_model,
|
| 56 |
-
"--denoise_model", denoise_model,
|
| 57 |
-
"--sample_rate", str(sample_rate),
|
| 58 |
-
"--shifts", str(shifts),
|
| 59 |
-
"--batch_size", str(batch_size),
|
| 60 |
-
"--overlap", str(overlap),
|
| 61 |
-
"--aggression", str(aggression),
|
| 62 |
-
"--hop_length", str(hop_length),
|
| 63 |
-
"--window_size", str(window_size),
|
| 64 |
-
"--segments_size", str(segments_size),
|
| 65 |
-
"--post_process_threshold", str(post_process_threshold),
|
| 66 |
-
"--enable_tta", str(enable_tta),
|
| 67 |
-
"--enable_denoise", str(enable_denoise),
|
| 68 |
-
"--high_end_process", str(high_end_process),
|
| 69 |
-
"--enable_post_process", str(enable_post_process),
|
| 70 |
-
"--separate_backing", str(separate_backing),
|
| 71 |
-
"--separate_reverb", str(separate_reverb),
|
| 72 |
-
])
|
| 73 |
-
|
| 74 |
-
gr_info(translations["success"])
|
| 75 |
-
|
| 76 |
-
filename, _ = os.path.splitext(os.path.basename(input_path))
|
| 77 |
-
output_dirs = os.path.join(output_dirs, filename)
|
| 78 |
-
|
| 79 |
-
return [
|
| 80 |
-
os.path.join(
|
| 81 |
-
output_dirs,
|
| 82 |
-
f"Original_Vocals_No_Reverb.{export_format}" if separate_reverb else f"Original_Vocals.{export_format}"
|
| 83 |
-
),
|
| 84 |
-
os.path.join(
|
| 85 |
-
output_dirs,
|
| 86 |
-
f"Instruments.{export_format}"
|
| 87 |
-
),
|
| 88 |
-
os.path.join(
|
| 89 |
-
output_dirs,
|
| 90 |
-
f"Main_Vocals_No_Reverb.{export_format}" if separate_reverb else f"Main_Vocals.{export_format}"
|
| 91 |
-
) if separate_backing else None,
|
| 92 |
-
os.path.join(
|
| 93 |
-
output_dirs,
|
| 94 |
-
f"Backing_Vocals.{export_format}"
|
| 95 |
-
) if separate_backing else None
|
| 96 |
-
] if os.path.isfile(input_path) else [None]*4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/training.py
DELETED
|
@@ -1,590 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import time
|
| 4 |
-
import shutil
|
| 5 |
-
import codecs
|
| 6 |
-
import datetime
|
| 7 |
-
import threading
|
| 8 |
-
import subprocess
|
| 9 |
-
|
| 10 |
-
sys.path.append(os.getcwd())
|
| 11 |
-
|
| 12 |
-
from main.tools import huggingface
|
| 13 |
-
from main.app.core.ui import gr_info, gr_warning
|
| 14 |
-
from main.app.variables import python, translations, configs, file_types, logger
|
| 15 |
-
|
| 16 |
-
def getname(path):
|
| 17 |
-
return os.path.basename(path).replace(".py", "")
|
| 18 |
-
|
| 19 |
-
def if_done(done, p):
|
| 20 |
-
while 1:
|
| 21 |
-
if p.poll() is None: time.sleep(0.5)
|
| 22 |
-
else: break
|
| 23 |
-
|
| 24 |
-
done[0] = True
|
| 25 |
-
|
| 26 |
-
def log_read(done, name, start_time):
|
| 27 |
-
log_file = os.path.join(configs["logs_path"], "app.log")
|
| 28 |
-
|
| 29 |
-
def read_logs():
|
| 30 |
-
logs = []
|
| 31 |
-
|
| 32 |
-
with open(log_file, "r", encoding="utf-8") as f:
|
| 33 |
-
for line in f:
|
| 34 |
-
try:
|
| 35 |
-
if ("DEBUG" in line or name not in line or line.strip() == ""): continue
|
| 36 |
-
timestamp = datetime.datetime.strptime(line.split("|")[0].strip(), "%Y-%m-%d %H:%M:%S.%f")
|
| 37 |
-
if timestamp >= start_time: logs.append(line)
|
| 38 |
-
except ValueError:
|
| 39 |
-
continue
|
| 40 |
-
return "".join(logs)
|
| 41 |
-
|
| 42 |
-
while 1:
|
| 43 |
-
yield read_logs()
|
| 44 |
-
|
| 45 |
-
time.sleep(1)
|
| 46 |
-
|
| 47 |
-
if done[0]:
|
| 48 |
-
break
|
| 49 |
-
|
| 50 |
-
yield read_logs()
|
| 51 |
-
|
| 52 |
-
def create_dataset(
|
| 53 |
-
input_data,
|
| 54 |
-
output_dirs,
|
| 55 |
-
skip_seconds,
|
| 56 |
-
skip_start_audios,
|
| 57 |
-
skip_end_audios,
|
| 58 |
-
separate,
|
| 59 |
-
model_name,
|
| 60 |
-
reverb_model,
|
| 61 |
-
denoise_model,
|
| 62 |
-
sample_rate,
|
| 63 |
-
shifts,
|
| 64 |
-
batch_size,
|
| 65 |
-
overlap,
|
| 66 |
-
aggression,
|
| 67 |
-
hop_length,
|
| 68 |
-
window_size,
|
| 69 |
-
segments_size,
|
| 70 |
-
post_process_threshold,
|
| 71 |
-
enable_tta,
|
| 72 |
-
enable_denoise,
|
| 73 |
-
high_end_process,
|
| 74 |
-
enable_post_process,
|
| 75 |
-
separate_reverb,
|
| 76 |
-
clean_dataset,
|
| 77 |
-
clean_strength
|
| 78 |
-
):
|
| 79 |
-
gr_info(translations["start"].format(start=translations["create"]))
|
| 80 |
-
start_time = datetime.datetime.now()
|
| 81 |
-
|
| 82 |
-
p = subprocess.Popen([
|
| 83 |
-
python,
|
| 84 |
-
configs["create_dataset_path"],
|
| 85 |
-
"--input_data", input_data,
|
| 86 |
-
"--output_dirs", output_dirs,
|
| 87 |
-
"--skip_seconds", str(skip_seconds),
|
| 88 |
-
"--skip_start_audios", str(skip_start_audios),
|
| 89 |
-
"--skip_end_audios", str(skip_end_audios),
|
| 90 |
-
"--separate", str(separate),
|
| 91 |
-
"--model_name", model_name,
|
| 92 |
-
"--reverb_model", reverb_model,
|
| 93 |
-
"--denoise_model", denoise_model,
|
| 94 |
-
"--sample_rate", str(sample_rate),
|
| 95 |
-
"--shifts", str(shifts),
|
| 96 |
-
"--batch_size", str(batch_size),
|
| 97 |
-
"--overlap", str(overlap),
|
| 98 |
-
"--aggression", str(aggression),
|
| 99 |
-
"--hop_length", str(hop_length),
|
| 100 |
-
"--window_size", str(window_size),
|
| 101 |
-
"--segments_size", str(segments_size),
|
| 102 |
-
"--post_process_threshold", str(post_process_threshold),
|
| 103 |
-
"--enable_tta", str(enable_tta),
|
| 104 |
-
"--enable_denoise", str(enable_denoise),
|
| 105 |
-
"--high_end_process", str(high_end_process),
|
| 106 |
-
"--enable_post_process", str(enable_post_process),
|
| 107 |
-
"--separate_reverb", str(separate_reverb),
|
| 108 |
-
"--clean_dataset", str(clean_dataset),
|
| 109 |
-
"--clean_strength", str(clean_strength),
|
| 110 |
-
])
|
| 111 |
-
|
| 112 |
-
done = [False]
|
| 113 |
-
|
| 114 |
-
threading.Thread(target=if_done, args=(done, p)).start()
|
| 115 |
-
|
| 116 |
-
for log in log_read(done, getname(configs["create_dataset_path"]), start_time):
|
| 117 |
-
yield log
|
| 118 |
-
|
| 119 |
-
def create_reference(
|
| 120 |
-
audio_path,
|
| 121 |
-
reference_name,
|
| 122 |
-
pitch_guidance,
|
| 123 |
-
use_energy,
|
| 124 |
-
version,
|
| 125 |
-
embedder_model,
|
| 126 |
-
embedders_mode,
|
| 127 |
-
f0_method,
|
| 128 |
-
predictor_onnx,
|
| 129 |
-
f0_up_key,
|
| 130 |
-
filter_radius,
|
| 131 |
-
f0_autotune,
|
| 132 |
-
f0_autotune_strength,
|
| 133 |
-
proposal_pitch,
|
| 134 |
-
proposal_pitch_threshold,
|
| 135 |
-
alpha=0.5,
|
| 136 |
-
embedders_mix = False,
|
| 137 |
-
embedders_mix_layers = 9,
|
| 138 |
-
embedders_mix_ratio = 0.5
|
| 139 |
-
):
|
| 140 |
-
gr_info(translations["start"].format(start=translations["create_reference"]))
|
| 141 |
-
start_time = datetime.datetime.now()
|
| 142 |
-
|
| 143 |
-
p = subprocess.Popen([
|
| 144 |
-
python,
|
| 145 |
-
configs["create_reference_path"],
|
| 146 |
-
"--audio_path", audio_path,
|
| 147 |
-
"--reference_name", reference_name,
|
| 148 |
-
"--pitch_guidance", str(pitch_guidance),
|
| 149 |
-
"--use_energy", str(use_energy),
|
| 150 |
-
"--version", version,
|
| 151 |
-
"--embedder_model", embedder_model,
|
| 152 |
-
"--embedders_mode", embedders_mode,
|
| 153 |
-
"--f0_method", f0_method,
|
| 154 |
-
"--predictor_onnx", str(predictor_onnx),
|
| 155 |
-
"--f0_up_key", str(f0_up_key),
|
| 156 |
-
"--filter_radius", str(filter_radius),
|
| 157 |
-
"--f0_autotune", str(f0_autotune),
|
| 158 |
-
"--f0_autotune_strength", str(f0_autotune_strength),
|
| 159 |
-
"--proposal_pitch", str(proposal_pitch),
|
| 160 |
-
"--proposal_pitch_threshold", str(proposal_pitch_threshold),
|
| 161 |
-
"--alpha", str(alpha),
|
| 162 |
-
"--embedders_mix", str(embedders_mix),
|
| 163 |
-
"--embedders_mix_layers", str(embedders_mix_layers),
|
| 164 |
-
"--embedders_mix_ratio", str(embedders_mix_ratio)
|
| 165 |
-
])
|
| 166 |
-
|
| 167 |
-
done = [False]
|
| 168 |
-
|
| 169 |
-
threading.Thread(target=if_done, args=(done, p)).start()
|
| 170 |
-
|
| 171 |
-
for log in log_read(done, getname(configs["create_reference_path"]), start_time):
|
| 172 |
-
yield log
|
| 173 |
-
|
| 174 |
-
def preprocess(
|
| 175 |
-
model_name,
|
| 176 |
-
sample_rate,
|
| 177 |
-
cpu_core,
|
| 178 |
-
cut_preprocess,
|
| 179 |
-
process_effects,
|
| 180 |
-
dataset,
|
| 181 |
-
clean_dataset,
|
| 182 |
-
clean_strength,
|
| 183 |
-
chunk_len=3.0,
|
| 184 |
-
overlap_len=0.3,
|
| 185 |
-
normalization_mode="none",
|
| 186 |
-
architecture="RVC"
|
| 187 |
-
):
|
| 188 |
-
sr = int(float(sample_rate.rstrip("k")) * 1000)
|
| 189 |
-
|
| 190 |
-
if not model_name: return gr_warning(translations["provide_name"])
|
| 191 |
-
|
| 192 |
-
if configs.get("check_data", False):
|
| 193 |
-
try:
|
| 194 |
-
found = False
|
| 195 |
-
if os.path.exists(dataset):
|
| 196 |
-
for root, _, files in os.walk(dataset):
|
| 197 |
-
for f in files:
|
| 198 |
-
if f.lower().endswith(tuple(file_types)) and os.path.getsize(os.path.join(root, f)) > 0:
|
| 199 |
-
found = True
|
| 200 |
-
break
|
| 201 |
-
|
| 202 |
-
if found: break
|
| 203 |
-
if not found: return gr_warning(translations["not_found_data"])
|
| 204 |
-
except Exception:
|
| 205 |
-
return gr_warning(translations["not_found_data"])
|
| 206 |
-
|
| 207 |
-
start_time = datetime.datetime.now()
|
| 208 |
-
model_dir = os.path.join(configs["logs_path"], model_name)
|
| 209 |
-
if os.path.exists(model_dir): shutil.rmtree(model_dir, ignore_errors=True)
|
| 210 |
-
|
| 211 |
-
p = subprocess.Popen([
|
| 212 |
-
python,
|
| 213 |
-
configs["preprocess_path"],
|
| 214 |
-
"--model_name", model_name,
|
| 215 |
-
"--dataset_path", dataset,
|
| 216 |
-
"--sample_rate", str(sr),
|
| 217 |
-
"--cpu_cores", str(cpu_core),
|
| 218 |
-
"--cut_preprocess", cut_preprocess,
|
| 219 |
-
"--process_effects", str(process_effects),
|
| 220 |
-
"--clean_dataset", str(clean_dataset),
|
| 221 |
-
"--clean_strength", str(clean_strength),
|
| 222 |
-
"--chunk_len", str(chunk_len),
|
| 223 |
-
"--overlap_len", str(overlap_len),
|
| 224 |
-
"--normalization_mode", normalization_mode,
|
| 225 |
-
"--architecture", architecture
|
| 226 |
-
])
|
| 227 |
-
|
| 228 |
-
done = [False]
|
| 229 |
-
|
| 230 |
-
threading.Thread(target=if_done, args=(done, p)).start()
|
| 231 |
-
os.makedirs(model_dir, exist_ok=True)
|
| 232 |
-
|
| 233 |
-
for log in log_read(done, getname(configs["preprocess_path"]), start_time):
|
| 234 |
-
yield log
|
| 235 |
-
|
| 236 |
-
def extract(
|
| 237 |
-
model_name,
|
| 238 |
-
version,
|
| 239 |
-
method,
|
| 240 |
-
pitch_guidance,
|
| 241 |
-
hop_length,
|
| 242 |
-
cpu_cores,
|
| 243 |
-
gpu,
|
| 244 |
-
sample_rate,
|
| 245 |
-
embedders,
|
| 246 |
-
custom_embedders,
|
| 247 |
-
predictor_onnx,
|
| 248 |
-
embedders_mode,
|
| 249 |
-
f0_autotune,
|
| 250 |
-
f0_autotune_strength,
|
| 251 |
-
hybrid_method,
|
| 252 |
-
rms_extract,
|
| 253 |
-
alpha=0.5,
|
| 254 |
-
include_mutes=2,
|
| 255 |
-
embedders_mix = False,
|
| 256 |
-
embedders_mix_layers = 9,
|
| 257 |
-
embedders_mix_ratio = 0.5,
|
| 258 |
-
architecture = "RVC"
|
| 259 |
-
):
|
| 260 |
-
f0_method, embedder_model = (
|
| 261 |
-
method if method != "hybrid" else hybrid_method,
|
| 262 |
-
embedders if embedders != "custom" else custom_embedders
|
| 263 |
-
)
|
| 264 |
-
|
| 265 |
-
sr = int(float(sample_rate.rstrip("k")) * 1000)
|
| 266 |
-
|
| 267 |
-
if not model_name: return gr_warning(translations["provide_name"])
|
| 268 |
-
model_dir = os.path.join(configs["logs_path"], model_name)
|
| 269 |
-
|
| 270 |
-
if configs.get("check_data", False):
|
| 271 |
-
try:
|
| 272 |
-
if not any(
|
| 273 |
-
os.path.isfile(os.path.join(model_dir, "sliced_audios", f))
|
| 274 |
-
for f in os.listdir(os.path.join(model_dir, "sliced_audios"))
|
| 275 |
-
) or not any(
|
| 276 |
-
os.path.isfile(os.path.join(model_dir, "sliced_audios_16k", f))
|
| 277 |
-
for f in os.listdir(os.path.join(model_dir, "sliced_audios_16k"))
|
| 278 |
-
):
|
| 279 |
-
return gr_warning(translations["not_found_data_preprocess"])
|
| 280 |
-
except:
|
| 281 |
-
return gr_warning(translations["not_found_data_preprocess"])
|
| 282 |
-
|
| 283 |
-
start_time = datetime.datetime.now()
|
| 284 |
-
|
| 285 |
-
p = subprocess.Popen([
|
| 286 |
-
python,
|
| 287 |
-
configs["extract_path"],
|
| 288 |
-
"--model_name", model_name,
|
| 289 |
-
"--rvc_version", version,
|
| 290 |
-
"--f0_method", f0_method,
|
| 291 |
-
"--pitch_guidance", str(pitch_guidance),
|
| 292 |
-
"--hop_length", str(hop_length),
|
| 293 |
-
"--cpu_cores", str(cpu_cores),
|
| 294 |
-
"--gpu", str(gpu),
|
| 295 |
-
"--sample_rate", str(sr),
|
| 296 |
-
"--embedder_model", embedder_model,
|
| 297 |
-
"--predictor_onnx", str(predictor_onnx),
|
| 298 |
-
"--embedders_mode", embedders_mode,
|
| 299 |
-
"--f0_autotune", str(f0_autotune),
|
| 300 |
-
"--f0_autotune_strength", str(f0_autotune_strength),
|
| 301 |
-
"--rms_extract", str(rms_extract),
|
| 302 |
-
"--alpha", str(alpha),
|
| 303 |
-
"--include_mutes", str(include_mutes),
|
| 304 |
-
"--embedders_mix", str(embedders_mix),
|
| 305 |
-
"--embedders_mix_layers", str(embedders_mix_layers),
|
| 306 |
-
"--embedders_mix_ratio", str(embedders_mix_ratio),
|
| 307 |
-
"--architecture", architecture
|
| 308 |
-
])
|
| 309 |
-
|
| 310 |
-
done = [False]
|
| 311 |
-
|
| 312 |
-
threading.Thread(target=if_done, args=(done, p)).start()
|
| 313 |
-
os.makedirs(model_dir, exist_ok=True)
|
| 314 |
-
|
| 315 |
-
for log in log_read(done, getname(configs["extract_path"]), start_time):
|
| 316 |
-
yield log
|
| 317 |
-
|
| 318 |
-
def create_index(
|
| 319 |
-
model_name,
|
| 320 |
-
rvc_version,
|
| 321 |
-
index_algorithm,
|
| 322 |
-
nprobe=1
|
| 323 |
-
):
|
| 324 |
-
if not model_name: return gr_warning(translations["provide_name"])
|
| 325 |
-
model_dir = os.path.join(configs["logs_path"], model_name)
|
| 326 |
-
|
| 327 |
-
if configs.get("check_data", False):
|
| 328 |
-
try:
|
| 329 |
-
if not any(
|
| 330 |
-
os.path.isfile(os.path.join(model_dir, f"{rvc_version}_extracted", f))
|
| 331 |
-
for f in os.listdir(os.path.join(model_dir, f"{rvc_version}_extracted"))
|
| 332 |
-
):
|
| 333 |
-
return gr_warning(translations["not_found_data_extract"])
|
| 334 |
-
except:
|
| 335 |
-
return gr_warning(translations["not_found_data_extract"])
|
| 336 |
-
|
| 337 |
-
start_time = datetime.datetime.now()
|
| 338 |
-
|
| 339 |
-
p = subprocess.Popen([
|
| 340 |
-
python,
|
| 341 |
-
configs["create_index_path"],
|
| 342 |
-
"--model_name", model_name,
|
| 343 |
-
"--rvc_version", rvc_version,
|
| 344 |
-
"--index_algorithm", index_algorithm,
|
| 345 |
-
"--nprobe", str(nprobe)
|
| 346 |
-
])
|
| 347 |
-
|
| 348 |
-
done = [False]
|
| 349 |
-
|
| 350 |
-
threading.Thread(target=if_done, args=(done, p)).start()
|
| 351 |
-
os.makedirs(model_dir, exist_ok=True)
|
| 352 |
-
|
| 353 |
-
for log in log_read(done, getname(configs["create_index_path"]), start_time):
|
| 354 |
-
yield log
|
| 355 |
-
|
| 356 |
-
def training(
|
| 357 |
-
model_name,
|
| 358 |
-
rvc_version,
|
| 359 |
-
save_every_epoch,
|
| 360 |
-
save_only_latest,
|
| 361 |
-
save_every_weights,
|
| 362 |
-
total_epoch,
|
| 363 |
-
sample_rate,
|
| 364 |
-
batch_size,
|
| 365 |
-
gpu,
|
| 366 |
-
pitch_guidance,
|
| 367 |
-
not_pretrain,
|
| 368 |
-
custom_pretrained,
|
| 369 |
-
pretrain_g,
|
| 370 |
-
pretrain_d,
|
| 371 |
-
detector,
|
| 372 |
-
threshold,
|
| 373 |
-
clean_up,
|
| 374 |
-
cache,
|
| 375 |
-
model_author,
|
| 376 |
-
vocoder,
|
| 377 |
-
checkpointing,
|
| 378 |
-
deterministic,
|
| 379 |
-
benchmark,
|
| 380 |
-
optimizer,
|
| 381 |
-
energy_use,
|
| 382 |
-
custom_reference=False,
|
| 383 |
-
reference_name="",
|
| 384 |
-
multiscale_mel_loss=False,
|
| 385 |
-
embedders="hubert_base",
|
| 386 |
-
custom_embedders=None,
|
| 387 |
-
cosine_annealing_lr=False,
|
| 388 |
-
architecture="RVC"
|
| 389 |
-
):
|
| 390 |
-
if architecture == "SVC":
|
| 391 |
-
pitch_guidance = True
|
| 392 |
-
energy_use = False
|
| 393 |
-
|
| 394 |
-
sr = int(float(sample_rate.rstrip("k")) * 1000)
|
| 395 |
-
if not model_name: return gr_warning(translations["provide_name"])
|
| 396 |
-
|
| 397 |
-
model_dir = os.path.join(configs["logs_path"], model_name)
|
| 398 |
-
if os.path.exists(os.path.join(model_dir, "train_pid.txt")):
|
| 399 |
-
os.remove(os.path.join(model_dir, "train_pid.txt"))
|
| 400 |
-
|
| 401 |
-
if configs.get("check_data", False):
|
| 402 |
-
try:
|
| 403 |
-
if not any(
|
| 404 |
-
os.path.isfile(os.path.join(model_dir, f"{rvc_version}_extracted", f))
|
| 405 |
-
for f in os.listdir(os.path.join(model_dir, f"{rvc_version}_extracted"))
|
| 406 |
-
):
|
| 407 |
-
return gr_warning(translations["not_found_data_extract"])
|
| 408 |
-
except:
|
| 409 |
-
return gr_warning(translations["not_found_data_extract"])
|
| 410 |
-
|
| 411 |
-
if not not_pretrain:
|
| 412 |
-
if not custom_pretrained:
|
| 413 |
-
pretrain_dir = (
|
| 414 |
-
configs["pretrained_v2_path"]
|
| 415 |
-
if rvc_version == 'v2' else
|
| 416 |
-
configs["pretrained_v1_path"]
|
| 417 |
-
)
|
| 418 |
-
|
| 419 |
-
download_version = codecs.decode(
|
| 420 |
-
f"uggcf://uhttvatsnpr.pb/NauC/Ivrganzrfr-EIP-Cebwrpg/erfbyir/znva/cergenvarq_",
|
| 421 |
-
"rot13"
|
| 422 |
-
) + f"{rvc_version}/"
|
| 423 |
-
|
| 424 |
-
pretrained_selector = {
|
| 425 |
-
True: {
|
| 426 |
-
24000: ("f0G24k.pth", "f0D24k.pth"),
|
| 427 |
-
32000: ("f0G32k.pth", "f0D32k.pth"),
|
| 428 |
-
40000: ("f0G40k.pth", "f0D40k.pth"),
|
| 429 |
-
44100: ("f0G44k.pth", "f0D44k.pth"),
|
| 430 |
-
48000: ("f0G48k.pth", "f0D48k.pth")
|
| 431 |
-
},
|
| 432 |
-
False: {
|
| 433 |
-
24000: ("G24k.pth", "D24k.pth"),
|
| 434 |
-
32000: ("G32k.pth", "D32k.pth"),
|
| 435 |
-
40000: ("G40k.pth", "D40k.pth"),
|
| 436 |
-
44100: ("G44k.pth", "D44k.pth"),
|
| 437 |
-
48000: ("G48k.pth", "D48k.pth")
|
| 438 |
-
}
|
| 439 |
-
}
|
| 440 |
-
|
| 441 |
-
pg2, pd2 = "", ""
|
| 442 |
-
pg, pd = pretrained_selector[pitch_guidance][sr]
|
| 443 |
-
|
| 444 |
-
if energy_use: pg2, pd2 = pg2 + "ENERGY_", pd2 + "ENERGY_"
|
| 445 |
-
if vocoder != 'Default': pg2, pd2 = pg2 + vocoder + "_", pd2 + vocoder + "_"
|
| 446 |
-
if embedders not in ["hubert_base", "contentvec_base"]: pg2, pd2 = pg2 + embedders + "_", pd2 + embedders + "_"
|
| 447 |
-
if architecture != "RVC": pg2, pd2 = architecture + "_" + pg2, architecture + "_" + pd2
|
| 448 |
-
|
| 449 |
-
pg2, pd2 = pg2 + pg, pd2 + pd
|
| 450 |
-
logger.debug("PG: " + pg2 + " PD: " + pd2)
|
| 451 |
-
|
| 452 |
-
pretrained_G, pretrained_D = (
|
| 453 |
-
os.path.join(
|
| 454 |
-
pretrain_dir,
|
| 455 |
-
pg2
|
| 456 |
-
),
|
| 457 |
-
os.path.join(
|
| 458 |
-
pretrain_dir,
|
| 459 |
-
pd2
|
| 460 |
-
)
|
| 461 |
-
)
|
| 462 |
-
|
| 463 |
-
try:
|
| 464 |
-
if not os.path.exists(pretrained_G):
|
| 465 |
-
gr_info(translations["download_pretrained"].format(dg="G", rvc_version=rvc_version))
|
| 466 |
-
huggingface.HF_download_file(
|
| 467 |
-
"".join(
|
| 468 |
-
[
|
| 469 |
-
download_version,
|
| 470 |
-
pg2
|
| 471 |
-
]
|
| 472 |
-
),
|
| 473 |
-
os.path.join(
|
| 474 |
-
pretrain_dir,
|
| 475 |
-
pg2
|
| 476 |
-
)
|
| 477 |
-
)
|
| 478 |
-
|
| 479 |
-
if not os.path.exists(pretrained_D):
|
| 480 |
-
gr_info(translations["download_pretrained"].format(dg="D", rvc_version=rvc_version))
|
| 481 |
-
huggingface.HF_download_file(
|
| 482 |
-
"".join(
|
| 483 |
-
[
|
| 484 |
-
download_version,
|
| 485 |
-
pd2
|
| 486 |
-
]
|
| 487 |
-
),
|
| 488 |
-
os.path.join(
|
| 489 |
-
pretrain_dir,
|
| 490 |
-
pd2
|
| 491 |
-
)
|
| 492 |
-
)
|
| 493 |
-
except:
|
| 494 |
-
gr_warning(translations["not_use_pretrain_error_download"])
|
| 495 |
-
pretrained_G = pretrained_D = None
|
| 496 |
-
else:
|
| 497 |
-
if not pretrain_g:
|
| 498 |
-
return gr_warning(translations["provide_pretrained"].format(dg="G"))
|
| 499 |
-
|
| 500 |
-
if not pretrain_d:
|
| 501 |
-
return gr_warning(translations["provide_pretrained"].format(dg="D"))
|
| 502 |
-
|
| 503 |
-
pg2, pd2 = pretrain_g, pretrain_d
|
| 504 |
-
pretrained_G, pretrained_D = (
|
| 505 |
-
os.path.join(configs["pretrained_custom_path"], pg2) if not os.path.exists(pg2) else pg2,
|
| 506 |
-
os.path.join(configs["pretrained_custom_path"], pd2) if not os.path.exists(pd2) else pd2
|
| 507 |
-
)
|
| 508 |
-
|
| 509 |
-
if not os.path.exists(pretrained_G):
|
| 510 |
-
return gr_warning(translations["not_found_pretrain"].format(dg="G"))
|
| 511 |
-
|
| 512 |
-
if not os.path.exists(pretrained_D):
|
| 513 |
-
return gr_warning(translations["not_found_pretrain"].format(dg="D"))
|
| 514 |
-
else:
|
| 515 |
-
pretrained_G = pretrained_D = None
|
| 516 |
-
gr_warning(translations["not_use_pretrain"])
|
| 517 |
-
|
| 518 |
-
if custom_reference:
|
| 519 |
-
embedder_model = embedders if embedders != "custom" else custom_embedders
|
| 520 |
-
|
| 521 |
-
reference_path = os.path.join(
|
| 522 |
-
configs["reference_path"],
|
| 523 |
-
"".join([
|
| 524 |
-
reference_name,
|
| 525 |
-
"_",
|
| 526 |
-
rvc_version,
|
| 527 |
-
"_",
|
| 528 |
-
embedder_model,
|
| 529 |
-
"_",
|
| 530 |
-
str(pitch_guidance),
|
| 531 |
-
"_",
|
| 532 |
-
str(energy_use)
|
| 533 |
-
])
|
| 534 |
-
)
|
| 535 |
-
|
| 536 |
-
if not os.path.exists(reference_path):
|
| 537 |
-
gr_warning(translations["not_found_reference"])
|
| 538 |
-
|
| 539 |
-
custom_reference = False
|
| 540 |
-
reference_path = None
|
| 541 |
-
else: reference_path = None
|
| 542 |
-
|
| 543 |
-
start_time = datetime.datetime.now()
|
| 544 |
-
|
| 545 |
-
p = subprocess.Popen([
|
| 546 |
-
python,
|
| 547 |
-
configs["train_path"],
|
| 548 |
-
"--model_name", model_name,
|
| 549 |
-
"--rvc_version", rvc_version,
|
| 550 |
-
"--save_every_epoch", str(save_every_epoch),
|
| 551 |
-
"--save_only_latest", str(save_only_latest),
|
| 552 |
-
"--save_every_weights", str(save_every_weights),
|
| 553 |
-
"--total_epoch", str(total_epoch),
|
| 554 |
-
"--batch_size", str(batch_size),
|
| 555 |
-
"--gpu", str(gpu),
|
| 556 |
-
"--pitch_guidance", str(pitch_guidance),
|
| 557 |
-
"--overtraining_detector", str(detector),
|
| 558 |
-
"--overtraining_threshold", str(threshold),
|
| 559 |
-
"--cleanup", str(clean_up),
|
| 560 |
-
"--cache_data_in_gpu", str(cache),
|
| 561 |
-
"--g_pretrained_path", str(pretrained_G),
|
| 562 |
-
"--d_pretrained_path", str(pretrained_D),
|
| 563 |
-
"--model_author", model_author,
|
| 564 |
-
"--vocoder", vocoder,
|
| 565 |
-
"--checkpointing", str(checkpointing),
|
| 566 |
-
"--deterministic", str(deterministic),
|
| 567 |
-
"--benchmark", str(benchmark),
|
| 568 |
-
"--optimizer", optimizer,
|
| 569 |
-
"--energy_use", str(energy_use),
|
| 570 |
-
"--use_custom_reference", str(custom_reference),
|
| 571 |
-
"--reference_path", str(reference_path),
|
| 572 |
-
"--multiscale_mel_loss", str(multiscale_mel_loss),
|
| 573 |
-
"--use_cosine_annealing_lr", str(cosine_annealing_lr),
|
| 574 |
-
"--architecture", architecture
|
| 575 |
-
])
|
| 576 |
-
|
| 577 |
-
done = [False]
|
| 578 |
-
|
| 579 |
-
with open(os.path.join(model_dir, "train_pid.txt"), "w") as pid_file:
|
| 580 |
-
pid_file.write(str(p.pid))
|
| 581 |
-
|
| 582 |
-
threading.Thread(target=if_done, args=(done, p)).start()
|
| 583 |
-
|
| 584 |
-
for log in log_read(done, getname(configs["train_path"]), start_time):
|
| 585 |
-
lines = log.splitlines()
|
| 586 |
-
|
| 587 |
-
if len(lines) > 50:
|
| 588 |
-
log = "\n".join(lines[-50:])
|
| 589 |
-
|
| 590 |
-
yield log
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/tts.py
DELETED
|
@@ -1,203 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import pysrt
|
| 4 |
-
import codecs
|
| 5 |
-
import asyncio
|
| 6 |
-
import requests
|
| 7 |
-
import tempfile
|
| 8 |
-
|
| 9 |
-
sys.path.append(os.getcwd())
|
| 10 |
-
|
| 11 |
-
from main.app.variables import translations
|
| 12 |
-
from main.app.core.ui import gr_info, gr_warning, gr_error
|
| 13 |
-
|
| 14 |
-
def synthesize_tts(
|
| 15 |
-
prompt,
|
| 16 |
-
voice,
|
| 17 |
-
speed,
|
| 18 |
-
output,
|
| 19 |
-
pitch,
|
| 20 |
-
google
|
| 21 |
-
):
|
| 22 |
-
if not google:
|
| 23 |
-
from edge_tts import Communicate
|
| 24 |
-
|
| 25 |
-
asyncio.run(
|
| 26 |
-
Communicate(
|
| 27 |
-
text=prompt,
|
| 28 |
-
voice=voice,
|
| 29 |
-
rate=f"+{speed}%" if speed >= 0 else f"{speed}%",
|
| 30 |
-
pitch=f"+{pitch}Hz" if pitch >= 0 else f"{pitch}Hz"
|
| 31 |
-
).save(output)
|
| 32 |
-
)
|
| 33 |
-
else:
|
| 34 |
-
response = requests.get(
|
| 35 |
-
codecs.decode(
|
| 36 |
-
"uggcf://genafyngr.tbbtyr.pbz/genafyngr_ggf",
|
| 37 |
-
"rot13"
|
| 38 |
-
),
|
| 39 |
-
params={
|
| 40 |
-
"ie": "UTF-8",
|
| 41 |
-
"q": prompt,
|
| 42 |
-
"tl": voice,
|
| 43 |
-
"ttsspeed": max(0.24, min(4.0, 1 + speed / 100)),
|
| 44 |
-
"client": "tw-ob"
|
| 45 |
-
},
|
| 46 |
-
headers={
|
| 47 |
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
|
| 48 |
-
},
|
| 49 |
-
timeout=15
|
| 50 |
-
)
|
| 51 |
-
|
| 52 |
-
if response.status_code == 200:
|
| 53 |
-
with open(output, "wb") as f:
|
| 54 |
-
f.write(response.content)
|
| 55 |
-
|
| 56 |
-
if pitch != 0 or speed != 0:
|
| 57 |
-
import librosa
|
| 58 |
-
import soundfile as sf
|
| 59 |
-
|
| 60 |
-
y, sr = librosa.load(output, sr=None)
|
| 61 |
-
|
| 62 |
-
if pitch != 0:
|
| 63 |
-
y = librosa.effects.pitch_shift(
|
| 64 |
-
y,
|
| 65 |
-
sr=sr,
|
| 66 |
-
n_steps=pitch
|
| 67 |
-
)
|
| 68 |
-
|
| 69 |
-
rate = max(0.01, 1 + speed / 100)
|
| 70 |
-
if rate != 1.0:
|
| 71 |
-
y = librosa.effects.time_stretch(
|
| 72 |
-
y,
|
| 73 |
-
rate=rate
|
| 74 |
-
)
|
| 75 |
-
|
| 76 |
-
sf.write(
|
| 77 |
-
file=output,
|
| 78 |
-
data=y,
|
| 79 |
-
samplerate=sr,
|
| 80 |
-
format=os.path.splitext(
|
| 81 |
-
os.path.basename(output)
|
| 82 |
-
)[-1].lower().replace('.', '')
|
| 83 |
-
)
|
| 84 |
-
else: gr_error(f"{response.status_code}, {response.text}")
|
| 85 |
-
|
| 86 |
-
def srt_tts(
|
| 87 |
-
srt_file,
|
| 88 |
-
out_file,
|
| 89 |
-
voice,
|
| 90 |
-
rate = 0,
|
| 91 |
-
sr = 24000,
|
| 92 |
-
google = False
|
| 93 |
-
):
|
| 94 |
-
import librosa
|
| 95 |
-
import numpy as np
|
| 96 |
-
import soundfile as sf
|
| 97 |
-
|
| 98 |
-
def time_stretch(y, sr, target_duration):
|
| 99 |
-
rate = (len(y) / sr) / target_duration
|
| 100 |
-
|
| 101 |
-
if rate != 1.0:
|
| 102 |
-
y = librosa.effects.time_stretch(
|
| 103 |
-
y=y.astype(np.float32),
|
| 104 |
-
rate=rate
|
| 105 |
-
)
|
| 106 |
-
|
| 107 |
-
n_target = int(round(target_duration * sr))
|
| 108 |
-
return np.pad(y, (0, n_target - len(y))) if len(y) < n_target else y[:n_target]
|
| 109 |
-
|
| 110 |
-
def pysrttime_to_seconds(t):
|
| 111 |
-
return (t.hours * 60 + t.minutes) * 60 + t.seconds + t.milliseconds / 1000
|
| 112 |
-
|
| 113 |
-
subs = pysrt.open(srt_file)
|
| 114 |
-
if not subs: raise ValueError(translations["srt"])
|
| 115 |
-
|
| 116 |
-
final_audio = np.zeros(
|
| 117 |
-
int(round(pysrttime_to_seconds(subs[-1].end) * sr)),
|
| 118 |
-
dtype=np.float32
|
| 119 |
-
)
|
| 120 |
-
|
| 121 |
-
with tempfile.TemporaryDirectory() as tempdir:
|
| 122 |
-
for idx, seg in enumerate(subs):
|
| 123 |
-
wav_path = os.path.join(tempdir, f"seg_{idx}.wav")
|
| 124 |
-
|
| 125 |
-
synthesize_tts(
|
| 126 |
-
" ".join(seg.text.splitlines()),
|
| 127 |
-
voice,
|
| 128 |
-
0,
|
| 129 |
-
wav_path,
|
| 130 |
-
rate,
|
| 131 |
-
google
|
| 132 |
-
)
|
| 133 |
-
|
| 134 |
-
audio, file_sr = sf.read(wav_path, dtype=np.float32)
|
| 135 |
-
if file_sr != sr: audio = librosa.resample(audio, orig_sr=file_sr, target_sr=sr, res_type="soxr_vhq")
|
| 136 |
-
|
| 137 |
-
adjusted = time_stretch(
|
| 138 |
-
audio,
|
| 139 |
-
sr,
|
| 140 |
-
pysrttime_to_seconds(seg.duration)
|
| 141 |
-
)
|
| 142 |
-
|
| 143 |
-
start_sample = int(round(pysrttime_to_seconds(seg.start) * sr))
|
| 144 |
-
end_sample = start_sample + adjusted.shape[0]
|
| 145 |
-
|
| 146 |
-
if end_sample > final_audio.shape[0]:
|
| 147 |
-
adjusted = adjusted[: final_audio.shape[0] - start_sample]
|
| 148 |
-
end_sample = final_audio.shape[0]
|
| 149 |
-
|
| 150 |
-
final_audio[start_sample:end_sample] += adjusted
|
| 151 |
-
|
| 152 |
-
sf.write(out_file, final_audio, sr)
|
| 153 |
-
|
| 154 |
-
def TTS(
|
| 155 |
-
prompt,
|
| 156 |
-
voice,
|
| 157 |
-
speed,
|
| 158 |
-
output,
|
| 159 |
-
pitch,
|
| 160 |
-
google,
|
| 161 |
-
srt_input
|
| 162 |
-
):
|
| 163 |
-
if not srt_input: srt_input = ""
|
| 164 |
-
|
| 165 |
-
if not prompt and not srt_input.endswith(".srt"):
|
| 166 |
-
gr_warning(translations["enter_the_text"])
|
| 167 |
-
return None
|
| 168 |
-
|
| 169 |
-
if not voice:
|
| 170 |
-
gr_warning(translations["choose_voice"])
|
| 171 |
-
return None
|
| 172 |
-
|
| 173 |
-
if not output:
|
| 174 |
-
gr_warning(translations["output_not_valid"])
|
| 175 |
-
return None
|
| 176 |
-
|
| 177 |
-
if os.path.isdir(output): output = os.path.join(output, f"tts.wav")
|
| 178 |
-
gr_info(translations["convert"].format(name=translations["text"]))
|
| 179 |
-
|
| 180 |
-
output_dir = os.path.dirname(output) or output
|
| 181 |
-
if not os.path.exists(output_dir): os.makedirs(output_dir, exist_ok=True)
|
| 182 |
-
|
| 183 |
-
if srt_input.endswith(".srt"):
|
| 184 |
-
srt_tts(
|
| 185 |
-
srt_input,
|
| 186 |
-
output,
|
| 187 |
-
voice,
|
| 188 |
-
0,
|
| 189 |
-
24000,
|
| 190 |
-
google
|
| 191 |
-
)
|
| 192 |
-
else:
|
| 193 |
-
synthesize_tts(
|
| 194 |
-
prompt,
|
| 195 |
-
voice,
|
| 196 |
-
speed,
|
| 197 |
-
output,
|
| 198 |
-
pitch,
|
| 199 |
-
google
|
| 200 |
-
)
|
| 201 |
-
|
| 202 |
-
gr_info(translations["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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/ui.py
DELETED
|
@@ -1,814 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import re
|
| 3 |
-
import sys
|
| 4 |
-
import json
|
| 5 |
-
import torch
|
| 6 |
-
import shutil
|
| 7 |
-
|
| 8 |
-
import gradio as gr
|
| 9 |
-
|
| 10 |
-
sys.path.append(os.getcwd())
|
| 11 |
-
|
| 12 |
-
import main.library.audio.sounddevice as sd
|
| 13 |
-
|
| 14 |
-
from main.library.backends import directml, opencl
|
| 15 |
-
from main.inference.realtime.audio import audio_device
|
| 16 |
-
|
| 17 |
-
from main.app.variables import (
|
| 18 |
-
logger,
|
| 19 |
-
config,
|
| 20 |
-
configs,
|
| 21 |
-
edgetts,
|
| 22 |
-
method_f0,
|
| 23 |
-
vr_models,
|
| 24 |
-
mdx_models,
|
| 25 |
-
file_types,
|
| 26 |
-
configs_json,
|
| 27 |
-
translations,
|
| 28 |
-
whisper_model,
|
| 29 |
-
demucs_models,
|
| 30 |
-
method_f0_full,
|
| 31 |
-
gradio_version,
|
| 32 |
-
embedders_model,
|
| 33 |
-
google_tts_voice
|
| 34 |
-
)
|
| 35 |
-
|
| 36 |
-
input_channels_map, output_channels_map = audio_device()
|
| 37 |
-
|
| 38 |
-
def gr_info(message):
|
| 39 |
-
gr.Info(message, duration=2)
|
| 40 |
-
logger.info(message)
|
| 41 |
-
|
| 42 |
-
def gr_warning(message):
|
| 43 |
-
gr.Warning(message, duration=2)
|
| 44 |
-
logger.warning(message)
|
| 45 |
-
|
| 46 |
-
def gr_error(message):
|
| 47 |
-
gr.Error(message=message, duration=6)
|
| 48 |
-
logger.error(message)
|
| 49 |
-
|
| 50 |
-
def get_gpu_info():
|
| 51 |
-
ngpu = torch.cuda.device_count()
|
| 52 |
-
gpu_infos = [
|
| 53 |
-
(
|
| 54 |
-
f"{i}: {torch.cuda.get_device_name(i)} " +
|
| 55 |
-
f"({int(torch.cuda.get_device_properties(i).total_memory / (1024**3) + 0.4)} GB)"
|
| 56 |
-
)
|
| 57 |
-
for i in range(ngpu)
|
| 58 |
-
if config.device.startswith("cuda") or ngpu != 0
|
| 59 |
-
]
|
| 60 |
-
|
| 61 |
-
if len(gpu_infos) == 0 and config.device.startswith("xpu"):
|
| 62 |
-
ngpu = torch.xpu.device_count()
|
| 63 |
-
gpu_infos = [
|
| 64 |
-
(
|
| 65 |
-
f"{i}: {torch.xpu.get_device_name(i)} " +
|
| 66 |
-
f"({int(torch.xpu.get_device_properties(i).total_memory / (1024**3) + 0.4)} GB)"
|
| 67 |
-
)
|
| 68 |
-
for i in range(ngpu)
|
| 69 |
-
if config.device.startswith("xpu") or ngpu != 0
|
| 70 |
-
]
|
| 71 |
-
|
| 72 |
-
if len(gpu_infos) == 0:
|
| 73 |
-
if config.device.startswith("privateuseone"):
|
| 74 |
-
ngpu = directml.device_count()
|
| 75 |
-
|
| 76 |
-
gpu_infos = [
|
| 77 |
-
f"{i}: {directml.device_name(i)}"
|
| 78 |
-
for i in range(ngpu)
|
| 79 |
-
if config.device.startswith("privateuseone") or ngpu != 0
|
| 80 |
-
]
|
| 81 |
-
elif config.device.startswith("ocl"):
|
| 82 |
-
ngpu = opencl.device_count()
|
| 83 |
-
|
| 84 |
-
gpu_infos = [
|
| 85 |
-
f"{i}: {opencl.device_name(i)}"
|
| 86 |
-
for i in range(ngpu)
|
| 87 |
-
if config.device.startswith("ocl") or ngpu != 0
|
| 88 |
-
]
|
| 89 |
-
else:
|
| 90 |
-
ngpu = 0
|
| 91 |
-
gpu_infos = []
|
| 92 |
-
|
| 93 |
-
return (
|
| 94 |
-
(
|
| 95 |
-
"\n".join(gpu_infos)
|
| 96 |
-
if len(gpu_infos) > 0 and not config.cpu_mode else
|
| 97 |
-
translations["no_support_gpu"]
|
| 98 |
-
),
|
| 99 |
-
ngpu
|
| 100 |
-
)
|
| 101 |
-
|
| 102 |
-
def gpu_number_str():
|
| 103 |
-
if config.cpu_mode: return "-"
|
| 104 |
-
ngpu = torch.cuda.device_count()
|
| 105 |
-
|
| 106 |
-
if ngpu == 0 and config.device.startswith("xpu"):
|
| 107 |
-
ngpu = torch.xpu.device_count()
|
| 108 |
-
if ngpu != 0: return "0"
|
| 109 |
-
|
| 110 |
-
if ngpu == 0:
|
| 111 |
-
ngpu = (
|
| 112 |
-
directml.device_count()
|
| 113 |
-
if config.device.startswith("privateuseone") else
|
| 114 |
-
opencl.device_count()
|
| 115 |
-
)
|
| 116 |
-
if ngpu != 0: return "0"
|
| 117 |
-
|
| 118 |
-
return str("-".join(map(str, range(ngpu))) if config.device.startswith(("cuda", "xpu", "privateuseone", "ocl")) else "-")
|
| 119 |
-
|
| 120 |
-
def change_f0_choices():
|
| 121 |
-
f0_file = sorted([
|
| 122 |
-
os.path.abspath(os.path.join(root, f))
|
| 123 |
-
for root, _, files in os.walk(configs["f0_path"])
|
| 124 |
-
for f in files
|
| 125 |
-
if f.endswith(".txt")
|
| 126 |
-
])
|
| 127 |
-
|
| 128 |
-
return {
|
| 129 |
-
"value": f0_file[0] if len(f0_file) >= 1 else "",
|
| 130 |
-
"choices": f0_file,
|
| 131 |
-
"__type__": "update"
|
| 132 |
-
}
|
| 133 |
-
|
| 134 |
-
def change_audios_choices(input_audio):
|
| 135 |
-
audios = sorted([
|
| 136 |
-
os.path.abspath(os.path.join(root, f))
|
| 137 |
-
for root, _, files in os.walk(configs["audios_path"])
|
| 138 |
-
for f in files if os.path.splitext(f)[1].lower() in file_types and not f.startswith(("Convert", "output"))
|
| 139 |
-
])
|
| 140 |
-
|
| 141 |
-
return {
|
| 142 |
-
"value": input_audio if input_audio != "" else (audios[0] if len(audios) >= 1 else ""),
|
| 143 |
-
"choices": audios,
|
| 144 |
-
"__type__": "update"
|
| 145 |
-
}
|
| 146 |
-
|
| 147 |
-
def change_reference_choices():
|
| 148 |
-
reference = sorted([
|
| 149 |
-
re.sub(r'_v\d+_(?:[A-Za-z0-9_]+?)_(True|False)_(True|False)$', '', name)
|
| 150 |
-
for name in os.listdir(configs["reference_path"])
|
| 151 |
-
if (
|
| 152 |
-
os.path.exists(os.path.join(configs["reference_path"], name)) and
|
| 153 |
-
os.path.isdir(os.path.join(configs["reference_path"], name))
|
| 154 |
-
)
|
| 155 |
-
])
|
| 156 |
-
|
| 157 |
-
return {
|
| 158 |
-
"value": reference[0] if len(reference) >= 1 else "",
|
| 159 |
-
"choices": reference,
|
| 160 |
-
"__type__": "update"
|
| 161 |
-
}
|
| 162 |
-
|
| 163 |
-
def change_models_choices():
|
| 164 |
-
model, index = (
|
| 165 |
-
sorted([
|
| 166 |
-
model
|
| 167 |
-
for model in os.listdir(configs["weights_path"])
|
| 168 |
-
if model.endswith((".pth", ".onnx")) and not model.startswith("G_") and not model.startswith("D_")
|
| 169 |
-
]),
|
| 170 |
-
sorted([
|
| 171 |
-
os.path.join(root, name)
|
| 172 |
-
for root, _, files in os.walk(configs["logs_path"], topdown=False)
|
| 173 |
-
for name in files if name.endswith(".index") and "trained" not in name
|
| 174 |
-
])
|
| 175 |
-
)
|
| 176 |
-
|
| 177 |
-
return [
|
| 178 |
-
{
|
| 179 |
-
"value": model[0] if len(model) >= 1 else "",
|
| 180 |
-
"choices": model,
|
| 181 |
-
"__type__": "update"
|
| 182 |
-
},
|
| 183 |
-
{
|
| 184 |
-
"value": index[0] if len(index) >= 1 else "",
|
| 185 |
-
"choices": index,
|
| 186 |
-
"__type__": "update"
|
| 187 |
-
}
|
| 188 |
-
]
|
| 189 |
-
|
| 190 |
-
def change_pretrained_choices():
|
| 191 |
-
pretrainD = sorted([
|
| 192 |
-
model for model in os.listdir(configs["pretrained_custom_path"])
|
| 193 |
-
if model.endswith(".pth") and "D" in model
|
| 194 |
-
])
|
| 195 |
-
|
| 196 |
-
pretrainG = sorted([
|
| 197 |
-
model for model in os.listdir(configs["pretrained_custom_path"])
|
| 198 |
-
if model.endswith(".pth") and "G" in model
|
| 199 |
-
])
|
| 200 |
-
|
| 201 |
-
return [
|
| 202 |
-
{
|
| 203 |
-
"choices": pretrainD,
|
| 204 |
-
"value": pretrainD[0] if len(pretrainD) >= 1 else "",
|
| 205 |
-
"__type__": "update"
|
| 206 |
-
},
|
| 207 |
-
{
|
| 208 |
-
"choices": pretrainG,
|
| 209 |
-
"value": pretrainG[0] if len(pretrainG) >= 1 else "",
|
| 210 |
-
"__type__": "update"
|
| 211 |
-
}
|
| 212 |
-
]
|
| 213 |
-
|
| 214 |
-
def change_preset_choices():
|
| 215 |
-
return {
|
| 216 |
-
"value": "",
|
| 217 |
-
"choices": sorted([
|
| 218 |
-
f for f in os.listdir(configs["presets_path"])
|
| 219 |
-
if f.endswith(".conversion.json")
|
| 220 |
-
]),
|
| 221 |
-
"__type__": "update"
|
| 222 |
-
}
|
| 223 |
-
|
| 224 |
-
def change_effect_preset_choices():
|
| 225 |
-
return {
|
| 226 |
-
"value": "",
|
| 227 |
-
"choices": sorted([
|
| 228 |
-
f for f in os.listdir(configs["presets_path"])
|
| 229 |
-
if f.endswith(".effect.json")
|
| 230 |
-
]),
|
| 231 |
-
"__type__": "update"
|
| 232 |
-
}
|
| 233 |
-
|
| 234 |
-
def change_realtime_preset_choices():
|
| 235 |
-
return {
|
| 236 |
-
"value": "",
|
| 237 |
-
"choices": sorted([
|
| 238 |
-
f for f in os.listdir(configs["presets_path"])
|
| 239 |
-
if f.endswith(".realtime.json")
|
| 240 |
-
]),
|
| 241 |
-
"__type__": "update"
|
| 242 |
-
}
|
| 243 |
-
|
| 244 |
-
def change_tts_voice_choices(google):
|
| 245 |
-
return {
|
| 246 |
-
"choices": google_tts_voice if google else edgetts,
|
| 247 |
-
"value": google_tts_voice[0] if google else edgetts[0],
|
| 248 |
-
"__type__": "update"
|
| 249 |
-
}
|
| 250 |
-
|
| 251 |
-
def change_backing_choices(
|
| 252 |
-
backing,
|
| 253 |
-
merge
|
| 254 |
-
):
|
| 255 |
-
if backing or merge:
|
| 256 |
-
return {
|
| 257 |
-
"value": False,
|
| 258 |
-
"interactive": False,
|
| 259 |
-
"__type__": "update"
|
| 260 |
-
}
|
| 261 |
-
elif not backing or not merge:
|
| 262 |
-
return {
|
| 263 |
-
"interactive": True,
|
| 264 |
-
"__type__": "update"
|
| 265 |
-
}
|
| 266 |
-
else:
|
| 267 |
-
gr_warning(translations["option_not_valid"])
|
| 268 |
-
|
| 269 |
-
def change_download_choices(select):
|
| 270 |
-
selects = [False]*10
|
| 271 |
-
|
| 272 |
-
if select == translations["download_url"]:
|
| 273 |
-
selects[0] = selects[1] = selects[2] = True
|
| 274 |
-
elif select == translations["download_from_csv"]:
|
| 275 |
-
selects[3] = selects[4] = True
|
| 276 |
-
elif select == translations["search_models"]:
|
| 277 |
-
selects[5] = selects[6] = True
|
| 278 |
-
elif select == translations["upload"]:
|
| 279 |
-
selects[9] = True
|
| 280 |
-
else:
|
| 281 |
-
gr_warning(translations["option_not_valid"])
|
| 282 |
-
|
| 283 |
-
return [
|
| 284 |
-
{
|
| 285 |
-
"visible": selects[i] if gradio_version else (selects[i] or "hidden"),
|
| 286 |
-
"__type__": "update"
|
| 287 |
-
}
|
| 288 |
-
for i in range(len(selects))
|
| 289 |
-
]
|
| 290 |
-
|
| 291 |
-
def change_download_pretrained_choices(select):
|
| 292 |
-
selects = [False]*7
|
| 293 |
-
|
| 294 |
-
if select == translations["download_url"]:
|
| 295 |
-
selects[0] = selects[1] = selects[2] = True
|
| 296 |
-
elif select == translations["list_model"]:
|
| 297 |
-
selects[3] = selects[4] = selects[5] = True
|
| 298 |
-
elif select == translations["upload"]:
|
| 299 |
-
selects[6] = True
|
| 300 |
-
else:
|
| 301 |
-
gr_warning(translations["option_not_valid"])
|
| 302 |
-
|
| 303 |
-
return [
|
| 304 |
-
{
|
| 305 |
-
"visible": selects[i] if gradio_version else (selects[i] or "hidden"),
|
| 306 |
-
"__type__": "update"
|
| 307 |
-
}
|
| 308 |
-
for i in range(len(selects))
|
| 309 |
-
]
|
| 310 |
-
|
| 311 |
-
def get_index(model):
|
| 312 |
-
model = os.path.basename(model).split("_")[0]
|
| 313 |
-
|
| 314 |
-
return {
|
| 315 |
-
"value": next((
|
| 316 |
-
f for f in [
|
| 317 |
-
os.path.join(root, name)
|
| 318 |
-
for root, _, files in os.walk(configs["logs_path"], topdown=False)
|
| 319 |
-
for name in files
|
| 320 |
-
if name.endswith(".index") and "trained" not in name
|
| 321 |
-
]
|
| 322 |
-
if model.split(".")[0] in f
|
| 323 |
-
), ""),
|
| 324 |
-
"__type__": "update"
|
| 325 |
-
} if model else None
|
| 326 |
-
|
| 327 |
-
def index_strength_show(index):
|
| 328 |
-
index_strength_visible = (
|
| 329 |
-
index != "" and
|
| 330 |
-
index != None and
|
| 331 |
-
os.path.exists(index) and
|
| 332 |
-
os.path.isfile(index)
|
| 333 |
-
)
|
| 334 |
-
|
| 335 |
-
return [
|
| 336 |
-
{
|
| 337 |
-
"visible": index_strength_visible if gradio_version else (index_strength_visible or "hidden"),
|
| 338 |
-
"value": 0.5,
|
| 339 |
-
"__type__": "update"
|
| 340 |
-
},
|
| 341 |
-
{
|
| 342 |
-
"visible": index_strength_visible if gradio_version else (index_strength_visible or "hidden"),
|
| 343 |
-
"value": 9,
|
| 344 |
-
"__type__": "update"
|
| 345 |
-
}
|
| 346 |
-
]
|
| 347 |
-
|
| 348 |
-
def hoplength_show(
|
| 349 |
-
method,
|
| 350 |
-
hybrid_method=None
|
| 351 |
-
):
|
| 352 |
-
visible = False
|
| 353 |
-
|
| 354 |
-
for m in [
|
| 355 |
-
"mangio-crepe",
|
| 356 |
-
"yin",
|
| 357 |
-
"piptrack",
|
| 358 |
-
"mangio-penn"
|
| 359 |
-
]:
|
| 360 |
-
if m in method: visible = True
|
| 361 |
-
|
| 362 |
-
if (
|
| 363 |
-
hybrid_method is not None and
|
| 364 |
-
m in hybrid_method
|
| 365 |
-
):
|
| 366 |
-
visible = True
|
| 367 |
-
|
| 368 |
-
if visible: break
|
| 369 |
-
else: visible = False
|
| 370 |
-
|
| 371 |
-
return {
|
| 372 |
-
"visible": visible if gradio_version else (visible or "hidden"),
|
| 373 |
-
"__type__": "update"
|
| 374 |
-
}
|
| 375 |
-
|
| 376 |
-
def visible(value):
|
| 377 |
-
return {
|
| 378 |
-
"visible": value if gradio_version else (value or "hidden"),
|
| 379 |
-
"__type__": "update"
|
| 380 |
-
}
|
| 381 |
-
|
| 382 |
-
def visibleFalse(value):
|
| 383 |
-
return {
|
| 384 |
-
"visible": value if gradio_version else (value or "hidden"),
|
| 385 |
-
"value": False,
|
| 386 |
-
"__type__": "update"
|
| 387 |
-
}
|
| 388 |
-
|
| 389 |
-
def valueFalse_interactive(value):
|
| 390 |
-
return {
|
| 391 |
-
"value": False,
|
| 392 |
-
"interactive": value,
|
| 393 |
-
"__type__": "update"
|
| 394 |
-
}
|
| 395 |
-
|
| 396 |
-
def interactive(value):
|
| 397 |
-
return {
|
| 398 |
-
"interactive": value,
|
| 399 |
-
"__type__": "update"
|
| 400 |
-
}
|
| 401 |
-
|
| 402 |
-
def valueEmpty_visible1(value):
|
| 403 |
-
return {
|
| 404 |
-
"value": "",
|
| 405 |
-
"visible": value if gradio_version else (value or "hidden"),
|
| 406 |
-
"__type__": "update"
|
| 407 |
-
}
|
| 408 |
-
|
| 409 |
-
def pitch_guidance_lock(vocoders):
|
| 410 |
-
return {
|
| 411 |
-
"value": True,
|
| 412 |
-
"interactive": vocoders == "Default",
|
| 413 |
-
"__type__": "update"
|
| 414 |
-
}
|
| 415 |
-
|
| 416 |
-
def vocoders_lock(pitch):
|
| 417 |
-
if pitch:
|
| 418 |
-
return gr.update(interactive=True)
|
| 419 |
-
|
| 420 |
-
return gr.update(
|
| 421 |
-
value="Default",
|
| 422 |
-
interactive=False
|
| 423 |
-
)
|
| 424 |
-
|
| 425 |
-
def unlock_f0(value):
|
| 426 |
-
return {
|
| 427 |
-
"choices": method_f0_full if value else method_f0,
|
| 428 |
-
"value": "rmvpe",
|
| 429 |
-
"__type__": "update"
|
| 430 |
-
}
|
| 431 |
-
|
| 432 |
-
def unlock_vocoder(value, vocoder):
|
| 433 |
-
return {
|
| 434 |
-
"value": vocoder if value == "v2" else "Default",
|
| 435 |
-
"interactive": value == "v2",
|
| 436 |
-
"__type__": "update"
|
| 437 |
-
}
|
| 438 |
-
|
| 439 |
-
def unlock_version(value, vocoder):
|
| 440 |
-
return {
|
| 441 |
-
"value": "v2" if vocoder == "Default" else value,
|
| 442 |
-
"interactive": vocoder == "Default",
|
| 443 |
-
"__type__": "update"
|
| 444 |
-
}
|
| 445 |
-
|
| 446 |
-
def change_embedders_mode(value):
|
| 447 |
-
if value == "whisper":
|
| 448 |
-
return {
|
| 449 |
-
"value": whisper_model[0],
|
| 450 |
-
"choices": whisper_model,
|
| 451 |
-
"__type__": "update"
|
| 452 |
-
}
|
| 453 |
-
else:
|
| 454 |
-
return {
|
| 455 |
-
"value": embedders_model[0],
|
| 456 |
-
"choices": embedders_model,
|
| 457 |
-
"__type__": "update"
|
| 458 |
-
}
|
| 459 |
-
|
| 460 |
-
def change_fp(fp, bf16, tf32):
|
| 461 |
-
global config
|
| 462 |
-
|
| 463 |
-
fp16 = fp == "fp16"
|
| 464 |
-
|
| 465 |
-
if fp16 and not config.allow_is_half:
|
| 466 |
-
gr_warning(translations["fp16_not_support"])
|
| 467 |
-
return "fp32"
|
| 468 |
-
else:
|
| 469 |
-
gr_info(translations["start_update_precision"])
|
| 470 |
-
|
| 471 |
-
configs = json.load(open(configs_json, "r"))
|
| 472 |
-
configs["fp16"] = config.is_half = fp16
|
| 473 |
-
configs["brain"] = config.brain = bf16
|
| 474 |
-
configs["tf32"] = config.tf32 = tf32
|
| 475 |
-
|
| 476 |
-
with open(configs_json, "w") as f:
|
| 477 |
-
json.dump(configs, f, indent=4)
|
| 478 |
-
|
| 479 |
-
gr_info(translations["success"])
|
| 480 |
-
return "fp16" if fp16 else "fp32"
|
| 481 |
-
|
| 482 |
-
def process_output(file_path):
|
| 483 |
-
if config.configs.get("delete_exists_file", True):
|
| 484 |
-
if os.path.exists(file_path) and os.path.isfile(file_path): os.remove(file_path)
|
| 485 |
-
return file_path
|
| 486 |
-
else:
|
| 487 |
-
if not os.path.exists(file_path): return file_path
|
| 488 |
-
file = os.path.splitext(os.path.basename(file_path))
|
| 489 |
-
|
| 490 |
-
index = 1
|
| 491 |
-
while 1:
|
| 492 |
-
file_path = os.path.join(
|
| 493 |
-
os.path.dirname(file_path),
|
| 494 |
-
f"{file[0]}_{index}{file[1]}"
|
| 495 |
-
)
|
| 496 |
-
|
| 497 |
-
if not os.path.exists(file_path): return file_path
|
| 498 |
-
index += 1
|
| 499 |
-
|
| 500 |
-
def shutil_move(input_path, output_path):
|
| 501 |
-
output_path = (
|
| 502 |
-
os.path.join(output_path, os.path.basename(input_path))
|
| 503 |
-
if os.path.isdir(output_path) else
|
| 504 |
-
output_path
|
| 505 |
-
)
|
| 506 |
-
|
| 507 |
-
return (
|
| 508 |
-
shutil.move(input_path, process_output(output_path))
|
| 509 |
-
if os.path.exists(output_path) else
|
| 510 |
-
shutil.move(input_path, output_path)
|
| 511 |
-
)
|
| 512 |
-
|
| 513 |
-
def separate_change(
|
| 514 |
-
model_name,
|
| 515 |
-
karaoke_model,
|
| 516 |
-
reverb_model,
|
| 517 |
-
enable_post_process,
|
| 518 |
-
separate_backing,
|
| 519 |
-
separate_reverb,
|
| 520 |
-
enable_denoise
|
| 521 |
-
):
|
| 522 |
-
model_type = (
|
| 523 |
-
"vr" if model_name in list(vr_models.keys()) else "mdx"
|
| 524 |
-
if model_name in list(mdx_models.keys()) else "demucs"
|
| 525 |
-
if model_name in list(demucs_models.keys()) else ""
|
| 526 |
-
)
|
| 527 |
-
|
| 528 |
-
karaoke_type = ("vr" if karaoke_model.startswith("VR") else "mdx") if separate_backing else None
|
| 529 |
-
reverb_type = ("vr" if not reverb_model.startswith("MDX") else "mdx") if separate_reverb else None
|
| 530 |
-
|
| 531 |
-
all_types = {model_type, karaoke_type, reverb_type}
|
| 532 |
-
|
| 533 |
-
is_vr = "vr" in all_types
|
| 534 |
-
is_mdx = "mdx" in all_types
|
| 535 |
-
is_demucs = "demucs" in all_types
|
| 536 |
-
|
| 537 |
-
return [
|
| 538 |
-
visible(separate_backing),
|
| 539 |
-
visible(separate_reverb),
|
| 540 |
-
visible(is_mdx or is_demucs),
|
| 541 |
-
visible(is_mdx or is_demucs),
|
| 542 |
-
visible(is_mdx),
|
| 543 |
-
visible(is_mdx or is_vr),
|
| 544 |
-
visible(is_demucs),
|
| 545 |
-
visible(is_vr),
|
| 546 |
-
visible(is_vr),
|
| 547 |
-
visible(is_vr and enable_post_process),
|
| 548 |
-
visible(is_vr and enable_denoise),
|
| 549 |
-
valueFalse_interactive(is_vr),
|
| 550 |
-
valueFalse_interactive(is_vr),
|
| 551 |
-
interactive(is_vr) if is_vr else valueFalse_interactive(is_vr)
|
| 552 |
-
]
|
| 553 |
-
|
| 554 |
-
def create_dataset_change(
|
| 555 |
-
model_name,
|
| 556 |
-
reverb_model,
|
| 557 |
-
enable_post_process,
|
| 558 |
-
separate_reverb,
|
| 559 |
-
enable_denoise
|
| 560 |
-
):
|
| 561 |
-
model_type = (
|
| 562 |
-
"vr" if model_name in list(vr_models.keys()) else "mdx"
|
| 563 |
-
if model_name in list(mdx_models.keys()) else "demucs"
|
| 564 |
-
if model_name in list(demucs_models.keys()) else ""
|
| 565 |
-
)
|
| 566 |
-
|
| 567 |
-
reverb_type = ("vr" if not reverb_model.startswith("MDX") else "mdx") if separate_reverb else None
|
| 568 |
-
all_types = {model_type, reverb_type}
|
| 569 |
-
|
| 570 |
-
is_vr = "vr" in all_types
|
| 571 |
-
is_mdx = "mdx" in all_types
|
| 572 |
-
is_demucs = "demucs" in all_types
|
| 573 |
-
|
| 574 |
-
return [
|
| 575 |
-
visible(separate_reverb),
|
| 576 |
-
visible(is_mdx or is_demucs),
|
| 577 |
-
visible(is_mdx or is_demucs),
|
| 578 |
-
visible(is_mdx),
|
| 579 |
-
visible(is_mdx or is_vr),
|
| 580 |
-
visible(is_demucs),
|
| 581 |
-
visible(is_vr),
|
| 582 |
-
visible(is_vr),
|
| 583 |
-
visible(is_vr and enable_post_process),
|
| 584 |
-
visible(is_vr and enable_denoise),
|
| 585 |
-
valueFalse_interactive(is_vr),
|
| 586 |
-
valueFalse_interactive(is_vr),
|
| 587 |
-
interactive(is_vr) if is_vr else valueFalse_interactive(is_vr)
|
| 588 |
-
]
|
| 589 |
-
|
| 590 |
-
def update_audio_device(input_device, output_device, monitor_device, monitor):
|
| 591 |
-
input_is_asio = "ASIO" in input_device if input_device else (False if gradio_version else "hidden")
|
| 592 |
-
output_is_asio = "ASIO" in output_device if output_device else (False if gradio_version else "hidden")
|
| 593 |
-
monitor_is_asio = "ASIO" in monitor_device if monitor_device else (False if gradio_version else "hidden")
|
| 594 |
-
|
| 595 |
-
if input_is_asio or output_is_asio or monitor_is_asio:
|
| 596 |
-
sd.terminate()
|
| 597 |
-
sd.initialize()
|
| 598 |
-
|
| 599 |
-
try:
|
| 600 |
-
input_max_ch = input_channels_map.get(input_device, [])[1]
|
| 601 |
-
output_max_ch = output_channels_map.get(output_device, [])[1]
|
| 602 |
-
monitor_max_ch = output_channels_map.get(monitor_device, [])[1] if monitor else 128
|
| 603 |
-
except:
|
| 604 |
-
input_max_ch = output_max_ch = monitor_max_ch = 2
|
| 605 |
-
else: input_max_ch = output_max_ch = monitor_max_ch = 2
|
| 606 |
-
|
| 607 |
-
return [
|
| 608 |
-
visible(monitor),
|
| 609 |
-
visible(monitor),
|
| 610 |
-
visible(
|
| 611 |
-
input_is_asio or output_is_asio or monitor_is_asio
|
| 612 |
-
),
|
| 613 |
-
gr.update(
|
| 614 |
-
visible=input_is_asio,
|
| 615 |
-
maximum=input_max_ch - 1
|
| 616 |
-
),
|
| 617 |
-
gr.update(
|
| 618 |
-
visible=output_is_asio,
|
| 619 |
-
maximum=output_max_ch - 1
|
| 620 |
-
),
|
| 621 |
-
gr.update(
|
| 622 |
-
visible=monitor_is_asio,
|
| 623 |
-
maximum=monitor_max_ch - 1
|
| 624 |
-
),
|
| 625 |
-
gr.update(
|
| 626 |
-
value=resolve_sample_rate(input_channels_map[input_device][0]) if input_is_asio else 48000
|
| 627 |
-
),
|
| 628 |
-
gr.update(
|
| 629 |
-
value=resolve_sample_rate(output_channels_map[output_device][0]) if output_is_asio else 48000
|
| 630 |
-
),
|
| 631 |
-
gr.update(
|
| 632 |
-
visible=monitor,
|
| 633 |
-
value=resolve_sample_rate(output_channels_map[monitor_device][0]) if monitor_is_asio else 48000
|
| 634 |
-
),
|
| 635 |
-
gr.update(
|
| 636 |
-
visible=output_is_asio,
|
| 637 |
-
value=True
|
| 638 |
-
),
|
| 639 |
-
gr.update(
|
| 640 |
-
visible=monitor_is_asio,
|
| 641 |
-
value=True
|
| 642 |
-
),
|
| 643 |
-
]
|
| 644 |
-
|
| 645 |
-
def change_audio_device_choices():
|
| 646 |
-
global input_channels_map, output_channels_map
|
| 647 |
-
|
| 648 |
-
sd.terminate()
|
| 649 |
-
sd.initialize()
|
| 650 |
-
|
| 651 |
-
input_channels_map, output_channels_map = audio_device()
|
| 652 |
-
input_channels_map_list, output_channels_map_list = list(input_channels_map.keys()), list(output_channels_map.keys())
|
| 653 |
-
|
| 654 |
-
return [
|
| 655 |
-
{
|
| 656 |
-
"value": input_channels_map_list[0] if len(input_channels_map_list) >= 1 else "",
|
| 657 |
-
"choices": input_channels_map_list,
|
| 658 |
-
"__type__": "update"
|
| 659 |
-
},
|
| 660 |
-
{
|
| 661 |
-
"value": output_channels_map_list[0] if len(output_channels_map_list) >= 1 else "",
|
| 662 |
-
"choices": output_channels_map_list,
|
| 663 |
-
"__type__": "update"
|
| 664 |
-
},
|
| 665 |
-
{
|
| 666 |
-
"value": output_channels_map_list[0] if len(output_channels_map_list) >= 1 else "",
|
| 667 |
-
"choices": output_channels_map_list,
|
| 668 |
-
"__type__": "update"
|
| 669 |
-
}
|
| 670 |
-
]
|
| 671 |
-
|
| 672 |
-
def resolve_sample_rate(input_device_id):
|
| 673 |
-
if configs.get("asio_enabled", False): return 48000
|
| 674 |
-
|
| 675 |
-
try:
|
| 676 |
-
device = sd.query_devices(input_device_id)
|
| 677 |
-
return int(device["default_samplerate"])
|
| 678 |
-
except Exception:
|
| 679 |
-
return 48000
|
| 680 |
-
|
| 681 |
-
def replace_punctuation(filename):
|
| 682 |
-
return re.sub(r"_+", "_", re.sub(r"[ \-|]+", "_", filename.translate(str.maketrans("", "", '()[],"\'{}<>?*:/\\')))).strip("_")
|
| 683 |
-
|
| 684 |
-
def replace_url(url):
|
| 685 |
-
return url.replace("/blob/", "/resolve/").replace("?download=true", "").strip()
|
| 686 |
-
|
| 687 |
-
def replace_modelname(modelname):
|
| 688 |
-
return replace_punctuation(
|
| 689 |
-
modelname.replace(".onnx", "").replace(".pth", "").replace(".index", "").replace(".zip", "")
|
| 690 |
-
)
|
| 691 |
-
|
| 692 |
-
def replace_export_format(audio_path, export_format = "wav"):
|
| 693 |
-
export_format = f".{export_format}"
|
| 694 |
-
|
| 695 |
-
return (
|
| 696 |
-
audio_path
|
| 697 |
-
if audio_path.endswith(export_format) else
|
| 698 |
-
audio_path.replace(f".{os.path.basename(audio_path).split('.')[-1]}", export_format)
|
| 699 |
-
)
|
| 700 |
-
|
| 701 |
-
def update_dropdowns_from_json(data):
|
| 702 |
-
if not data:
|
| 703 |
-
return [
|
| 704 |
-
gr.update(choices=[], value=None),
|
| 705 |
-
gr.update(choices=[], value=None),
|
| 706 |
-
gr.update(choices=[], value=None)
|
| 707 |
-
]
|
| 708 |
-
|
| 709 |
-
inputs = list(data.get("inputs", {}).keys())
|
| 710 |
-
outputs = list(data.get("outputs", {}).keys())
|
| 711 |
-
|
| 712 |
-
return [
|
| 713 |
-
gr.update(
|
| 714 |
-
choices=inputs,
|
| 715 |
-
value=inputs[0] if len(inputs) > 0 else None
|
| 716 |
-
),
|
| 717 |
-
gr.update(
|
| 718 |
-
choices=outputs,
|
| 719 |
-
value=outputs[0] if len(outputs) > 0 else None
|
| 720 |
-
),
|
| 721 |
-
gr.update(
|
| 722 |
-
choices=outputs,
|
| 723 |
-
value=outputs[0] if len(outputs) > 0 else None
|
| 724 |
-
),
|
| 725 |
-
]
|
| 726 |
-
|
| 727 |
-
def update_button_from_json(data):
|
| 728 |
-
if not data:
|
| 729 |
-
return [
|
| 730 |
-
gr.update(interactive=True),
|
| 731 |
-
gr.update(interactive=False)
|
| 732 |
-
]
|
| 733 |
-
|
| 734 |
-
return [
|
| 735 |
-
gr.update(interactive=data.get("start_button", True)),
|
| 736 |
-
gr.update(interactive=data.get("stop_button", False))
|
| 737 |
-
]
|
| 738 |
-
|
| 739 |
-
def update_value_from_json(data):
|
| 740 |
-
if not data:
|
| 741 |
-
return [
|
| 742 |
-
gr.update(),
|
| 743 |
-
gr.update(value=None)
|
| 744 |
-
]
|
| 745 |
-
|
| 746 |
-
return [
|
| 747 |
-
data.get("button", "Start"),
|
| 748 |
-
data.get("path", None),
|
| 749 |
-
]
|
| 750 |
-
|
| 751 |
-
def get_speakers_id_and_architecture(model):
|
| 752 |
-
model_path = os.path.join(configs["weights_path"], model) if not os.path.exists(model) else model
|
| 753 |
-
|
| 754 |
-
if not model or not os.path.exists(model_path) or os.path.isdir(model_path) or not model.endswith((".pth", ".onnx")):
|
| 755 |
-
return [
|
| 756 |
-
{
|
| 757 |
-
"visible": False if gradio_version else "hidden",
|
| 758 |
-
"value": 0,
|
| 759 |
-
"choices": [0],
|
| 760 |
-
"__type__": "update"
|
| 761 |
-
},
|
| 762 |
-
{
|
| 763 |
-
"visible": False if gradio_version else "hidden",
|
| 764 |
-
"value": 0.4,
|
| 765 |
-
"__type__": "update"
|
| 766 |
-
}
|
| 767 |
-
]
|
| 768 |
-
|
| 769 |
-
try:
|
| 770 |
-
if model_path.endswith(".pth"):
|
| 771 |
-
model_data = torch.load(model_path, map_location="cpu", weights_only=True)
|
| 772 |
-
else:
|
| 773 |
-
import onnx
|
| 774 |
-
|
| 775 |
-
model_data = None
|
| 776 |
-
for prop in onnx.load(model_path).metadata_props:
|
| 777 |
-
if prop.key == "model_info":
|
| 778 |
-
model_data = json.loads(prop.value)
|
| 779 |
-
break
|
| 780 |
-
|
| 781 |
-
speakers_id = model_data.get("speakers_id", 1)
|
| 782 |
-
speakers_id_visible = speakers_id and speakers_id != 1
|
| 783 |
-
noise_scale_visible = model_data.get("architecture", "RVC") == "SVC"
|
| 784 |
-
|
| 785 |
-
return [
|
| 786 |
-
{
|
| 787 |
-
"visible": speakers_id_visible if gradio_version else (speakers_id_visible or "hidden"),
|
| 788 |
-
"value": 0,
|
| 789 |
-
"choices": list(range(speakers_id)),
|
| 790 |
-
"__type__": "update"
|
| 791 |
-
},
|
| 792 |
-
{
|
| 793 |
-
"visible": noise_scale_visible if gradio_version else (noise_scale_visible or "hidden"),
|
| 794 |
-
"value": 0.4,
|
| 795 |
-
"__type__": "update"
|
| 796 |
-
}
|
| 797 |
-
]
|
| 798 |
-
except Exception:
|
| 799 |
-
return [
|
| 800 |
-
{
|
| 801 |
-
"visible": False if gradio_version else "hidden",
|
| 802 |
-
"value": 0,
|
| 803 |
-
"choices": [0],
|
| 804 |
-
"__type__": "update"
|
| 805 |
-
},
|
| 806 |
-
{
|
| 807 |
-
"visible": False if gradio_version else "hidden",
|
| 808 |
-
"value": 0.4,
|
| 809 |
-
"__type__": "update"
|
| 810 |
-
}
|
| 811 |
-
]
|
| 812 |
-
|
| 813 |
-
def run_commands(cmd):
|
| 814 |
-
os.system(cmd)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/core/utils.py
DELETED
|
@@ -1,123 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import time
|
| 4 |
-
import json
|
| 5 |
-
import signal
|
| 6 |
-
import codecs
|
| 7 |
-
import requests
|
| 8 |
-
import subprocess
|
| 9 |
-
|
| 10 |
-
sys.path.append(os.getcwd())
|
| 11 |
-
|
| 12 |
-
from main.app.core.ui import gr_info, gr_warning
|
| 13 |
-
from main.app.variables import translations, configs
|
| 14 |
-
|
| 15 |
-
def alive(pid):
|
| 16 |
-
try:
|
| 17 |
-
if sys.platform == "win32":
|
| 18 |
-
subprocess.check_output(["tasklist", "/FI", f"PID eq {pid}"], stderr=subprocess.DEVNULL)
|
| 19 |
-
return True
|
| 20 |
-
else:
|
| 21 |
-
os.kill(pid, 0)
|
| 22 |
-
return True
|
| 23 |
-
except:
|
| 24 |
-
return False
|
| 25 |
-
|
| 26 |
-
def pid_kill(pid):
|
| 27 |
-
if not alive(pid): return True
|
| 28 |
-
|
| 29 |
-
try:
|
| 30 |
-
if sys.platform == "win32": subprocess.run(["taskkill", "/PID", str(pid), "/T"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
| 31 |
-
else: os.kill(pid, signal.SIGINT)
|
| 32 |
-
except:
|
| 33 |
-
pass
|
| 34 |
-
|
| 35 |
-
for _ in range(15):
|
| 36 |
-
if not alive(pid): return True
|
| 37 |
-
time.sleep(0.1)
|
| 38 |
-
|
| 39 |
-
try:
|
| 40 |
-
if sys.platform == "win32": subprocess.run(["taskkill", "/PID", str(pid), "/F", "/T"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
| 41 |
-
else: os.kill(pid, signal.SIGKILL)
|
| 42 |
-
except:
|
| 43 |
-
pass
|
| 44 |
-
|
| 45 |
-
for _ in range(10):
|
| 46 |
-
if not alive(pid): return True
|
| 47 |
-
time.sleep(0.1)
|
| 48 |
-
|
| 49 |
-
return False
|
| 50 |
-
|
| 51 |
-
def stop_pid(
|
| 52 |
-
pid_file,
|
| 53 |
-
model_name=None,
|
| 54 |
-
train=False
|
| 55 |
-
):
|
| 56 |
-
try:
|
| 57 |
-
pid_file_path = os.path.join(
|
| 58 |
-
"assets", f"{pid_file}.txt"
|
| 59 |
-
) if model_name is None else os.path.join(
|
| 60 |
-
configs["logs_path"], model_name, f"{pid_file}.txt"
|
| 61 |
-
)
|
| 62 |
-
|
| 63 |
-
if not os.path.exists(pid_file_path): return gr_warning(translations["not_found_pid"])
|
| 64 |
-
else:
|
| 65 |
-
with open(pid_file_path, "r") as pid_file:
|
| 66 |
-
pids = [int(pid) for pid in pid_file.readlines()]
|
| 67 |
-
|
| 68 |
-
for pid in pids:
|
| 69 |
-
pid_kill(pid)
|
| 70 |
-
|
| 71 |
-
if os.path.exists(pid_file_path): os.remove(pid_file_path)
|
| 72 |
-
|
| 73 |
-
pid_file_path = os.path.join(configs["logs_path"], model_name, "config.json")
|
| 74 |
-
|
| 75 |
-
if train and os.path.exists(pid_file_path):
|
| 76 |
-
with open(pid_file_path, "r") as pid_file:
|
| 77 |
-
pid_data = json.load(pid_file)
|
| 78 |
-
pids = pid_data.get("process_pids", [])
|
| 79 |
-
|
| 80 |
-
with open(pid_file_path, "w") as pid_file:
|
| 81 |
-
pid_data.pop("process_pids", None)
|
| 82 |
-
|
| 83 |
-
json.dump(pid_data, pid_file, indent=4)
|
| 84 |
-
|
| 85 |
-
for pid in pids:
|
| 86 |
-
pid_kill(pid)
|
| 87 |
-
|
| 88 |
-
gr_info(translations["end_pid"])
|
| 89 |
-
except:
|
| 90 |
-
pass
|
| 91 |
-
|
| 92 |
-
def google_translate(text, source='auto', target='vi'):
|
| 93 |
-
if text == "": return gr_warning(translations["prompt_warning"])
|
| 94 |
-
|
| 95 |
-
try:
|
| 96 |
-
import textwrap
|
| 97 |
-
|
| 98 |
-
def translate_chunk(chunk):
|
| 99 |
-
response = requests.get(
|
| 100 |
-
codecs.decode("uggcf://genafyngr.tbbtyrncvf.pbz/genafyngr_n/fvatyr", "rot13"),
|
| 101 |
-
params={
|
| 102 |
-
'client': 'gtx',
|
| 103 |
-
'sl': source,
|
| 104 |
-
'tl': target,
|
| 105 |
-
'dt': 't',
|
| 106 |
-
'q': chunk
|
| 107 |
-
}
|
| 108 |
-
)
|
| 109 |
-
|
| 110 |
-
return ''.join([i[0] for i in response.json()[0]]) if response.status_code == 200 else chunk
|
| 111 |
-
|
| 112 |
-
translated_text = ''
|
| 113 |
-
for chunk in textwrap.wrap(
|
| 114 |
-
text,
|
| 115 |
-
5000,
|
| 116 |
-
break_long_words=False,
|
| 117 |
-
break_on_hyphens=False
|
| 118 |
-
):
|
| 119 |
-
translated_text += translate_chunk(chunk)
|
| 120 |
-
|
| 121 |
-
return translated_text
|
| 122 |
-
except:
|
| 123 |
-
return text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/install.py
DELETED
|
@@ -1,205 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import subprocess
|
| 4 |
-
|
| 5 |
-
sys.path.append(os.getcwd())
|
| 6 |
-
|
| 7 |
-
os.makedirs(os.path.join("assets", ".uv"), exist_ok=True)
|
| 8 |
-
os.environ["UV_CACHE_DIR"] = os.path.join("assets", ".uv")
|
| 9 |
-
|
| 10 |
-
python_dir = os.path.join("runtime", "python.exe")
|
| 11 |
-
|
| 12 |
-
def run_command(command):
|
| 13 |
-
try:
|
| 14 |
-
subprocess.run(command, shell=True, check=True)
|
| 15 |
-
except subprocess.CalledProcessError as e:
|
| 16 |
-
print(f"Lỗi khi thực thi lệnh: {e}")
|
| 17 |
-
|
| 18 |
-
def install_dependencies():
|
| 19 |
-
print("Cài đặt các thư viện cơ bản...")
|
| 20 |
-
|
| 21 |
-
run_command(f"{python_dir} -m pip install uv")
|
| 22 |
-
run_command(f"{python_dir} -m uv pip install six packaging python-dateutil platformdirs pywin32 wget")
|
| 23 |
-
|
| 24 |
-
def install_ffmpeg():
|
| 25 |
-
if not os.path.exists("ffmpeg.exe"):
|
| 26 |
-
print("Cài đặt ffmpeg...")
|
| 27 |
-
run_command('curl -L -o ffmpeg.exe https://huggingface.co/AnhP/Vietnamese-RVC-Project/resolve/main/ffmpeg/ffmpeg.exe')
|
| 28 |
-
|
| 29 |
-
if not os.path.exists("ffprobe.exe"):
|
| 30 |
-
print("Cài đặt ffprobe...")
|
| 31 |
-
run_command('curl -L -o ffprobe.exe https://huggingface.co/AnhP/Vietnamese-RVC-Project/resolve/main/ffmpeg/ffprobe.exe')
|
| 32 |
-
|
| 33 |
-
def remove_onnxruntime():
|
| 34 |
-
if not os.path.exists("requirements.txt"): return
|
| 35 |
-
|
| 36 |
-
with open("requirements.txt", "r", encoding="utf-8") as f:
|
| 37 |
-
lines = f.readlines()
|
| 38 |
-
|
| 39 |
-
with open("requirements.txt", "w", encoding="utf-8") as f:
|
| 40 |
-
f.writelines(l for l in lines if "onnxruntime" not in l)
|
| 41 |
-
|
| 42 |
-
def install_cpu():
|
| 43 |
-
install_dependencies()
|
| 44 |
-
remove_onnxruntime()
|
| 45 |
-
|
| 46 |
-
print("Cài đặt các gói thư viện cpu...")
|
| 47 |
-
|
| 48 |
-
run_command(f"{python_dir} -m uv pip install torch torchaudio torchvision --index-url https://download.pytorch.org/whl/cpu")
|
| 49 |
-
run_command(f"{python_dir} -m uv pip install onnxruntime")
|
| 50 |
-
run_command(f"{python_dir} -m uv pip install -r requirements.txt")
|
| 51 |
-
|
| 52 |
-
def install_cuda(version = "cu118"):
|
| 53 |
-
install_dependencies()
|
| 54 |
-
remove_onnxruntime()
|
| 55 |
-
|
| 56 |
-
print("Cài đặt các gói thư viện cuda...")
|
| 57 |
-
|
| 58 |
-
if version in ("cu118", "cu121"): run_command(f"{python_dir} -m uv pip install numpy==1.26.4 numba==0.61.0")
|
| 59 |
-
run_command(f"{python_dir} -m uv pip install torch torchaudio torchvision --index-url https://download.pytorch.org/whl/{version}")
|
| 60 |
-
run_command(f"{python_dir} -m uv pip install onnxruntime-gpu" + ("==1.20.1" if version in ("cu118", "cu121") else ""))
|
| 61 |
-
run_command(f"{python_dir} -m uv pip install -r requirements.txt")
|
| 62 |
-
if version in ("cu128", "cu130"): run_command(f"{python_dir} -m uv pip install faiss-cpu==1.13.2")
|
| 63 |
-
|
| 64 |
-
def install_directml():
|
| 65 |
-
install_dependencies()
|
| 66 |
-
remove_onnxruntime()
|
| 67 |
-
|
| 68 |
-
print("Cài đặt các gói thư viện directml...")
|
| 69 |
-
|
| 70 |
-
run_command(f"{python_dir} -m uv pip install numpy==1.26.4 numba==0.61.0")
|
| 71 |
-
run_command(f"{python_dir} -m uv pip install torch==2.4.1 torchaudio==2.4.1 torchvision")
|
| 72 |
-
run_command(f"{python_dir} -m uv pip install torch-directml==0.2.5.dev240914")
|
| 73 |
-
run_command(f"{python_dir} -m uv pip install onnxruntime-directml")
|
| 74 |
-
run_command(f"{python_dir} -m uv pip install -r requirements.txt")
|
| 75 |
-
|
| 76 |
-
def install_opencl():
|
| 77 |
-
install_dependencies()
|
| 78 |
-
remove_onnxruntime()
|
| 79 |
-
|
| 80 |
-
print("Cài đặt các gói thư viện opencl...")
|
| 81 |
-
|
| 82 |
-
run_command(f"{python_dir} -m uv pip install numpy==1.26.4 numba==0.61.0")
|
| 83 |
-
run_command(f"{python_dir} -m uv pip install torch==2.6.0 torchaudio==2.6.0 torchvision")
|
| 84 |
-
run_command(f"{python_dir} -m uv pip install https://github.com/artyom-beilis/pytorch_dlprim/releases/download/0.2.0/pytorch_ocl-0.2.0+torch2.6-cp311-none-win_amd64.whl")
|
| 85 |
-
run_command(f"{python_dir} -m uv pip install onnxruntime-directml")
|
| 86 |
-
run_command(f"{python_dir} -m uv pip install -r requirements.txt")
|
| 87 |
-
|
| 88 |
-
def install_xpu(provider = "openvino"):
|
| 89 |
-
install_dependencies()
|
| 90 |
-
remove_onnxruntime()
|
| 91 |
-
|
| 92 |
-
print("Cài đặt các gói thư viện xpu...")
|
| 93 |
-
|
| 94 |
-
run_command(f"{python_dir} -m uv pip install torch torchaudio torchvision --index-url https://download.pytorch.org/whl/xpu")
|
| 95 |
-
run_command(f"{python_dir} -m uv pip install openvino==2025.4.1")
|
| 96 |
-
run_command(f"{python_dir} -m uv pip install triton-windows")
|
| 97 |
-
run_command(f"{python_dir} -m uv pip install " + ("onnxruntime-openvino==1.24.1" if provider == "openvino" else "onnxruntime-directml"))
|
| 98 |
-
run_command(f"{python_dir} -m uv pip install -r requirements.txt")
|
| 99 |
-
run_command(f"{python_dir} -m uv pip install faiss-cpu==1.13.2")
|
| 100 |
-
|
| 101 |
-
def install_requirements():
|
| 102 |
-
print("Các phiên bản Backend: \n - 1. CPU (Đối với CPU) / 2. CUDA (Đối với GPU NVIDIA) / 3. DIRECTML (Đối với GPU NVIDIA / AMD / INTEL) / 4. OPENCL (Đối với GPU AMD) / 5. XPU (Đối với GPU INTEL)")
|
| 103 |
-
|
| 104 |
-
while 1:
|
| 105 |
-
selected = str(input("Hãy chọn phiên bản Backend (Nhập 1-5): ")).strip().upper()
|
| 106 |
-
|
| 107 |
-
if selected in ("1", "CPU"):
|
| 108 |
-
print("Cài đặt dành cho CPU...")
|
| 109 |
-
install_cpu()
|
| 110 |
-
break
|
| 111 |
-
elif selected in ("2", "CUDA"):
|
| 112 |
-
print("Cài đặt dành cho CUDA...")
|
| 113 |
-
print("Các phiên b��n CUDA: \n Lưu ý: Hãy chọn đúng phiên bản nếu như chọn sai có thể gây ra lỗi suy luận hoặc huấn luyện. \n - 1. Phiên bản 118 dành cho các GPU GTX 10-Series trở lên. \n - 2. Phiên bản 121 dành cho các GPU RTX 20-Series đến 30-Series trở lên. \n - 3. Phiên bản 128 dành cho các GPU RTX 30-Series đến RTX 40-Series trở lên. \n - 4. Phiên bản 130 dành cho các GPU RTX 50-Series trở lên.")
|
| 114 |
-
|
| 115 |
-
cuda_selected = None
|
| 116 |
-
|
| 117 |
-
while 1:
|
| 118 |
-
cuda_selected = str(input("Hãy chọn phiên bản CUDA (Nhập 1-4): ")).strip().upper()
|
| 119 |
-
|
| 120 |
-
if cuda_selected in ("1", "118"):
|
| 121 |
-
install_cuda("cu118")
|
| 122 |
-
break
|
| 123 |
-
elif cuda_selected in ("2", "121"):
|
| 124 |
-
install_cuda("cu121")
|
| 125 |
-
break
|
| 126 |
-
elif cuda_selected in ("3", "128"):
|
| 127 |
-
install_cuda("cu128")
|
| 128 |
-
break
|
| 129 |
-
elif cuda_selected in ("4", "130"):
|
| 130 |
-
install_cuda("cu130")
|
| 131 |
-
break
|
| 132 |
-
else:
|
| 133 |
-
print("Vui lòng chọn phiên bản CUDA hợp lệ!")
|
| 134 |
-
|
| 135 |
-
if cuda_selected in ("cu128", "cu130"):
|
| 136 |
-
print("Cài đặt gói phụ thuộc TensorRT (Cực Kỳ Không Khuyên Dùng)")
|
| 137 |
-
|
| 138 |
-
while 1:
|
| 139 |
-
tensorrt_selected = str(input("Bạn có muốn sử dụng TensorRT không (Y/N): ")).strip().upper()
|
| 140 |
-
|
| 141 |
-
if tensorrt_selected in ("Y", "YES"):
|
| 142 |
-
run_command(f"{python_dir} -m uv pip install tensorrt")
|
| 143 |
-
break
|
| 144 |
-
elif tensorrt_selected in ("N", "NO"):
|
| 145 |
-
break
|
| 146 |
-
else:
|
| 147 |
-
print("Vui lòng chọn giá trị hợp lệ!")
|
| 148 |
-
|
| 149 |
-
print("Cài đặt gói phụ thuộc Triton (Không Khuyên Dùng)")
|
| 150 |
-
|
| 151 |
-
while 1:
|
| 152 |
-
triton_selected = str(input("Bạn có muốn sử dụng Triton không (Y/N): ")).strip().upper()
|
| 153 |
-
|
| 154 |
-
if triton_selected in ("Y", "YES"):
|
| 155 |
-
run_command(f"{python_dir} -m uv pip install triton-windows")
|
| 156 |
-
break
|
| 157 |
-
elif triton_selected in ("N", "NO"):
|
| 158 |
-
break
|
| 159 |
-
else:
|
| 160 |
-
print("Vui lòng chọn giá trị hợp lệ!")
|
| 161 |
-
|
| 162 |
-
break
|
| 163 |
-
elif selected in ("3", "DIRECTML"):
|
| 164 |
-
print("Cài đặt dành cho DIRECTML...")
|
| 165 |
-
install_directml()
|
| 166 |
-
break
|
| 167 |
-
elif selected in ("4", "OPENCL"):
|
| 168 |
-
print("Cài đặt dành cho OPENCL...")
|
| 169 |
-
install_opencl()
|
| 170 |
-
break
|
| 171 |
-
elif selected in ("5", "XPU"):
|
| 172 |
-
print("Cài đặt dành cho XPU...")
|
| 173 |
-
print("Phiên bản ONNXRUNTIME: 1. DIRECTML (Sử dụng trên mọi GPU) / 2. OPENVINO (Chỉ Intel GPU và tối ưu nhất)")
|
| 174 |
-
|
| 175 |
-
while 1:
|
| 176 |
-
provider_selected = str(input("Hãy chọn phiên bản ONNXRUNTIME (1-2): ")).strip().upper()
|
| 177 |
-
|
| 178 |
-
if provider_selected in ("1", "DIRECTML"):
|
| 179 |
-
install_xpu("directml")
|
| 180 |
-
break
|
| 181 |
-
elif provider_selected in ("2", "OPENVINO"):
|
| 182 |
-
install_xpu("openvino")
|
| 183 |
-
break
|
| 184 |
-
else:
|
| 185 |
-
print("Vui lòng chọn giá trị hợp lệ!")
|
| 186 |
-
|
| 187 |
-
break
|
| 188 |
-
else:
|
| 189 |
-
print("Vui lòng chọn phiên bản hợp lệ!")
|
| 190 |
-
|
| 191 |
-
print("Hoàn tất quá trình cài đặt thư viện!")
|
| 192 |
-
|
| 193 |
-
if __name__ == "__main__":
|
| 194 |
-
if not os.path.exists(python_dir):
|
| 195 |
-
print("Không tìm thấy thời gian chạy python!")
|
| 196 |
-
sys.exit()
|
| 197 |
-
|
| 198 |
-
if sys.platform != "win32":
|
| 199 |
-
print("Chỉ hỗ trợ trên Windows!")
|
| 200 |
-
sys.exit()
|
| 201 |
-
|
| 202 |
-
print("Lưu Ý: Hãy cài các phần phụ trợ bên ngoài được đề cập trong phần README.md trước khi tiếp tục!")
|
| 203 |
-
|
| 204 |
-
install_requirements()
|
| 205 |
-
install_ffmpeg()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/parser.py
DELETED
|
@@ -1,407 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
sys.path.append(os.getcwd())
|
| 5 |
-
|
| 6 |
-
try:
|
| 7 |
-
argv = sys.argv[1]
|
| 8 |
-
except IndexError:
|
| 9 |
-
argv = None
|
| 10 |
-
|
| 11 |
-
argv_help_is_allows = [
|
| 12 |
-
"--help_audio_effects",
|
| 13 |
-
"--help_convert",
|
| 14 |
-
"--help_create_dataset",
|
| 15 |
-
"--help_create_index",
|
| 16 |
-
"--help_extract",
|
| 17 |
-
"--help_preprocess",
|
| 18 |
-
"--help_separate_music",
|
| 19 |
-
"--help_train",
|
| 20 |
-
"--help_create_reference",
|
| 21 |
-
"--help"
|
| 22 |
-
]
|
| 23 |
-
|
| 24 |
-
COMMANDS = {
|
| 25 |
-
"--audio_effects": "main.inference.audio_effects",
|
| 26 |
-
"--convert": "main.inference.conversion.convert",
|
| 27 |
-
"--create_dataset": "main.inference.create_dataset",
|
| 28 |
-
"--create_index": "main.inference.create_index",
|
| 29 |
-
"--extract": "main.inference.extracting.extract",
|
| 30 |
-
"--preprocess": "main.inference.preprocess.preprocess",
|
| 31 |
-
"--separate_music": "main.inference.separate_music",
|
| 32 |
-
"--train": "main.inference.training.train",
|
| 33 |
-
"--create_reference": "main.inference.create_reference",
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
if argv is None or argv not in list(COMMANDS) and "--help" not in argv:
|
| 37 |
-
print("Cú pháp không hợp lệ! Sử dụng --help để biết thêm")
|
| 38 |
-
sys.exit()
|
| 39 |
-
|
| 40 |
-
if argv_help_is_allows[0] == argv:
|
| 41 |
-
print("""Các tham số của `--audio_effects`:
|
| 42 |
-
1. Đường dẫn tệp:
|
| 43 |
-
- `--input_path` (bắt buộc): Đường dẫn đến tệp âm thanh đầu vào.
|
| 44 |
-
- `--output_path` (mặc định: `./audios/apply_effects.wav`): Đường dẫn lưu tệp đầu ra.
|
| 45 |
-
- `--export_format` (mặc định: `wav`): Định dạng xuất tệp (`wav`, `mp3`, ...).
|
| 46 |
-
|
| 47 |
-
2. Lấy mẫu lại:
|
| 48 |
-
- `--resample` (mặc định: `False`): Có lấy mẫu lại hay không.
|
| 49 |
-
- `--resample_sr` (mặc định: `0`): Tần số lấy mẫu mới (Hz).
|
| 50 |
-
|
| 51 |
-
3. Chorus:
|
| 52 |
-
- `--chorus`: Bật/tắt chorus.
|
| 53 |
-
- `--chorus_depth`, `--chorus_rate`, `--chorus_mix`, `--chorus_delay`, `--chorus_feedback`: Các thông số điều chỉnh chorus.
|
| 54 |
-
|
| 55 |
-
4. Distortion:
|
| 56 |
-
- `--distortion`: Bật/tắt distortion.
|
| 57 |
-
- `--drive_db`: Mức độ méo âm thanh.
|
| 58 |
-
|
| 59 |
-
5. Reverb:
|
| 60 |
-
- `--reverb`: Bật/tắt hồi âm.
|
| 61 |
-
- `--reverb_room_size`, `--reverb_damping`, `--reverb_wet_level`, `--reverb_dry_level`, `--reverb_width`, `--reverb_freeze_mode`: Điều chỉnh hồi âm.
|
| 62 |
-
|
| 63 |
-
6. Pitchshift:
|
| 64 |
-
- `--pitchshift`: Bật/tắt thay đổi cao độ.
|
| 65 |
-
- `--pitch_shift`: Giá trị dịch cao độ.
|
| 66 |
-
|
| 67 |
-
7. Delay:
|
| 68 |
-
- `--delay`: Bật/tắt delay.
|
| 69 |
-
- `--delay_seconds`, `--delay_feedback`, `--delay_mix`: Điều chỉnh thời gian trễ, phản hồi và hòa trộn.
|
| 70 |
-
|
| 71 |
-
8. Compressor:
|
| 72 |
-
- `--compressor`: Bật/tắt compressor.
|
| 73 |
-
- `--compressor_threshold`, `--compressor_ratio`, `--compressor_attack_ms`, `--compressor_release_ms`: Các thông số nén.
|
| 74 |
-
|
| 75 |
-
9. Limiter:
|
| 76 |
-
- `--limiter`: Bật/tắt giới hạn mức âm thanh.
|
| 77 |
-
- `--limiter_threshold`, `--limiter_release`: Ngưỡng giới hạn và thời gian nhả.
|
| 78 |
-
|
| 79 |
-
10. Gain (Khuếch đại):
|
| 80 |
-
- `--gain`: Bật/tắt gain.
|
| 81 |
-
- `--gain_db`: Mức gain (dB).
|
| 82 |
-
|
| 83 |
-
11. Bitcrush:
|
| 84 |
-
- `--bitcrush`: Bật/tắt hiệu ứng giảm độ phân giải.
|
| 85 |
-
- `--bitcrush_bit_depth`: Số bit của bitcrush.
|
| 86 |
-
|
| 87 |
-
12. Clipping:
|
| 88 |
-
- `--clipping`: Bật/tắt cắt âm thanh.
|
| 89 |
-
- `--clipping_threshold`: Ngưỡng clipping.
|
| 90 |
-
|
| 91 |
-
13. Phaser:
|
| 92 |
-
- `--phaser`: Bật/tắt hiệu ứng phaser.
|
| 93 |
-
- `--phaser_rate_hz`, `--phaser_depth`, `--phaser_centre_frequency_hz`, `--phaser_feedback`, `--phaser_mix`: Điều chỉnh hiệu ứng phaser.
|
| 94 |
-
|
| 95 |
-
14. Boost bass & treble:
|
| 96 |
-
- `--treble_bass_boost`: Bật/tắt tăng cường âm bass và treble.
|
| 97 |
-
- `--bass_boost_db`, `--bass_boost_frequency`, `--treble_boost_db`, `--treble_boost_frequency`: Các thông số tăng bass và treble.
|
| 98 |
-
|
| 99 |
-
15. Fade in & fade out:
|
| 100 |
-
- `--fade_in_out`: Bật/tắt hiệu ứng fade.
|
| 101 |
-
- `--fade_in_duration`, `--fade_out_duration`: Thời gian fade vào/ra.
|
| 102 |
-
|
| 103 |
-
16. Kết hợp âm thanh:
|
| 104 |
-
- `--audio_combination`: Bật/tắt ghép nhiều tệp âm thanh.
|
| 105 |
-
- `--audio_combination_input`: Đường dẫn tệp âm thanh bổ sung.
|
| 106 |
-
- `--main_volume`: Âm lượng của âm thanh chính.
|
| 107 |
-
- `--combination_volume`:: Âm lượng của âm thanh cần kết hợp.
|
| 108 |
-
""")
|
| 109 |
-
sys.exit()
|
| 110 |
-
elif argv_help_is_allows[1] == argv:
|
| 111 |
-
print("""Các tham số của --convert:
|
| 112 |
-
1. Cấu hình xử lí giọng nói:
|
| 113 |
-
- `--pitch` (mặc định: `0`): Điều chỉnh cao độ.
|
| 114 |
-
- `--filter_radius` (mặc định: `3`): Độ mượt của đường F0.
|
| 115 |
-
- `--index_rate` (mặc định: `0.5`): Tỷ lệ sử dụng chỉ mục giọng nói.
|
| 116 |
-
- `--rms_mix_rate` (mặc định: `1`): Hệ số điều chỉnh biên độ âm lượng.
|
| 117 |
-
- `--protect` (mặc định: `0.33`): Bảo vệ phụ âm.
|
| 118 |
-
- `--hop_length` (mặc định: `64`): Bước nhảy khi xử lí âm thanh.
|
| 119 |
-
- `--sid` (mặc định: `0`): Mã số nhận dạng giọng nói đối với mô hình đa giọng.
|
| 120 |
-
- `--noise_scale` (mặc định: `0.35`): Tùy chỉnh đặc biệt cho mô hình SVC gây ảnh hưởng trực tiếp đến chất lượng của âm thanh, bạn không nên điều chỉnh nó.
|
| 121 |
-
|
| 122 |
-
2. Cấu hình F0:
|
| 123 |
-
- `--f0_method` (mặc định: `rmvpe`): Phương pháp dự đoán F0 (`pm-ac`, `pm-cc`, `pm-shs`, `dio`, `dio-stonemask`, `mangio-crepe-tiny`, `mangio-crepe-small`, `mangio-crepe-medium`, `mangio-crepe-large`, `mangio-crepe-full`, `crepe-tiny`, `crepe-small`, `crepe-medium`, `crepe-large`, `crepe-full`, `fcpe`, `fcpe-legacy`, `fcpe-previous`, `rmvpe`, `rmvpe-medfilt`, `rmvpe-mix`, `rmvpe-mix-medfilt`, `hpa-rmvpe`, `hpa-rmvpe-medfilt`, `hpa-rmvpe-previous`, `hpa-rmvpe-previous-medfilt`, `harvest`, `harvest-stonemask`, `yin`, `pyin`, `swipe`, `swipe-stonemask`, `piptrack`, `penn`, `mangio-penn`, `djcm`, `djcm-medfilt`, `djcm-svs`, `djcm-svs-medfilt`, `swift`, `pesto`).
|
| 124 |
-
- `--f0_autotune` (mặc định: `False`): Có tự động điều chỉnh F0 hay không.
|
| 125 |
-
- `--f0_autotune_strength` (mặc định: `1`): Cường độ hiệu chỉnh tự động F0.
|
| 126 |
-
- `--f0_file` (mặc định: ``): Đường dẫn tệp F0 có sẵn.
|
| 127 |
-
- `--predictor_onnx` (mặc định: `False`): Có sử dụng chế độ tăng tốc bằng ONNX của trích xuất cao độ hay không.
|
| 128 |
-
- `--proposal_pitch` (mặc định: `False`): Đề xuất cao độ thay vì điều chỉnh thủ công.
|
| 129 |
-
- `--proposal_pitch_threshold` (mặc định: `0.0`): Ngưỡng tần số ước tính cao độ.
|
| 130 |
-
- `--alpha` (mặc định: `0.5`): Ngưỡng trộn cao độ khi ước tính cao độ hybrid.
|
| 131 |
-
|
| 132 |
-
3. Mô hình nhúng:
|
| 133 |
-
- `--embedder_model` (mặc định: `hubert_base`): Mô hình nhúng sử dụng.
|
| 134 |
-
- `--embedders_mode` (mặc định: `fairseq`): Chế độ nhúng (`fairseq`, `transformers`, `onnx`, `whisper`).
|
| 135 |
-
- `--embedders_mix` (mặc định: `False`): Hòa trộn tầng.
|
| 136 |
-
- `--embedders_mix_layers` (mặc định: `9`): Tầng hòa trộn.
|
| 137 |
-
- `--embedders_mix_ratio` (mặc định: `0.5`): Tỉ lệ hòa trộn.
|
| 138 |
-
|
| 139 |
-
4. Đường dẫn tệp:
|
| 140 |
-
- `--input_path` (bắt buộc): Đường dẫn tệp âm thanh đầu vào.
|
| 141 |
-
- `--output_path` (mặc định: `./audios/output.wav`): Đường dẫn lưu tệp đầu ra.
|
| 142 |
-
- `--export_format` (mặc định: `wav`): Định dạng xuất tệp.
|
| 143 |
-
- `--pth_path` (bắt buộc): Đường dẫn đến tệp mô hình `.pth`.
|
| 144 |
-
- `--index_path` (mặc định: `None`): Đường dẫn tệp chỉ mục (nếu có).
|
| 145 |
-
|
| 146 |
-
5. Làm sạch âm thanh:
|
| 147 |
-
- `--clean_audio` (mặc định: `False`): Có áp dụng làm sạch âm thanh không.
|
| 148 |
-
- `--clean_strength` (mặc định: `0.7`): Mức độ làm sạch.
|
| 149 |
-
|
| 150 |
-
6. Resampling & chia nhỏ âm thanh:
|
| 151 |
-
- `--resample_sr` (mặc định: `0`): Tần số lấy mẫu mới (0 nghĩa là giữ nguyên).
|
| 152 |
-
- `--split_audio` (mặc định: `False`): Có chia nhỏ audio trước khi xử lí không.
|
| 153 |
-
|
| 154 |
-
7. Kiểm tra & tối ưu hóa:
|
| 155 |
-
- `--checkpointing` (mặc định: `False`): Bật/tắt checkpointing để tiết kiệm RAM.
|
| 156 |
-
|
| 157 |
-
8. Dịch formant:
|
| 158 |
-
- `--formant_shifting` (mặc định: `False`): Có bật hiệu ứng dịch formant không.
|
| 159 |
-
- `--formant_qfrency` (mặc định: `0.8`): Hệ số dịch formant theo tần số.
|
| 160 |
-
- `--formant_timbre` (mặc định: `0.8`): Hệ số thay đổi màu sắc giọng.
|
| 161 |
-
""")
|
| 162 |
-
sys.exit()
|
| 163 |
-
elif argv_help_is_allows[2] == argv:
|
| 164 |
-
print("""Các tham số của --create_dataset:
|
| 165 |
-
1. Đường dẫn & cấu hình dataset:
|
| 166 |
-
- `--input_data` (bắt buộc): Đường dẫn liên kết đến âm thanh (Liên kết Youtube, có thể dùng dấu `,` để dùng nhiều liên kết).
|
| 167 |
-
- `--output_dirs` (mặc định: `./dataset`): Thư mục xuất dữ liệu đầu ra.
|
| 168 |
-
- `--sample_rate` (mặc định: `48000`): Tần số lấy mẫu cho âm thanh.
|
| 169 |
-
|
| 170 |
-
2. Làm sạch dữ liệu:
|
| 171 |
-
- `--clean_dataset` (mặc định: `False`): Có áp dụng làm sạch dữ liệu hay không.
|
| 172 |
-
- `--clean_strength` (mặc định: `0.7`): Mức độ làm sạch dữ liệu.
|
| 173 |
-
|
| 174 |
-
3. Tách giọng & hiệu ứng:
|
| 175 |
-
- `--separate` (mặc định: `True`): có tách nhạc hay không.
|
| 176 |
-
- `--separator_reverb` (mặc định: `False`): Có tách vang giọng không.
|
| 177 |
-
- `--model_name` (mặc định: `MDXNET_Main`): Mô hình tách nhạc ('Main_340', 'Main_390', 'Main_406', 'Main_427', 'Main_438', 'Inst_full_292', 'Inst_HQ_1', 'Inst_HQ_2', 'Inst_HQ_3', 'Inst_HQ_4', 'Inst_HQ_5', 'Kim_Vocal_1', 'Kim_Vocal_2', 'Kim_Inst', 'Inst_187_beta', 'Inst_82_beta', 'Inst_90_beta', 'Voc_FT', 'Crowd_HQ', 'MDXNET_9482', 'Inst_1', 'Inst_2', 'Inst_3', 'MDXNET_1_9703', 'MDXNET_2_9682', 'MDXNET_3_9662', 'Inst_Main', 'MDXNET_Main', 'HT-Tuned', 'HT-Normal', 'HD_MMI', 'HT_6S', 'HP-1', 'HP-2', 'HP-Vocal-1', 'HP-Vocal-2', 'HP2-1', 'HP2-2', 'HP2-3', 'SP-2B-1', 'SP-2B-2', 'SP-3B-1', 'SP-4B-1', 'SP-4B-2', 'SP-MID-1', 'SP-MID-2').
|
| 178 |
-
- `--reverb_model` (mặc định: `MDX-Reverb`): Mô hình tách nhạc ("MDX-Reverb", 'VR-Reverb', 'Echo-Aggressive', 'Echo-Normal').
|
| 179 |
-
- `--denoise_model` (mặc định: `Normal`): Mô hình tách nhạc ('Lite', 'Normal').
|
| 180 |
-
|
| 181 |
-
4. Cấu hình xử lí âm thanh:
|
| 182 |
-
- `--shifts` (mặc định: `2`): Số lượng dự đoán.
|
| 183 |
-
- `--batch_size` (mặc định: `1`): Kích thước lô.
|
| 184 |
-
- `--overlap` (mặc định: `0.25`): Mức độ chồng lấn giữa các đoạn.
|
| 185 |
-
- `--aggression` (mặc định: `5`): Cường độ chiết xuất thân chính.
|
| 186 |
-
- `--hop_length` (mặc định: `1024`): Bước nhảy MDX khi xử lí.
|
| 187 |
-
- `--window_size` (mặc định: `512`): Kích thước cửa sổ.
|
| 188 |
-
- `--segments_size` (mặc định: `256`): Kích thước phân đoạn âm thanh.
|
| 189 |
-
- `--post_process_threshold` (mặc định: `0.2`): Mức độ xử lí hậu kỳ sau khi tách nhạc.
|
| 190 |
-
|
| 191 |
-
5. Cấu hình xử lí âm thanh khác:
|
| 192 |
-
- `--enable_tta` (mặc định: `False`): Tăng cường suy luận.
|
| 193 |
-
- `--enable_denoise` (mặc định: `False`): Khữ tách nhạc.
|
| 194 |
-
- `--high_end_process` (mặc định: `False`): Xử lí dải cao.
|
| 195 |
-
- `--enable_post_process` (mặc định: `False`): Hậu xử lí.
|
| 196 |
-
|
| 197 |
-
6. Bỏ qua phần âm thanh:
|
| 198 |
-
- `--skip_seconds` (mặc định: `False`): Có bỏ qua giây âm thanh nào không.
|
| 199 |
-
- `--skip_start_audios` (mặc định: `0`): Thời gian (giây) cần bỏ qua ở đầu audio.
|
| 200 |
-
- `--skip_end_audios` (mặc định: `0`): Thời gian (giây) cần bỏ qua ở cuối audio.
|
| 201 |
-
""")
|
| 202 |
-
sys.exit()
|
| 203 |
-
elif argv_help_is_allows[3] == argv:
|
| 204 |
-
print("""Các tham số của --create_index:
|
| 205 |
-
1. Thông tin mô hình:
|
| 206 |
-
- `--model_name` (bắt buộc): Tên mô hình.
|
| 207 |
-
- `--rvc_version` (mặc định: `v2`): Phiên bản (`v1`, `v2`).
|
| 208 |
-
- `--index_algorithm` (mặc định: `Auto`): Thuật toán index sử dụng (`Auto`, `Faiss`, `KMeans`).
|
| 209 |
-
""")
|
| 210 |
-
sys.exit()
|
| 211 |
-
elif argv_help_is_allows[4] == argv:
|
| 212 |
-
print("""Các tham số của --extract:
|
| 213 |
-
1. Thông tin mô hình:
|
| 214 |
-
- `--model_name` (bắt buộc): Tên mô hình.
|
| 215 |
-
- `--rvc_version` (mặc định: `v2`): Phiên bản mô hình (`v1`, `v2`).
|
| 216 |
-
|
| 217 |
-
2. Cấu hình F0:
|
| 218 |
-
- `--f0_method` (mặc định: `rmvpe`): Phương pháp dự đoán F0 (`pm-ac`, `pm-cc`, `pm-shs`, `dio`, `dio-stonemask`, `mangio-crepe-tiny`, `mangio-crepe-small`, `mangio-crepe-medium`, `mangio-crepe-large`, `mangio-crepe-full`, `crepe-tiny`, `crepe-small`, `crepe-medium`, `crepe-large`, `crepe-full`, `fcpe`, `fcpe-legacy`, `fcpe-previous`, `rmvpe`, `rmvpe-medfilt`, `rmvpe-mix`, `rmvpe-mix-medfilt`, `hpa-rmvpe`, `hpa-rmvpe-medfilt`, `hpa-rmvpe-previous`, `hpa-rmvpe-previous-medfilt`, `harvest`, `harvest-stonemask`, `yin`, `pyin`, `swipe`, `swipe-stonemask`, `piptrack`, `penn`, `mangio-penn`, `djcm`, `djcm-medfilt`, `djcm-svs`, `djcm-svs-medfilt`, `swift`, `pesto`).
|
| 219 |
-
- `--predictor_onnx` (mặc định: `False`): Có sử dụng chế độ tăng tốc bằng ONNX của trích xuất cao độ hay không.
|
| 220 |
-
- `--pitch_guidance` (mặc định: `True`): Có sử dụng hướng dẫn cao độ hay không.
|
| 221 |
-
- `--f0_autotune` (mặc định: `False`): Có tự động điều chỉnh F0 hay không.
|
| 222 |
-
- `--f0_autotune_strength` (mặc định: `1`): Cường độ hiệu chỉnh tự động F0.
|
| 223 |
-
- `--alpha` (mặc định: `0.5`): Ngưỡng trộn cao độ khi ước tính cao độ hybrid.
|
| 224 |
-
|
| 225 |
-
3. Cấu hình xử lí:
|
| 226 |
-
- `--hop_length` (mặc định: `128`): Độ dài bước nhảy trong quá trình xử lí.
|
| 227 |
-
- `--cpu_cores` (mặc định: `2`): Số lượng luồng CPU sử dụng.
|
| 228 |
-
- `--gpu` (mặc định: `-`): Chỉ định GPU sử dụng (ví dụ: `0` cho GPU đầu tiên, `-` để tắt GPU).
|
| 229 |
-
- `--sample_rate` (bắt buộc): Tần số lấy mẫu của âm thanh đầu vào.
|
| 230 |
-
- `--include_mutes` (mặc định: `2`): Số lượng tệp im lặng được sử dụng huấn luyện.
|
| 231 |
-
|
| 232 |
-
4. Cấu hình nhúng:
|
| 233 |
-
- `--embedder_model` (mặc định: `hubert_base`): Tên mô hình nhúng.
|
| 234 |
-
- `--embedders_mode` (mặc định: `fairseq`): Chế độ nhúng (`fairseq`, `transformers`, `onnx`, `whisper`).
|
| 235 |
-
- `--embedders_mix` (mặc định: `False`): Hòa trộn tầng.
|
| 236 |
-
- `--embedders_mix_layers` (mặc định: `9`): Tầng hòa trộn.
|
| 237 |
-
- `--embedders_mix_ratio` (mặc định: `0.5`): Tỉ lệ hòa trộn.
|
| 238 |
-
|
| 239 |
-
4. RMS:
|
| 240 |
-
- `--rms_extract` (mặc định: False): Trích xuất thêm năng lượng rms.
|
| 241 |
-
""")
|
| 242 |
-
sys.exit()
|
| 243 |
-
elif argv_help_is_allows[5] == argv:
|
| 244 |
-
print("""Các tham số của --preprocess:
|
| 245 |
-
1. Thông tin mô hình:
|
| 246 |
-
- `--model_name` (bắt buộc): Tên mô hình.
|
| 247 |
-
|
| 248 |
-
2. Cấu hình dữ liệu:
|
| 249 |
-
- `--dataset_path` (mặc định: `./dataset`): Đường dẫn thư mục chứa tệp dữ liệu.
|
| 250 |
-
- `--sample_rate` (bắt buộc): Tần số lấy mẫu của dữ liệu âm thanh.
|
| 251 |
-
|
| 252 |
-
3. Cấu hình xử lí:
|
| 253 |
-
- `--cpu_cores` (mặc định: `2`): Số lượng luồng CPU sử dụng.
|
| 254 |
-
- `--cut_preprocess` (mặc định: `Automatic`): Cách cắt dữ liệu tiền xử lí (`Automatic`, `Simple`, `Skip`).
|
| 255 |
-
- `--process_effects` (mặc định: `False`): Có áp dụng tiền xử lí hay không.
|
| 256 |
-
- `--clean_dataset` (mặc định: `False`): Có làm sạch tệp dữ liệu hay không.
|
| 257 |
-
- `--clean_strength` (mặc định: `0.7`): Độ mạnh của quá trình làm sạch dữ liệu.
|
| 258 |
-
|
| 259 |
-
4. Cấu hình khác:
|
| 260 |
-
- `--chunk_len` (mặc định: `3.0`): Độ dài của đoạn âm thanh cho phương pháp 'Simple'.
|
| 261 |
-
- `--overlap_len` (mặc định: `0.3`): Độ dài của phần chồng chéo giữa các lát cắt đối với phương pháp 'Simple'.
|
| 262 |
-
- `--normalization_mode` (mặc định: `none`): Có xử lí chuẩn hóa âm thanh không (`none`, `pre`, `post`)
|
| 263 |
-
""")
|
| 264 |
-
sys.exit()
|
| 265 |
-
elif argv_help_is_allows[6] == argv:
|
| 266 |
-
print("""Các tham số của --separate_music:
|
| 267 |
-
1. Cấu hình đầu vào, đầu ra:
|
| 268 |
-
- `--input_path` (bắt buộc): Đường dẫn tệp âm thanh đầu vào.
|
| 269 |
-
- `--output_dirs` (mặc định: `./audios`): Thư mục lưu tệp đầu ra.
|
| 270 |
-
- `--export_format` (mặc định: `wav`): Định dạng xuất tệp (`wav`, `mp3`,...).
|
| 271 |
-
- `--sample_rate` (mặc định: `44100`): Tần số lấy mẫu của âm thanh đầu ra.
|
| 272 |
-
|
| 273 |
-
2. Cấu hình mô hình:
|
| 274 |
-
- `--model_name` (mặc định: `MDXNET_Main`): Mô hình tách nhạc ('Main_340', 'Main_390', 'Main_406', 'Main_427', 'Main_438', 'Inst_full_292', 'Inst_HQ_1', 'Inst_HQ_2', 'Inst_HQ_3', 'Inst_HQ_4', 'Inst_HQ_5', 'Kim_Vocal_1', 'Kim_Vocal_2', 'Kim_Inst', 'Inst_187_beta', 'Inst_82_beta', 'Inst_90_beta', 'Voc_FT', 'Crowd_HQ', 'MDXNET_9482', 'Inst_1', 'Inst_2', 'Inst_3', 'MDXNET_1_9703', 'MDXNET_2_9682', 'MDXNET_3_9662', 'Inst_Main', 'MDXNET_Main', 'HT-Tuned', 'HT-Normal', 'HD_MMI', 'HT_6S', 'HP-1', 'HP-2', 'HP-Vocal-1', 'HP-Vocal-2', 'HP2-1', 'HP2-2', 'HP2-3', 'SP-2B-1', 'SP-2B-2', 'SP-3B-1', 'SP-4B-1', 'SP-4B-2', 'SP-MID-1', 'SP-MID-2').
|
| 275 |
-
- `--karaoke_model` (mặc định: `MDX-Version-1`): Mô hình tách nhạc ('MDX-Version-1', 'MDX-Version-2', 'VR-Version-1', 'VR-Version-2').
|
| 276 |
-
- `--reverb_model` (mặc định: `MDX-Reverb`): Mô hình tách nhạc ("MDX-Reverb", 'VR-Reverb', 'Echo-Aggressive', 'Echo-Normal').
|
| 277 |
-
- `--denoise_model` (mặc định: `Normal`): Mô hình tách nhạc ('Lite', 'Normal').
|
| 278 |
-
|
| 279 |
-
3. Cấu hình xử lí âm thanh:
|
| 280 |
-
- `--shifts` (mặc định: `2`): Số lượng dự đoán.
|
| 281 |
-
- `--batch_size` (mặc định: `1`): Kích thước lô.
|
| 282 |
-
- `--overlap` (mặc định: `0.25`): Mức độ chồng lấn giữa các đoạn.
|
| 283 |
-
- `--aggression` (mặc định: `5`): Cường độ chiết xuất thân chính.
|
| 284 |
-
- `--hop_length` (mặc định: `1024`): Bước nhảy MDX khi xử lí.
|
| 285 |
-
- `--window_size` (mặc định: `512`): Kích thước cửa sổ.
|
| 286 |
-
- `--segments_size` (mặc định: `256`): Kích thước phân đoạn âm thanh.
|
| 287 |
-
- `--post_process_threshold` (mặc định: `0.2`): Mức độ xử lí hậu kỳ sau khi tách nhạc.
|
| 288 |
-
|
| 289 |
-
4. Cấu hình xử lí âm thanh khác:
|
| 290 |
-
- `--enable_tta` (mặc định: `False`): Tăng cường suy luận.
|
| 291 |
-
- `--enable_denoise` (mặc định: `False`): Khữ tách nhạc.
|
| 292 |
-
- `--high_end_process` (mặc định: `False`): Xử lí dải cao.
|
| 293 |
-
- `--enable_post_process` (mặc định: `False`): Hậu xử lí.
|
| 294 |
-
- `--separate_backing` (mặc định: `False`): Tách bè giọng.
|
| 295 |
-
- `--separate_reverb` (mặc định: `False`): Tách vang giọng.
|
| 296 |
-
""")
|
| 297 |
-
sys.exit()
|
| 298 |
-
elif argv_help_is_allows[7] == argv:
|
| 299 |
-
print("""Các tham số của --train:
|
| 300 |
-
1. Cấu hình mô h��nh:
|
| 301 |
-
- `--model_name` (bắt buộc): Tên mô hình.
|
| 302 |
-
- `--rvc_version` (mặc định: `v2`): Phiên bản mô hình (`v1`, `v2`).
|
| 303 |
-
- `--model_author` (tùy chọn): Tác giả của mô hình.
|
| 304 |
-
|
| 305 |
-
2. Cấu hình lưu:
|
| 306 |
-
- `--save_every_epoch` (bắt buộc): Số kỷ nguyên giữa mỗi lần lưu.
|
| 307 |
-
- `--save_only_latest` (mặc định: `True`): Chỉ lưu điểm mới nhất.
|
| 308 |
-
- `--save_every_weights` (mặc định: `True`): Lưu tất cả trọng số của mô hình.
|
| 309 |
-
|
| 310 |
-
3. Cấu hình huấn luyện:
|
| 311 |
-
- `--total_epoch` (mặc định: `300`): Tổng số kỷ nguyên huấn luyện.
|
| 312 |
-
- `--batch_size` (mặc định: `8`): Kích thước lô trong quá trình huấn luyện.
|
| 313 |
-
|
| 314 |
-
4. Cấu hình thiết bị:
|
| 315 |
-
- `--gpu` (mặc định: `0`): Chỉ định GPU để sử dụng (số hoặc `-` nếu không dùng GPU).
|
| 316 |
-
- `--cache_data_in_gpu` (mặc định: `False`): Lưu dữ liệu vào GPU để tăng tốc.
|
| 317 |
-
|
| 318 |
-
5. Cấu hình huấn luyện nâng cao:
|
| 319 |
-
- `--pitch_guidance` (mặc định: `True`): Sử dụng hướng dẫn cao độ.
|
| 320 |
-
- `--g_pretrained_path` (mặc định: ``): Đường dẫn đến trọng số G đã huấn luyện trước.
|
| 321 |
-
- `--d_pretrained_path` (mặc định: ``): Đường dẫn đến trọng số D đã huấn luyện trước.
|
| 322 |
-
- `--vocoder` (mặc định: `Default`): Bộ mã hóa được sử dụng (`Default`, `MRF-HiFi-GAN`, `RefineGAN`).
|
| 323 |
-
- `--energy_use` (mặc định: `False`): Sử dụng năng lượng rms.
|
| 324 |
-
- `--architecture` (mặc định: `RVC`): Kiến trúc của mô hình giọng nói (`RVC`, `SVC`).
|
| 325 |
-
|
| 326 |
-
6. Phát hiện huấn luyện quá mức:
|
| 327 |
-
- `--overtraining_detector` (mặc định: `False`): Bật/tắt chế độ phát hiện huấn luyện quá mức.
|
| 328 |
-
- `--overtraining_threshold` (mặc định: `50`): Ngưỡng để xác định huấn luyện quá mức.
|
| 329 |
-
|
| 330 |
-
7. Xử lí dữ liệu:
|
| 331 |
-
- `--cleanup` (mặc định: `False`): Dọn dẹp tệp huấn luyện cũ để tiến hành huấn luyện lại từ đầu.
|
| 332 |
-
|
| 333 |
-
8. Tối ưu:
|
| 334 |
-
- `--checkpointing` (mặc định: `False`): Bật/tắt checkpointing để tiết kiệm RAM.
|
| 335 |
-
- `--deterministic` (mặc định: `False`): Khi bật sẽ sử dụng các thuật toán có tính xác định cao, đảm bảo rằng mỗi lần chạy cùng một dữ liệu đầu vào sẽ cho kết quả giống nhau.
|
| 336 |
-
- `--benchmark` (mặc định: `False`): Khi bật sẽ thử nghiệm và chọn thuật toán tối ưu nhất cho phần cứng và kích thước cụ thể.
|
| 337 |
-
- `--optimizer` (mặc định: `AdamW`): Trình tối ưu hóa được sử dụng (`AdamW`, `RAdam`, `AnyPrecisionAdamW`, `AdaBelief`, `AdaBeliefV2`).
|
| 338 |
-
- `--multiscale_mel_loss` (mặc định: `False`): So sánh phổ Mel của âm thanh thật và âm thanh giả ở nhiều thang độ khác nhau. Giúp mô hình học được chi tiết âm sắc, độ sáng và cấu trúc tần số tốt hơn, từ đó cải thiện chất lượng và độ tự nhiên của giọng nói đầu ra.
|
| 339 |
-
- `--use_cosine_annealing_lr` (mặc định: `False`): Sử dụng phương pháp giảm LR bằng Cosine Annealing có thể giúp cải thiện chất lượng phát âm.
|
| 340 |
-
|
| 341 |
-
9. Bộ tham chiếu:
|
| 342 |
-
- `--use_custom_reference` (mặc định: `False`): Có tùy chỉnh bộ tham chiếu hay không.
|
| 343 |
-
- `--reference_path` (mặc định: `False`): Đường dẫn đến bộ tham chiếu.
|
| 344 |
-
""")
|
| 345 |
-
sys.exit()
|
| 346 |
-
elif argv_help_is_allows[8] == argv:
|
| 347 |
-
print("""Các tham số của --create_reference:
|
| 348 |
-
1. Đường dẫn tệp:
|
| 349 |
-
- `--audio_path` (bắt buộc): Đường dẫn tệp âm thanh đầu vào.
|
| 350 |
-
- `--reference_name` (mặc định: `reference`): Đường dẫn lưu bộ tham chiếu đầu ra.
|
| 351 |
-
|
| 352 |
-
2. Cấu hình bộ tham chiếu:
|
| 353 |
-
- `--pitch_guidance` (mặc định: `True`): Sử dụng hướng dẫn cao độ.
|
| 354 |
-
- `--energy_use` (mặc định: `False`): Sử dụng năng lượng rms.
|
| 355 |
-
- `--version` (mặc định: `v2`): Phiên bản mô hình (`v1`, `v2`).
|
| 356 |
-
|
| 357 |
-
3. Cấu hình nhúng:
|
| 358 |
-
- `--embedder_model` (mặc định: `hubert_base`): Tên mô hình nhúng.
|
| 359 |
-
- `--embedders_mode` (mặc định: `fairseq`): Chế độ nhúng (`fairseq`, `transformers`, `onnx`, `whisper`).
|
| 360 |
-
- `--embedders_mix` (mặc định: `False`): Hòa trộn tầng.
|
| 361 |
-
- `--embedders_mix_layers` (mặc định: `9`): Tầng hòa trộn.
|
| 362 |
-
- `--embedders_mix_ratio` (mặc định: `0.5`): Tỉ lệ hòa trộn.
|
| 363 |
-
|
| 364 |
-
4. Cấu hình F0:
|
| 365 |
-
- `--f0_method` (mặc định: `rmvpe`): Phương pháp d�� đoán F0 (`pm-ac`, `pm-cc`, `pm-shs`, `dio`, `dio-stonemask`, `mangio-crepe-tiny`, `mangio-crepe-small`, `mangio-crepe-medium`, `mangio-crepe-large`, `mangio-crepe-full`, `crepe-tiny`, `crepe-small`, `crepe-medium`, `crepe-large`, `crepe-full`, `fcpe`, `fcpe-legacy`, `fcpe-previous`, `rmvpe`, `rmvpe-medfilt`, `rmvpe-mix`, `rmvpe-mix-medfilt`, `hpa-rmvpe`, `hpa-rmvpe-medfilt`, `hpa-rmvpe-previous`, `hpa-rmvpe-previous-medfilt`, `harvest`, `harvest-stonemask`, `yin`, `pyin`, `swipe`, `swipe-stonemask`, `piptrack`, `penn`, `mangio-penn`, `djcm`, `djcm-medfilt`, `djcm-svs`, `djcm-svs-medfilt`, `swift`, `pesto`).
|
| 366 |
-
- `--predictor_onnx` (mặc định: `False`): Có sử dụng chế độ tăng tốc bằng ONNX của trích xuất cao độ hay không.
|
| 367 |
-
- `--f0_up_key` (mặc định: `0`): Điều chỉnh cao độ.
|
| 368 |
-
- `--filter_radius` (mặc định: `3`): Độ mượt của đường F0.
|
| 369 |
-
- `--f0_autotune` (mặc định: `False`): Có tự động điều chỉnh F0 hay không.
|
| 370 |
-
- `--f0_autotune_strength` (mặc định: `1`): Cường độ hiệu chỉnh tự động F0.
|
| 371 |
-
- `--f0_file` (mặc định: ``): Đường dẫn tệp F0 có sẵn.
|
| 372 |
-
- `--proposal_pitch` (mặc định: `False`): Đề xuất cao độ thay vì điều chỉnh thủ công.
|
| 373 |
-
- `--proposal_pitch_threshold` (mặc định: `0.0`): Ngưỡng tần số ước tính cao độ.
|
| 374 |
-
- `--alpha` (mặc định: `0.5`): Ngưỡng trộn cao độ khi ước tính cao độ hybrid.
|
| 375 |
-
""")
|
| 376 |
-
sys.exit()
|
| 377 |
-
elif argv_help_is_allows[9] == argv:
|
| 378 |
-
print("""Sử dụng:
|
| 379 |
-
1. `--help_audio_effects`: Trợ giúp về phần thêm hiệu ứng âm thanh.
|
| 380 |
-
2. `--help_convert`: Trợ giúp về chuyển đổi âm thanh.
|
| 381 |
-
3. `--help_create_dataset`: Trợ giúp về tạo dữ liệu huấn luyện.
|
| 382 |
-
4. `--help_create_index`: Trợ giúp về tạo chỉ mục.
|
| 383 |
-
5. `--help_extract`: Trợ giúp về trích xuất dữ liệu huấn luyện.
|
| 384 |
-
6. `--help_preprocess`: Trợ giúp về xử lí trước dữ liệu.
|
| 385 |
-
7. `--help_separate_music`: Trợ giúp về tách nhạc.
|
| 386 |
-
8. `--help_train`: Trợ giúp về huấn luyện mô hình.
|
| 387 |
-
9. `--help_create_reference`: Trợ giúp về tạo bộ tham chiếu.
|
| 388 |
-
""")
|
| 389 |
-
sys.exit()
|
| 390 |
-
elif argv in COMMANDS:
|
| 391 |
-
import importlib
|
| 392 |
-
|
| 393 |
-
module = importlib.import_module(COMMANDS[argv])
|
| 394 |
-
main = module.main
|
| 395 |
-
else:
|
| 396 |
-
main = lambda: print("Cú pháp không hợp lệ!"); sys.exit()
|
| 397 |
-
|
| 398 |
-
if __name__ == "__main__":
|
| 399 |
-
import torch.multiprocessing as mp
|
| 400 |
-
|
| 401 |
-
try:
|
| 402 |
-
if "--train" in argv: mp.set_start_method("spawn")
|
| 403 |
-
if "--preprocess" in argv or "--extract" in argv: mp.set_start_method("spawn", force=True)
|
| 404 |
-
except:
|
| 405 |
-
pass
|
| 406 |
-
|
| 407 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/run_tensorboard.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import time
|
| 4 |
-
import logging
|
| 5 |
-
import warnings
|
| 6 |
-
import webbrowser
|
| 7 |
-
|
| 8 |
-
from tensorboard import program
|
| 9 |
-
|
| 10 |
-
sys.path.append(os.getcwd())
|
| 11 |
-
|
| 12 |
-
from main.app.variables import config, translations, logger
|
| 13 |
-
|
| 14 |
-
def launch_tensorboard():
|
| 15 |
-
if not config.debug_mode:
|
| 16 |
-
warnings.filterwarnings("ignore")
|
| 17 |
-
for l in ["root", "tensorboard"]:
|
| 18 |
-
logging.getLogger(l).setLevel(logging.ERROR)
|
| 19 |
-
|
| 20 |
-
tb = program.TensorBoard()
|
| 21 |
-
tb.configure(
|
| 22 |
-
argv=[
|
| 23 |
-
None,
|
| 24 |
-
"--logdir", config.configs["logs_path"],
|
| 25 |
-
f"--port={config.configs['tensorboard_port']}"
|
| 26 |
-
]
|
| 27 |
-
)
|
| 28 |
-
url = tb.launch()
|
| 29 |
-
|
| 30 |
-
logger.info(f"{translations['tensorboard_url']}: {url}")
|
| 31 |
-
if "--open" in sys.argv: webbrowser.open(url)
|
| 32 |
-
|
| 33 |
-
return url
|
| 34 |
-
|
| 35 |
-
if __name__ == "__main__":
|
| 36 |
-
launch_tensorboard()
|
| 37 |
-
|
| 38 |
-
while 1:
|
| 39 |
-
time.sleep(5)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/downloads/downloads.py
DELETED
|
@@ -1,330 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.variables import (
|
| 9 |
-
models,
|
| 10 |
-
configs,
|
| 11 |
-
translations,
|
| 12 |
-
model_options
|
| 13 |
-
)
|
| 14 |
-
|
| 15 |
-
from main.app.core.downloads import (
|
| 16 |
-
search_models,
|
| 17 |
-
download_model,
|
| 18 |
-
download_pretrained_model
|
| 19 |
-
)
|
| 20 |
-
|
| 21 |
-
from main.app.core.ui import (
|
| 22 |
-
shutil_move,
|
| 23 |
-
change_download_choices,
|
| 24 |
-
change_download_pretrained_choices
|
| 25 |
-
)
|
| 26 |
-
|
| 27 |
-
from main.app.core.process import (
|
| 28 |
-
save_drop_model,
|
| 29 |
-
fetch_pretrained_data,
|
| 30 |
-
update_sample_rate_dropdown
|
| 31 |
-
)
|
| 32 |
-
|
| 33 |
-
def download_tab():
|
| 34 |
-
with gr.TabItem(
|
| 35 |
-
translations["downloads"]
|
| 36 |
-
):
|
| 37 |
-
gr.Markdown(translations["download_markdown"])
|
| 38 |
-
with gr.Row():
|
| 39 |
-
gr.Markdown(translations["download_markdown_2"])
|
| 40 |
-
with gr.Row():
|
| 41 |
-
with gr.Accordion(
|
| 42 |
-
translations["model_download"],
|
| 43 |
-
open=True
|
| 44 |
-
):
|
| 45 |
-
with gr.Row():
|
| 46 |
-
download_method = gr.Radio(
|
| 47 |
-
label=translations["model_download_select"],
|
| 48 |
-
choices=[
|
| 49 |
-
translations["download_url"],
|
| 50 |
-
translations["download_from_csv"],
|
| 51 |
-
translations["search_models"],
|
| 52 |
-
translations["upload"]
|
| 53 |
-
],
|
| 54 |
-
interactive=True,
|
| 55 |
-
value=translations["download_url"]
|
| 56 |
-
)
|
| 57 |
-
with gr.Row():
|
| 58 |
-
gr.Markdown("___")
|
| 59 |
-
with gr.Column():
|
| 60 |
-
with gr.Row():
|
| 61 |
-
download_model_url = gr.Textbox(
|
| 62 |
-
label=translations["model_url"],
|
| 63 |
-
value="",
|
| 64 |
-
placeholder="https://...",
|
| 65 |
-
scale=6
|
| 66 |
-
)
|
| 67 |
-
download_model_name = gr.Textbox(
|
| 68 |
-
label=translations["modelname"],
|
| 69 |
-
value="",
|
| 70 |
-
placeholder=translations["modelname"],
|
| 71 |
-
scale=2
|
| 72 |
-
)
|
| 73 |
-
download_url_button = gr.Button(
|
| 74 |
-
value=translations["downloads"],
|
| 75 |
-
scale=2
|
| 76 |
-
)
|
| 77 |
-
with gr.Column():
|
| 78 |
-
download_csv_model = gr.Dropdown(
|
| 79 |
-
choices=models.keys(),
|
| 80 |
-
label=translations["model_warehouse"],
|
| 81 |
-
scale=8,
|
| 82 |
-
allow_custom_value=True,
|
| 83 |
-
visible=False
|
| 84 |
-
)
|
| 85 |
-
download_csv_button = gr.Button(
|
| 86 |
-
value=translations["get_model"],
|
| 87 |
-
scale=2,
|
| 88 |
-
variant="primary",
|
| 89 |
-
visible=False
|
| 90 |
-
)
|
| 91 |
-
with gr.Column():
|
| 92 |
-
search_model_name = gr.Textbox(
|
| 93 |
-
label=translations["name_to_search"],
|
| 94 |
-
placeholder=translations["modelname"],
|
| 95 |
-
interactive=True,
|
| 96 |
-
scale=8,
|
| 97 |
-
visible=False
|
| 98 |
-
)
|
| 99 |
-
search_button = gr.Button(
|
| 100 |
-
translations["search_2"],
|
| 101 |
-
scale=2,
|
| 102 |
-
visible=False
|
| 103 |
-
)
|
| 104 |
-
search_dropdown = gr.Dropdown(
|
| 105 |
-
label=translations["select_download_model"],
|
| 106 |
-
value="",
|
| 107 |
-
choices=[],
|
| 108 |
-
allow_custom_value=True,
|
| 109 |
-
interactive=False,
|
| 110 |
-
visible=False
|
| 111 |
-
)
|
| 112 |
-
search_download_model = gr.Button(
|
| 113 |
-
translations["downloads"],
|
| 114 |
-
variant="primary",
|
| 115 |
-
visible=False
|
| 116 |
-
)
|
| 117 |
-
with gr.Column():
|
| 118 |
-
upload_model_files = gr.Files(
|
| 119 |
-
label=translations["drop_model"],
|
| 120 |
-
file_types=[".pth", ".onnx", ".index", ".zip"],
|
| 121 |
-
visible=False
|
| 122 |
-
)
|
| 123 |
-
with gr.Row():
|
| 124 |
-
with gr.Accordion(
|
| 125 |
-
translations["download_pretrained_2"],
|
| 126 |
-
open=True
|
| 127 |
-
):
|
| 128 |
-
with gr.Row():
|
| 129 |
-
download_pretrain_method = gr.Radio(
|
| 130 |
-
label=translations["model_download_select"],
|
| 131 |
-
choices=[
|
| 132 |
-
translations["download_url"],
|
| 133 |
-
translations["list_model"],
|
| 134 |
-
translations["upload"]
|
| 135 |
-
],
|
| 136 |
-
value=translations["download_url"],
|
| 137 |
-
interactive=True
|
| 138 |
-
)
|
| 139 |
-
with gr.Row():
|
| 140 |
-
gr.Markdown("___")
|
| 141 |
-
with gr.Column():
|
| 142 |
-
with gr.Row():
|
| 143 |
-
download_pretrain_disc_url = gr.Textbox(
|
| 144 |
-
label=translations["pretrained_url"].format(dg="D"),
|
| 145 |
-
value="",
|
| 146 |
-
placeholder="https://...",
|
| 147 |
-
interactive=True,
|
| 148 |
-
scale=4
|
| 149 |
-
)
|
| 150 |
-
download_pretrain_gen_url = gr.Textbox(
|
| 151 |
-
label=translations["pretrained_url"].format(dg="G"),
|
| 152 |
-
value="",
|
| 153 |
-
placeholder="https://...",
|
| 154 |
-
interactive=True,
|
| 155 |
-
scale=4
|
| 156 |
-
)
|
| 157 |
-
download_pretrain_button = gr.Button(
|
| 158 |
-
translations["downloads"],
|
| 159 |
-
scale=2,
|
| 160 |
-
visible=True
|
| 161 |
-
)
|
| 162 |
-
with gr.Column():
|
| 163 |
-
with gr.Row():
|
| 164 |
-
download_pretrain_choices = gr.Dropdown(
|
| 165 |
-
label=translations["select_pretrain"],
|
| 166 |
-
info=translations["select_pretrain_info"],
|
| 167 |
-
choices=list(fetch_pretrained_data().keys()),
|
| 168 |
-
value="Titan_Medium",
|
| 169 |
-
allow_custom_value=True,
|
| 170 |
-
interactive=True,
|
| 171 |
-
scale=6,
|
| 172 |
-
visible=False
|
| 173 |
-
)
|
| 174 |
-
download_pretrain_sample_rate = gr.Dropdown(
|
| 175 |
-
label=translations["pretrain_sr"],
|
| 176 |
-
info=translations["pretrain_sr"],
|
| 177 |
-
choices=["48k", "40k", "32k"],
|
| 178 |
-
value="48k",
|
| 179 |
-
interactive=True,
|
| 180 |
-
visible=False
|
| 181 |
-
)
|
| 182 |
-
download_pretrain_choices_button = gr.Button(
|
| 183 |
-
translations["downloads"],
|
| 184 |
-
scale=2,
|
| 185 |
-
variant="primary",
|
| 186 |
-
visible=False
|
| 187 |
-
)
|
| 188 |
-
with gr.Row():
|
| 189 |
-
upload_pretrains = gr.Files(
|
| 190 |
-
label=translations["drop_pretrain"].format(dg="G, D"),
|
| 191 |
-
file_types=[".pth"],
|
| 192 |
-
visible=False
|
| 193 |
-
)
|
| 194 |
-
with gr.Row():
|
| 195 |
-
download_url_button.click(
|
| 196 |
-
fn=download_model,
|
| 197 |
-
inputs=[
|
| 198 |
-
download_model_url,
|
| 199 |
-
download_model_name
|
| 200 |
-
],
|
| 201 |
-
outputs=[download_model_url],
|
| 202 |
-
api_name="download_model"
|
| 203 |
-
)
|
| 204 |
-
download_csv_button.click(
|
| 205 |
-
fn=lambda model: download_model(
|
| 206 |
-
models[model],
|
| 207 |
-
model
|
| 208 |
-
),
|
| 209 |
-
inputs=[
|
| 210 |
-
download_csv_model
|
| 211 |
-
],
|
| 212 |
-
outputs=[
|
| 213 |
-
download_csv_model
|
| 214 |
-
],
|
| 215 |
-
api_name="download_browser"
|
| 216 |
-
)
|
| 217 |
-
with gr.Row():
|
| 218 |
-
download_method.change(
|
| 219 |
-
fn=change_download_choices,
|
| 220 |
-
inputs=[
|
| 221 |
-
download_method
|
| 222 |
-
],
|
| 223 |
-
outputs=[
|
| 224 |
-
download_model_url,
|
| 225 |
-
download_model_name,
|
| 226 |
-
download_url_button,
|
| 227 |
-
download_csv_model,
|
| 228 |
-
download_csv_button,
|
| 229 |
-
search_model_name,
|
| 230 |
-
search_button,
|
| 231 |
-
search_dropdown,
|
| 232 |
-
search_download_model,
|
| 233 |
-
upload_model_files
|
| 234 |
-
]
|
| 235 |
-
)
|
| 236 |
-
search_button.click(
|
| 237 |
-
fn=search_models,
|
| 238 |
-
inputs=[
|
| 239 |
-
search_model_name
|
| 240 |
-
],
|
| 241 |
-
outputs=[
|
| 242 |
-
search_dropdown,
|
| 243 |
-
search_download_model
|
| 244 |
-
]
|
| 245 |
-
)
|
| 246 |
-
with gr.Row():
|
| 247 |
-
upload_model_files.upload(
|
| 248 |
-
fn=save_drop_model,
|
| 249 |
-
inputs=[
|
| 250 |
-
upload_model_files
|
| 251 |
-
],
|
| 252 |
-
outputs=[
|
| 253 |
-
upload_model_files
|
| 254 |
-
]
|
| 255 |
-
)
|
| 256 |
-
search_download_model.click(
|
| 257 |
-
fn=lambda model: download_model(
|
| 258 |
-
model_options[model],
|
| 259 |
-
model
|
| 260 |
-
),
|
| 261 |
-
inputs=[
|
| 262 |
-
search_dropdown
|
| 263 |
-
],
|
| 264 |
-
outputs=[
|
| 265 |
-
search_dropdown
|
| 266 |
-
],
|
| 267 |
-
api_name="search_models"
|
| 268 |
-
)
|
| 269 |
-
with gr.Row():
|
| 270 |
-
download_pretrain_method.change(
|
| 271 |
-
fn=change_download_pretrained_choices,
|
| 272 |
-
inputs=[
|
| 273 |
-
download_pretrain_method
|
| 274 |
-
],
|
| 275 |
-
outputs=[
|
| 276 |
-
download_pretrain_disc_url,
|
| 277 |
-
download_pretrain_gen_url,
|
| 278 |
-
download_pretrain_button,
|
| 279 |
-
download_pretrain_choices,
|
| 280 |
-
download_pretrain_sample_rate,
|
| 281 |
-
download_pretrain_choices_button,
|
| 282 |
-
upload_pretrains
|
| 283 |
-
]
|
| 284 |
-
)
|
| 285 |
-
download_pretrain_choices.change(
|
| 286 |
-
fn=update_sample_rate_dropdown,
|
| 287 |
-
inputs=[
|
| 288 |
-
download_pretrain_choices
|
| 289 |
-
],
|
| 290 |
-
outputs=[
|
| 291 |
-
download_pretrain_sample_rate
|
| 292 |
-
]
|
| 293 |
-
)
|
| 294 |
-
with gr.Row():
|
| 295 |
-
download_pretrain_button.click(
|
| 296 |
-
fn=download_pretrained_model,
|
| 297 |
-
inputs=[
|
| 298 |
-
download_pretrain_method,
|
| 299 |
-
download_pretrain_disc_url,
|
| 300 |
-
download_pretrain_gen_url
|
| 301 |
-
],
|
| 302 |
-
outputs=[
|
| 303 |
-
download_pretrain_disc_url,
|
| 304 |
-
download_pretrain_gen_url
|
| 305 |
-
],
|
| 306 |
-
api_name="download_pretrain_link"
|
| 307 |
-
)
|
| 308 |
-
download_pretrain_choices_button.click(
|
| 309 |
-
fn=download_pretrained_model,
|
| 310 |
-
inputs=[
|
| 311 |
-
download_pretrain_method,
|
| 312 |
-
download_pretrain_choices,
|
| 313 |
-
download_pretrain_sample_rate
|
| 314 |
-
],
|
| 315 |
-
outputs=[
|
| 316 |
-
download_pretrain_choices
|
| 317 |
-
],
|
| 318 |
-
api_name="download_pretrain_choices"
|
| 319 |
-
)
|
| 320 |
-
upload_pretrains.upload(
|
| 321 |
-
fn=lambda upload_pretrains: [
|
| 322 |
-
shutil_move(pretrain.name, configs["pretrained_custom_path"])
|
| 323 |
-
for pretrain in upload_pretrains
|
| 324 |
-
],
|
| 325 |
-
inputs=[
|
| 326 |
-
upload_pretrains
|
| 327 |
-
],
|
| 328 |
-
outputs=[],
|
| 329 |
-
api_name="upload_pretrain"
|
| 330 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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ys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.editing import audio_effects
|
| 9 |
-
|
| 10 |
-
from main.app.core.presets import (
|
| 11 |
-
audio_effect_load_presets,
|
| 12 |
-
audio_effect_save_presets
|
| 13 |
-
)
|
| 14 |
-
|
| 15 |
-
from main.app.core.ui import (
|
| 16 |
-
visible,
|
| 17 |
-
shutil_move,
|
| 18 |
-
change_audios_choices,
|
| 19 |
-
change_effect_preset_choices
|
| 20 |
-
)
|
| 21 |
-
|
| 22 |
-
from main.app.variables import (
|
| 23 |
-
configs,
|
| 24 |
-
file_types,
|
| 25 |
-
translations,
|
| 26 |
-
audio_params,
|
| 27 |
-
paths_for_files,
|
| 28 |
-
sample_rate_choice,
|
| 29 |
-
export_format_choices,
|
| 30 |
-
audio_effect_presets_file
|
| 31 |
-
)
|
| 32 |
-
|
| 33 |
-
def audio_effects_tab():
|
| 34 |
-
with gr.Row():
|
| 35 |
-
gr.Markdown(translations["audio_effects_edit"])
|
| 36 |
-
with gr.Row():
|
| 37 |
-
with gr.Column():
|
| 38 |
-
with gr.Row():
|
| 39 |
-
reverb_check_box = gr.Checkbox(
|
| 40 |
-
label=translations["reverb"],
|
| 41 |
-
value=False,
|
| 42 |
-
interactive=True
|
| 43 |
-
)
|
| 44 |
-
chorus_check_box = gr.Checkbox(
|
| 45 |
-
label=translations["chorus"],
|
| 46 |
-
value=False,
|
| 47 |
-
interactive=True
|
| 48 |
-
)
|
| 49 |
-
delay_check_box = gr.Checkbox(
|
| 50 |
-
label=translations["delay"],
|
| 51 |
-
value=False,
|
| 52 |
-
interactive=True
|
| 53 |
-
)
|
| 54 |
-
phaser_check_box = gr.Checkbox(
|
| 55 |
-
label=translations["phaser"],
|
| 56 |
-
value=False,
|
| 57 |
-
interactive=True
|
| 58 |
-
)
|
| 59 |
-
compressor_check_box = gr.Checkbox(
|
| 60 |
-
label=translations["compressor"],
|
| 61 |
-
value=False,
|
| 62 |
-
interactive=True
|
| 63 |
-
)
|
| 64 |
-
more_options = gr.Checkbox(
|
| 65 |
-
label=translations["more_option"],
|
| 66 |
-
value=False,
|
| 67 |
-
interactive=True
|
| 68 |
-
)
|
| 69 |
-
with gr.Row():
|
| 70 |
-
with gr.Accordion(
|
| 71 |
-
translations["input_output"],
|
| 72 |
-
open=False
|
| 73 |
-
):
|
| 74 |
-
with gr.Row():
|
| 75 |
-
upload_audio_files = gr.Files(
|
| 76 |
-
label=translations["drop_audio"],
|
| 77 |
-
file_types=file_types
|
| 78 |
-
)
|
| 79 |
-
with gr.Row():
|
| 80 |
-
audio_in_path = gr.Dropdown(
|
| 81 |
-
label=translations["input_audio"],
|
| 82 |
-
value="",
|
| 83 |
-
choices=paths_for_files,
|
| 84 |
-
info=translations["provide_audio"],
|
| 85 |
-
interactive=True,
|
| 86 |
-
allow_custom_value=True
|
| 87 |
-
)
|
| 88 |
-
audio_out_path = gr.Textbox(
|
| 89 |
-
label=translations["output_audio"],
|
| 90 |
-
value="audios/audio_effects.wav",
|
| 91 |
-
placeholder="audios/audio_effects.wav",
|
| 92 |
-
info=translations["provide_output"],
|
| 93 |
-
interactive=True
|
| 94 |
-
)
|
| 95 |
-
with gr.Row():
|
| 96 |
-
with gr.Column():
|
| 97 |
-
audio_combination = gr.Checkbox(
|
| 98 |
-
label=translations["merge_instruments"],
|
| 99 |
-
value=False,
|
| 100 |
-
interactive=True
|
| 101 |
-
)
|
| 102 |
-
audio_combination_input = gr.Dropdown(
|
| 103 |
-
label=translations["input_audio"],
|
| 104 |
-
value="",
|
| 105 |
-
choices=paths_for_files,
|
| 106 |
-
info=translations["provide_audio"],
|
| 107 |
-
interactive=True,
|
| 108 |
-
allow_custom_value=True,
|
| 109 |
-
visible=False
|
| 110 |
-
)
|
| 111 |
-
with gr.Row():
|
| 112 |
-
main_volume = gr.Slider(
|
| 113 |
-
minimum=-80,
|
| 114 |
-
maximum=80,
|
| 115 |
-
label=translations["main_volume"],
|
| 116 |
-
info=translations["main_volume_info"],
|
| 117 |
-
value=-4,
|
| 118 |
-
step=1,
|
| 119 |
-
interactive=True,
|
| 120 |
-
visible=False
|
| 121 |
-
)
|
| 122 |
-
combine_volume = gr.Slider(
|
| 123 |
-
minimum=-80,
|
| 124 |
-
maximum=80,
|
| 125 |
-
label=translations["combination_volume"],
|
| 126 |
-
info=translations["combination_volume_info"],
|
| 127 |
-
value=-7,
|
| 128 |
-
step=1,
|
| 129 |
-
interactive=True,
|
| 130 |
-
visible=False
|
| 131 |
-
)
|
| 132 |
-
with gr.Row():
|
| 133 |
-
audio_effects_refresh = gr.Button(
|
| 134 |
-
translations["refresh"]
|
| 135 |
-
)
|
| 136 |
-
with gr.Row():
|
| 137 |
-
audio_output_format = gr.Radio(
|
| 138 |
-
label=translations["export_format"],
|
| 139 |
-
info=translations["export_info"],
|
| 140 |
-
choices=export_format_choices,
|
| 141 |
-
value="wav",
|
| 142 |
-
interactive=True
|
| 143 |
-
)
|
| 144 |
-
with gr.Row():
|
| 145 |
-
with gr.Accordion(
|
| 146 |
-
translations["use_presets"],
|
| 147 |
-
open=False
|
| 148 |
-
):
|
| 149 |
-
with gr.Row():
|
| 150 |
-
presets_name = gr.Dropdown(
|
| 151 |
-
label=translations["file_preset"],
|
| 152 |
-
choices=audio_effect_presets_file,
|
| 153 |
-
value=(
|
| 154 |
-
audio_effect_presets_file[0]
|
| 155 |
-
) if len(audio_effect_presets_file) > 0 else "",
|
| 156 |
-
interactive=True,
|
| 157 |
-
allow_custom_value=True
|
| 158 |
-
)
|
| 159 |
-
with gr.Row():
|
| 160 |
-
load_preset_button = gr.Button(
|
| 161 |
-
translations["load_file"],
|
| 162 |
-
variant="primary"
|
| 163 |
-
)
|
| 164 |
-
refresh_preset_button = gr.Button(
|
| 165 |
-
translations["refresh"]
|
| 166 |
-
)
|
| 167 |
-
with gr.Accordion(
|
| 168 |
-
translations["export_file"],
|
| 169 |
-
open=False
|
| 170 |
-
):
|
| 171 |
-
with gr.Row():
|
| 172 |
-
with gr.Column():
|
| 173 |
-
name_to_save_file = gr.Textbox(
|
| 174 |
-
label=translations["filename_to_save"]
|
| 175 |
-
)
|
| 176 |
-
save_file_button = gr.Button(
|
| 177 |
-
translations["export_file"]
|
| 178 |
-
)
|
| 179 |
-
with gr.Row():
|
| 180 |
-
upload_presets = gr.Files(
|
| 181 |
-
label=translations["upload_presets"],
|
| 182 |
-
file_types=[".effect.json"]
|
| 183 |
-
)
|
| 184 |
-
with gr.Row():
|
| 185 |
-
apply_effects_button = gr.Button(
|
| 186 |
-
translations["apply"],
|
| 187 |
-
variant="primary",
|
| 188 |
-
scale=2
|
| 189 |
-
)
|
| 190 |
-
with gr.Accordion(translations["audio_effects"], visible=False) as accordion:
|
| 191 |
-
with gr.Row():
|
| 192 |
-
with gr.Accordion(
|
| 193 |
-
translations["reverb"],
|
| 194 |
-
open=True,
|
| 195 |
-
visible=False
|
| 196 |
-
) as reverb_accordion:
|
| 197 |
-
reverb_freeze_mode = gr.Checkbox(
|
| 198 |
-
label=translations["reverb_freeze"],
|
| 199 |
-
info=translations["reverb_freeze_info"],
|
| 200 |
-
value=False,
|
| 201 |
-
interactive=True
|
| 202 |
-
)
|
| 203 |
-
reverb_room_size = gr.Slider(
|
| 204 |
-
minimum=0,
|
| 205 |
-
maximum=1,
|
| 206 |
-
step=0.01,
|
| 207 |
-
value=0.15,
|
| 208 |
-
label=translations["room_size"],
|
| 209 |
-
info=translations["room_size_info"],
|
| 210 |
-
interactive=True
|
| 211 |
-
)
|
| 212 |
-
reverb_damping = gr.Slider(
|
| 213 |
-
minimum=0,
|
| 214 |
-
maximum=1,
|
| 215 |
-
step=0.01,
|
| 216 |
-
value=0.7,
|
| 217 |
-
label=translations["damping"],
|
| 218 |
-
info=translations["damping_info"],
|
| 219 |
-
interactive=True
|
| 220 |
-
)
|
| 221 |
-
reverb_wet_level = gr.Slider(
|
| 222 |
-
minimum=0,
|
| 223 |
-
maximum=1,
|
| 224 |
-
step=0.01,
|
| 225 |
-
value=0.2,
|
| 226 |
-
label=translations["wet_level"],
|
| 227 |
-
info=translations["wet_level_info"],
|
| 228 |
-
interactive=True
|
| 229 |
-
)
|
| 230 |
-
reverb_dry_level = gr.Slider(
|
| 231 |
-
minimum=0,
|
| 232 |
-
maximum=1,
|
| 233 |
-
step=0.01,
|
| 234 |
-
value=0.8,
|
| 235 |
-
label=translations["dry_level"],
|
| 236 |
-
info=translations["dry_level_info"],
|
| 237 |
-
interactive=True
|
| 238 |
-
)
|
| 239 |
-
reverb_width = gr.Slider(
|
| 240 |
-
minimum=0,
|
| 241 |
-
maximum=1,
|
| 242 |
-
step=0.01,
|
| 243 |
-
value=1,
|
| 244 |
-
label=translations["width"],
|
| 245 |
-
info=translations["width_info"],
|
| 246 |
-
interactive=True
|
| 247 |
-
)
|
| 248 |
-
with gr.Row():
|
| 249 |
-
with gr.Accordion(
|
| 250 |
-
translations["chorus"],
|
| 251 |
-
open=True,
|
| 252 |
-
visible=False
|
| 253 |
-
) as chorus_accordion:
|
| 254 |
-
chorus_depth = gr.Slider(
|
| 255 |
-
minimum=0,
|
| 256 |
-
maximum=1,
|
| 257 |
-
step=0.01,
|
| 258 |
-
value=0.5,
|
| 259 |
-
label=translations["chorus_depth"],
|
| 260 |
-
info=translations["chorus_depth_info"],
|
| 261 |
-
interactive=True
|
| 262 |
-
)
|
| 263 |
-
chorus_rate_hz = gr.Slider(
|
| 264 |
-
minimum=0.1,
|
| 265 |
-
maximum=10,
|
| 266 |
-
step=0.1,
|
| 267 |
-
value=1.5,
|
| 268 |
-
label=translations["chorus_rate_hz"],
|
| 269 |
-
info=translations["chorus_rate_hz_info"],
|
| 270 |
-
interactive=True
|
| 271 |
-
)
|
| 272 |
-
chorus_mix = gr.Slider(
|
| 273 |
-
minimum=0,
|
| 274 |
-
maximum=1,
|
| 275 |
-
step=0.01,
|
| 276 |
-
value=0.5,
|
| 277 |
-
label=translations["chorus_mix"],
|
| 278 |
-
info=translations["chorus_mix_info"],
|
| 279 |
-
interactive=True
|
| 280 |
-
)
|
| 281 |
-
chorus_center_delay_ms = gr.Slider(
|
| 282 |
-
minimum=0,
|
| 283 |
-
maximum=50,
|
| 284 |
-
step=1,
|
| 285 |
-
value=10,
|
| 286 |
-
label=translations["chorus_center_delay_ms"],
|
| 287 |
-
info=translations["chorus_center_delay_ms_info"],
|
| 288 |
-
interactive=True
|
| 289 |
-
)
|
| 290 |
-
chorus_feedback = gr.Slider(
|
| 291 |
-
minimum=-1,
|
| 292 |
-
maximum=1,
|
| 293 |
-
step=0.01,
|
| 294 |
-
value=0,
|
| 295 |
-
label=translations["chorus_feedback"],
|
| 296 |
-
info=translations["chorus_feedback_info"],
|
| 297 |
-
interactive=True
|
| 298 |
-
)
|
| 299 |
-
with gr.Row():
|
| 300 |
-
with gr.Accordion(
|
| 301 |
-
translations["delay"],
|
| 302 |
-
open=True,
|
| 303 |
-
visible=False
|
| 304 |
-
) as delay_accordion:
|
| 305 |
-
delay_second = gr.Slider(
|
| 306 |
-
minimum=0,
|
| 307 |
-
maximum=5,
|
| 308 |
-
step=0.01,
|
| 309 |
-
value=0.5,
|
| 310 |
-
label=translations["delay_seconds"],
|
| 311 |
-
info=translations["delay_seconds_info"],
|
| 312 |
-
interactive=True
|
| 313 |
-
)
|
| 314 |
-
delay_feedback = gr.Slider(
|
| 315 |
-
minimum=0,
|
| 316 |
-
maximum=1,
|
| 317 |
-
step=0.01,
|
| 318 |
-
value=0.5,
|
| 319 |
-
label=translations["delay_feedback"],
|
| 320 |
-
info=translations["delay_feedback_info"],
|
| 321 |
-
interactive=True
|
| 322 |
-
)
|
| 323 |
-
delay_mix = gr.Slider(
|
| 324 |
-
minimum=0,
|
| 325 |
-
maximum=1,
|
| 326 |
-
step=0.01,
|
| 327 |
-
value=0.5,
|
| 328 |
-
label=translations["delay_mix"],
|
| 329 |
-
info=translations["delay_mix_info"],
|
| 330 |
-
interactive=True
|
| 331 |
-
)
|
| 332 |
-
with gr.Row():
|
| 333 |
-
with gr.Accordion(
|
| 334 |
-
translations["phaser"],
|
| 335 |
-
open=True,
|
| 336 |
-
visible=False
|
| 337 |
-
) as phaser_accordion:
|
| 338 |
-
phaser_depth = gr.Slider(
|
| 339 |
-
minimum=0,
|
| 340 |
-
maximum=1,
|
| 341 |
-
step=0.01,
|
| 342 |
-
value=0.5,
|
| 343 |
-
label=translations["phaser_depth"],
|
| 344 |
-
info=translations["phaser_depth_info"],
|
| 345 |
-
interactive=True
|
| 346 |
-
)
|
| 347 |
-
phaser_rate_hz = gr.Slider(
|
| 348 |
-
minimum=0.1,
|
| 349 |
-
maximum=10,
|
| 350 |
-
step=0.1,
|
| 351 |
-
value=1,
|
| 352 |
-
label=translations["phaser_rate_hz"],
|
| 353 |
-
info=translations["phaser_rate_hz_info"],
|
| 354 |
-
interactive=True
|
| 355 |
-
)
|
| 356 |
-
phaser_mix = gr.Slider(
|
| 357 |
-
minimum=0,
|
| 358 |
-
maximum=1,
|
| 359 |
-
step=0.01,
|
| 360 |
-
value=0.5,
|
| 361 |
-
label=translations["phaser_mix"],
|
| 362 |
-
info=translations["phaser_mix_info"],
|
| 363 |
-
interactive=True
|
| 364 |
-
)
|
| 365 |
-
phaser_centre_frequency_hz = gr.Slider(
|
| 366 |
-
minimum=50,
|
| 367 |
-
maximum=5000,
|
| 368 |
-
step=10,
|
| 369 |
-
value=1000,
|
| 370 |
-
label=translations["phaser_centre_frequency_hz"],
|
| 371 |
-
info=translations["phaser_centre_frequency_hz_info"],
|
| 372 |
-
interactive=True
|
| 373 |
-
)
|
| 374 |
-
phaser_feedback = gr.Slider(
|
| 375 |
-
minimum=-1,
|
| 376 |
-
maximum=1,
|
| 377 |
-
step=0.01,
|
| 378 |
-
value=0,
|
| 379 |
-
label=translations["phaser_feedback"],
|
| 380 |
-
info=translations["phaser_feedback_info"],
|
| 381 |
-
interactive=True
|
| 382 |
-
)
|
| 383 |
-
with gr.Row():
|
| 384 |
-
with gr.Accordion(
|
| 385 |
-
translations["compressor"],
|
| 386 |
-
open=True,
|
| 387 |
-
visible=False
|
| 388 |
-
) as compressor_accordion:
|
| 389 |
-
compressor_threshold_db = gr.Slider(
|
| 390 |
-
minimum=-60,
|
| 391 |
-
maximum=0,
|
| 392 |
-
step=1,
|
| 393 |
-
value=-20,
|
| 394 |
-
label=translations["compressor_threshold_db"],
|
| 395 |
-
info=translations["compressor_threshold_db_info"],
|
| 396 |
-
interactive=True
|
| 397 |
-
)
|
| 398 |
-
compressor_ratio = gr.Slider(
|
| 399 |
-
minimum=1,
|
| 400 |
-
maximum=20,
|
| 401 |
-
step=0.1,
|
| 402 |
-
value=1,
|
| 403 |
-
label=translations["compressor_ratio"],
|
| 404 |
-
info=translations["compressor_ratio_info"],
|
| 405 |
-
interactive=True
|
| 406 |
-
)
|
| 407 |
-
compressor_attack_ms = gr.Slider(
|
| 408 |
-
minimum=0.1,
|
| 409 |
-
maximum=100,
|
| 410 |
-
step=0.1,
|
| 411 |
-
value=10,
|
| 412 |
-
label=translations["compressor_attack_ms"],
|
| 413 |
-
info=translations["compressor_attack_ms_info"],
|
| 414 |
-
interactive=True
|
| 415 |
-
)
|
| 416 |
-
compressor_release_ms = gr.Slider(
|
| 417 |
-
minimum=10,
|
| 418 |
-
maximum=1000,
|
| 419 |
-
step=1,
|
| 420 |
-
value=100,
|
| 421 |
-
label=translations["compressor_release_ms"],
|
| 422 |
-
info=translations["compressor_release_ms_info"],
|
| 423 |
-
interactive=True
|
| 424 |
-
)
|
| 425 |
-
with gr.Row():
|
| 426 |
-
with gr.Accordion(
|
| 427 |
-
translations["more_option"],
|
| 428 |
-
open=True,
|
| 429 |
-
visible=False
|
| 430 |
-
) as more_accordion:
|
| 431 |
-
with gr.Row():
|
| 432 |
-
fade = gr.Checkbox(
|
| 433 |
-
label=translations["fade"],
|
| 434 |
-
value=False,
|
| 435 |
-
interactive=True
|
| 436 |
-
)
|
| 437 |
-
bass_or_treble = gr.Checkbox(
|
| 438 |
-
label=translations["bass_or_treble"],
|
| 439 |
-
value=False,
|
| 440 |
-
interactive=True
|
| 441 |
-
)
|
| 442 |
-
limiter = gr.Checkbox(
|
| 443 |
-
label=translations["limiter"],
|
| 444 |
-
value=False,
|
| 445 |
-
interactive=True
|
| 446 |
-
)
|
| 447 |
-
resample_checkbox = gr.Checkbox(
|
| 448 |
-
label=translations["resample"],
|
| 449 |
-
value=False,
|
| 450 |
-
interactive=True
|
| 451 |
-
)
|
| 452 |
-
with gr.Row():
|
| 453 |
-
distortion_checkbox = gr.Checkbox(
|
| 454 |
-
label=translations["distortion"],
|
| 455 |
-
value=False,
|
| 456 |
-
interactive=True
|
| 457 |
-
)
|
| 458 |
-
gain_checkbox = gr.Checkbox(
|
| 459 |
-
label=translations["gain"],
|
| 460 |
-
value=False,
|
| 461 |
-
interactive=True
|
| 462 |
-
)
|
| 463 |
-
bitcrush_checkbox = gr.Checkbox(
|
| 464 |
-
label=translations["bitcrush"],
|
| 465 |
-
value=False,
|
| 466 |
-
interactive=True
|
| 467 |
-
)
|
| 468 |
-
clipping_checkbox = gr.Checkbox(
|
| 469 |
-
label=translations["clipping"],
|
| 470 |
-
value=False,
|
| 471 |
-
interactive=True
|
| 472 |
-
)
|
| 473 |
-
with gr.Accordion(
|
| 474 |
-
translations["fade"],
|
| 475 |
-
open=True,
|
| 476 |
-
visible=False
|
| 477 |
-
) as fade_accordion:
|
| 478 |
-
with gr.Row():
|
| 479 |
-
fade_in = gr.Slider(
|
| 480 |
-
minimum=0,
|
| 481 |
-
maximum=10000,
|
| 482 |
-
step=100,
|
| 483 |
-
value=0,
|
| 484 |
-
label=translations["fade_in"],
|
| 485 |
-
info=translations["fade_in_info"],
|
| 486 |
-
interactive=True
|
| 487 |
-
)
|
| 488 |
-
fade_out = gr.Slider(
|
| 489 |
-
minimum=0,
|
| 490 |
-
maximum=10000,
|
| 491 |
-
step=100,
|
| 492 |
-
value=0,
|
| 493 |
-
label=translations["fade_out"],
|
| 494 |
-
info=translations["fade_out_info"],
|
| 495 |
-
interactive=True
|
| 496 |
-
)
|
| 497 |
-
with gr.Accordion(
|
| 498 |
-
translations["bass_or_treble"],
|
| 499 |
-
open=True,
|
| 500 |
-
visible=False
|
| 501 |
-
) as bass_treble_accordion:
|
| 502 |
-
with gr.Row():
|
| 503 |
-
bass_boost = gr.Slider(
|
| 504 |
-
minimum=0,
|
| 505 |
-
maximum=20,
|
| 506 |
-
step=1,
|
| 507 |
-
value=0,
|
| 508 |
-
label=translations["bass_boost"],
|
| 509 |
-
info=translations["bass_boost_info"],
|
| 510 |
-
interactive=True
|
| 511 |
-
)
|
| 512 |
-
bass_frequency = gr.Slider(
|
| 513 |
-
minimum=20,
|
| 514 |
-
maximum=200,
|
| 515 |
-
step=10,
|
| 516 |
-
value=100,
|
| 517 |
-
label=translations["bass_frequency"],
|
| 518 |
-
info=translations["bass_frequency_info"],
|
| 519 |
-
interactive=True
|
| 520 |
-
)
|
| 521 |
-
with gr.Row():
|
| 522 |
-
treble_boost = gr.Slider(
|
| 523 |
-
minimum=0,
|
| 524 |
-
maximum=20,
|
| 525 |
-
step=1,
|
| 526 |
-
value=0,
|
| 527 |
-
label=translations["treble_boost"],
|
| 528 |
-
info=translations["treble_boost_info"],
|
| 529 |
-
interactive=True
|
| 530 |
-
)
|
| 531 |
-
treble_frequency = gr.Slider(
|
| 532 |
-
minimum=1000,
|
| 533 |
-
maximum=10000,
|
| 534 |
-
step=500,
|
| 535 |
-
value=3000,
|
| 536 |
-
label=translations["treble_frequency"],
|
| 537 |
-
info=translations["treble_frequency_info"],
|
| 538 |
-
interactive=True
|
| 539 |
-
)
|
| 540 |
-
with gr.Accordion(
|
| 541 |
-
translations["limiter"],
|
| 542 |
-
open=True,
|
| 543 |
-
visible=False
|
| 544 |
-
) as limiter_accordion:
|
| 545 |
-
with gr.Row():
|
| 546 |
-
limiter_threshold_db = gr.Slider(
|
| 547 |
-
minimum=-60,
|
| 548 |
-
maximum=0,
|
| 549 |
-
step=1,
|
| 550 |
-
value=-1,
|
| 551 |
-
label=translations["limiter_threshold_db"],
|
| 552 |
-
info=translations["limiter_threshold_db_info"],
|
| 553 |
-
interactive=True
|
| 554 |
-
)
|
| 555 |
-
limiter_release_ms = gr.Slider(
|
| 556 |
-
minimum=10,
|
| 557 |
-
maximum=1000,
|
| 558 |
-
step=1,
|
| 559 |
-
value=100,
|
| 560 |
-
label=translations["limiter_release_ms"],
|
| 561 |
-
info=translations["limiter_release_ms_info"],
|
| 562 |
-
interactive=True
|
| 563 |
-
)
|
| 564 |
-
with gr.Column():
|
| 565 |
-
pitch_shift_semitones = gr.Slider(
|
| 566 |
-
minimum=-20,
|
| 567 |
-
maximum=20,
|
| 568 |
-
step=1,
|
| 569 |
-
value=0,
|
| 570 |
-
label=translations["pitch"],
|
| 571 |
-
info=translations["pitch_info"],
|
| 572 |
-
interactive=True
|
| 573 |
-
)
|
| 574 |
-
audio_effect_resample_sr = gr.Radio(
|
| 575 |
-
choices=[0]+sample_rate_choice,
|
| 576 |
-
value=0,
|
| 577 |
-
label=translations["resample"],
|
| 578 |
-
info=translations["resample_info"],
|
| 579 |
-
interactive=True,
|
| 580 |
-
visible=False
|
| 581 |
-
)
|
| 582 |
-
distortion_drive_db = gr.Slider(
|
| 583 |
-
minimum=0,
|
| 584 |
-
maximum=50,
|
| 585 |
-
step=1,
|
| 586 |
-
value=20,
|
| 587 |
-
label=translations["distortion"],
|
| 588 |
-
info=translations["distortion_info"],
|
| 589 |
-
interactive=True,
|
| 590 |
-
visible=False
|
| 591 |
-
)
|
| 592 |
-
gain_db = gr.Slider(
|
| 593 |
-
minimum=-60,
|
| 594 |
-
maximum=60,
|
| 595 |
-
step=1,
|
| 596 |
-
value=0,
|
| 597 |
-
label=translations["gain"],
|
| 598 |
-
info=translations["gain_info"],
|
| 599 |
-
interactive=True,
|
| 600 |
-
visible=False
|
| 601 |
-
)
|
| 602 |
-
clipping_threshold_db = gr.Slider(
|
| 603 |
-
minimum=-60,
|
| 604 |
-
maximum=0,
|
| 605 |
-
step=1,
|
| 606 |
-
value=-1,
|
| 607 |
-
label=translations["clipping_threshold_db"],
|
| 608 |
-
info=translations["clipping_threshold_db_info"],
|
| 609 |
-
interactive=True,
|
| 610 |
-
visible=False
|
| 611 |
-
)
|
| 612 |
-
bitcrush_bit_depth = gr.Slider(
|
| 613 |
-
minimum=1,
|
| 614 |
-
maximum=24,
|
| 615 |
-
step=1,
|
| 616 |
-
value=16,
|
| 617 |
-
label=translations["bitcrush_bit_depth"],
|
| 618 |
-
info=translations["bitcrush_bit_depth_info"],
|
| 619 |
-
interactive=True,
|
| 620 |
-
visible=False
|
| 621 |
-
)
|
| 622 |
-
with gr.Row():
|
| 623 |
-
gr.Markdown(translations["output_audio"])
|
| 624 |
-
with gr.Row():
|
| 625 |
-
audio_play_input = gr.Audio(
|
| 626 |
-
interactive=False,
|
| 627 |
-
label=translations["input_audio"],
|
| 628 |
-
**audio_params
|
| 629 |
-
)
|
| 630 |
-
audio_play_output = gr.Audio(
|
| 631 |
-
interactive=False,
|
| 632 |
-
label=translations["output_audio"],
|
| 633 |
-
**audio_params
|
| 634 |
-
)
|
| 635 |
-
with gr.Row():
|
| 636 |
-
reverb_check_box.change(
|
| 637 |
-
fn=visible,
|
| 638 |
-
inputs=[
|
| 639 |
-
reverb_check_box
|
| 640 |
-
],
|
| 641 |
-
outputs=[
|
| 642 |
-
reverb_accordion
|
| 643 |
-
]
|
| 644 |
-
)
|
| 645 |
-
chorus_check_box.change(
|
| 646 |
-
fn=visible,
|
| 647 |
-
inputs=[
|
| 648 |
-
chorus_check_box
|
| 649 |
-
],
|
| 650 |
-
outputs=[
|
| 651 |
-
chorus_accordion
|
| 652 |
-
]
|
| 653 |
-
)
|
| 654 |
-
delay_check_box.change(
|
| 655 |
-
fn=visible,
|
| 656 |
-
inputs=[
|
| 657 |
-
delay_check_box
|
| 658 |
-
],
|
| 659 |
-
outputs=[
|
| 660 |
-
delay_accordion
|
| 661 |
-
]
|
| 662 |
-
)
|
| 663 |
-
with gr.Row():
|
| 664 |
-
compressor_check_box.change(
|
| 665 |
-
fn=visible,
|
| 666 |
-
inputs=[
|
| 667 |
-
compressor_check_box
|
| 668 |
-
],
|
| 669 |
-
outputs=[
|
| 670 |
-
compressor_accordion
|
| 671 |
-
]
|
| 672 |
-
)
|
| 673 |
-
phaser_check_box.change(
|
| 674 |
-
fn=visible,
|
| 675 |
-
inputs=[
|
| 676 |
-
phaser_check_box
|
| 677 |
-
],
|
| 678 |
-
outputs=[
|
| 679 |
-
phaser_accordion
|
| 680 |
-
]
|
| 681 |
-
)
|
| 682 |
-
more_options.change(
|
| 683 |
-
fn=visible,
|
| 684 |
-
inputs=[
|
| 685 |
-
more_options
|
| 686 |
-
],
|
| 687 |
-
outputs=[
|
| 688 |
-
more_accordion
|
| 689 |
-
]
|
| 690 |
-
)
|
| 691 |
-
with gr.Row():
|
| 692 |
-
fade.change(
|
| 693 |
-
fn=visible,
|
| 694 |
-
inputs=[
|
| 695 |
-
fade
|
| 696 |
-
],
|
| 697 |
-
outputs=[
|
| 698 |
-
fade_accordion
|
| 699 |
-
]
|
| 700 |
-
)
|
| 701 |
-
bass_or_treble.change(
|
| 702 |
-
fn=visible,
|
| 703 |
-
inputs=[
|
| 704 |
-
bass_or_treble
|
| 705 |
-
],
|
| 706 |
-
outputs=[
|
| 707 |
-
bass_treble_accordion
|
| 708 |
-
]
|
| 709 |
-
)
|
| 710 |
-
limiter.change(
|
| 711 |
-
fn=visible,
|
| 712 |
-
inputs=[
|
| 713 |
-
limiter
|
| 714 |
-
],
|
| 715 |
-
outputs=[
|
| 716 |
-
limiter_accordion
|
| 717 |
-
]
|
| 718 |
-
)
|
| 719 |
-
resample_checkbox.change(
|
| 720 |
-
fn=visible,
|
| 721 |
-
inputs=[
|
| 722 |
-
resample_checkbox
|
| 723 |
-
],
|
| 724 |
-
outputs=[
|
| 725 |
-
audio_effect_resample_sr
|
| 726 |
-
]
|
| 727 |
-
)
|
| 728 |
-
with gr.Row():
|
| 729 |
-
distortion_checkbox.change(
|
| 730 |
-
fn=visible,
|
| 731 |
-
inputs=[
|
| 732 |
-
distortion_checkbox
|
| 733 |
-
],
|
| 734 |
-
outputs=[
|
| 735 |
-
distortion_drive_db
|
| 736 |
-
]
|
| 737 |
-
)
|
| 738 |
-
gain_checkbox.change(
|
| 739 |
-
fn=visible,
|
| 740 |
-
inputs=[
|
| 741 |
-
gain_checkbox
|
| 742 |
-
],
|
| 743 |
-
outputs=[
|
| 744 |
-
gain_db
|
| 745 |
-
]
|
| 746 |
-
)
|
| 747 |
-
clipping_checkbox.change(
|
| 748 |
-
fn=visible,
|
| 749 |
-
inputs=[
|
| 750 |
-
clipping_checkbox
|
| 751 |
-
],
|
| 752 |
-
outputs=[
|
| 753 |
-
clipping_threshold_db
|
| 754 |
-
]
|
| 755 |
-
)
|
| 756 |
-
with gr.Row():
|
| 757 |
-
bitcrush_checkbox.change(
|
| 758 |
-
fn=visible,
|
| 759 |
-
inputs=[
|
| 760 |
-
bitcrush_checkbox
|
| 761 |
-
],
|
| 762 |
-
outputs=[
|
| 763 |
-
bitcrush_bit_depth
|
| 764 |
-
]
|
| 765 |
-
)
|
| 766 |
-
upload_audio_files.upload(
|
| 767 |
-
fn=lambda audio_in: [
|
| 768 |
-
shutil_move(audio.name, configs["audios_path"])
|
| 769 |
-
for audio in audio_in
|
| 770 |
-
][0],
|
| 771 |
-
inputs=[
|
| 772 |
-
upload_audio_files
|
| 773 |
-
],
|
| 774 |
-
outputs=[
|
| 775 |
-
audio_in_path
|
| 776 |
-
]
|
| 777 |
-
)
|
| 778 |
-
audio_in_path.change(
|
| 779 |
-
fn=lambda audio: audio if audio else None,
|
| 780 |
-
inputs=[
|
| 781 |
-
audio_in_path
|
| 782 |
-
],
|
| 783 |
-
outputs=[
|
| 784 |
-
audio_play_input
|
| 785 |
-
]
|
| 786 |
-
)
|
| 787 |
-
with gr.Row():
|
| 788 |
-
audio_effects_refresh.click(
|
| 789 |
-
fn=lambda a, b: [
|
| 790 |
-
change_audios_choices(a),
|
| 791 |
-
change_audios_choices(b)
|
| 792 |
-
],
|
| 793 |
-
inputs=[
|
| 794 |
-
audio_in_path,
|
| 795 |
-
audio_combination_input
|
| 796 |
-
],
|
| 797 |
-
outputs=[
|
| 798 |
-
audio_in_path,
|
| 799 |
-
audio_combination_input
|
| 800 |
-
]
|
| 801 |
-
)
|
| 802 |
-
audio_combination.change(
|
| 803 |
-
fn=visible,
|
| 804 |
-
inputs=[
|
| 805 |
-
audio_combination
|
| 806 |
-
],
|
| 807 |
-
outputs=[
|
| 808 |
-
audio_combination_input
|
| 809 |
-
]
|
| 810 |
-
)
|
| 811 |
-
audio_combination.change(
|
| 812 |
-
fn=lambda a: [
|
| 813 |
-
visible(a)
|
| 814 |
-
for _ in range(2)
|
| 815 |
-
],
|
| 816 |
-
inputs=[
|
| 817 |
-
audio_combination
|
| 818 |
-
],
|
| 819 |
-
outputs=[
|
| 820 |
-
main_volume,
|
| 821 |
-
combine_volume
|
| 822 |
-
]
|
| 823 |
-
)
|
| 824 |
-
with gr.Row():
|
| 825 |
-
more_options.change(
|
| 826 |
-
fn=lambda: [False]*8,
|
| 827 |
-
inputs=[],
|
| 828 |
-
outputs=[
|
| 829 |
-
fade,
|
| 830 |
-
bass_or_treble,
|
| 831 |
-
limiter,
|
| 832 |
-
resample_checkbox,
|
| 833 |
-
distortion_checkbox,
|
| 834 |
-
gain_checkbox,
|
| 835 |
-
clipping_checkbox,
|
| 836 |
-
bitcrush_checkbox
|
| 837 |
-
]
|
| 838 |
-
)
|
| 839 |
-
upload_presets.upload(
|
| 840 |
-
fn=lambda presets_in: [
|
| 841 |
-
shutil_move(preset.name, configs["presets_path"])
|
| 842 |
-
for preset in presets_in
|
| 843 |
-
][0],
|
| 844 |
-
inputs=[
|
| 845 |
-
upload_presets
|
| 846 |
-
],
|
| 847 |
-
outputs=[
|
| 848 |
-
presets_name
|
| 849 |
-
]
|
| 850 |
-
)
|
| 851 |
-
refresh_preset_button.click(
|
| 852 |
-
fn=change_effect_preset_choices,
|
| 853 |
-
inputs=[],
|
| 854 |
-
outputs=[
|
| 855 |
-
presets_name
|
| 856 |
-
]
|
| 857 |
-
)
|
| 858 |
-
with gr.Row():
|
| 859 |
-
reverb_check_box.change(
|
| 860 |
-
fn=lambda a, b, c, d, e, f: visible(max([a, b, c, d, e, f])),
|
| 861 |
-
inputs=[
|
| 862 |
-
reverb_check_box,
|
| 863 |
-
chorus_check_box,
|
| 864 |
-
delay_check_box,
|
| 865 |
-
phaser_check_box,
|
| 866 |
-
compressor_check_box,
|
| 867 |
-
more_options
|
| 868 |
-
],
|
| 869 |
-
outputs=[accordion]
|
| 870 |
-
)
|
| 871 |
-
chorus_check_box.change(
|
| 872 |
-
fn=lambda a, b, c, d, e, f: visible(max([a, b, c, d, e, f])),
|
| 873 |
-
inputs=[
|
| 874 |
-
reverb_check_box,
|
| 875 |
-
chorus_check_box,
|
| 876 |
-
delay_check_box,
|
| 877 |
-
phaser_check_box,
|
| 878 |
-
compressor_check_box,
|
| 879 |
-
more_options
|
| 880 |
-
],
|
| 881 |
-
outputs=[accordion]
|
| 882 |
-
)
|
| 883 |
-
delay_check_box.change(
|
| 884 |
-
fn=lambda a, b, c, d, e, f: visible(max([a, b, c, d, e, f])),
|
| 885 |
-
inputs=[
|
| 886 |
-
reverb_check_box,
|
| 887 |
-
chorus_check_box,
|
| 888 |
-
delay_check_box,
|
| 889 |
-
phaser_check_box,
|
| 890 |
-
compressor_check_box,
|
| 891 |
-
more_options
|
| 892 |
-
],
|
| 893 |
-
outputs=[accordion]
|
| 894 |
-
)
|
| 895 |
-
with gr.Row():
|
| 896 |
-
phaser_check_box.change(
|
| 897 |
-
fn=lambda a, b, c, d, e, f: visible(max([a, b, c, d, e, f])),
|
| 898 |
-
inputs=[
|
| 899 |
-
reverb_check_box,
|
| 900 |
-
chorus_check_box,
|
| 901 |
-
delay_check_box,
|
| 902 |
-
phaser_check_box,
|
| 903 |
-
compressor_check_box,
|
| 904 |
-
more_options
|
| 905 |
-
],
|
| 906 |
-
outputs=[accordion]
|
| 907 |
-
)
|
| 908 |
-
compressor_check_box.change(
|
| 909 |
-
fn=lambda a, b, c, d, e, f: visible(max([a, b, c, d, e, f])),
|
| 910 |
-
inputs=[
|
| 911 |
-
reverb_check_box,
|
| 912 |
-
chorus_check_box,
|
| 913 |
-
delay_check_box,
|
| 914 |
-
phaser_check_box,
|
| 915 |
-
compressor_check_box,
|
| 916 |
-
more_options
|
| 917 |
-
],
|
| 918 |
-
outputs=[accordion]
|
| 919 |
-
)
|
| 920 |
-
more_options.change(
|
| 921 |
-
fn=lambda a, b, c, d, e, f: visible(max([a, b, c, d, e, f])),
|
| 922 |
-
inputs=[
|
| 923 |
-
reverb_check_box,
|
| 924 |
-
chorus_check_box,
|
| 925 |
-
delay_check_box,
|
| 926 |
-
phaser_check_box,
|
| 927 |
-
compressor_check_box,
|
| 928 |
-
more_options
|
| 929 |
-
],
|
| 930 |
-
outputs=[accordion]
|
| 931 |
-
)
|
| 932 |
-
with gr.Row():
|
| 933 |
-
load_preset_button.click(
|
| 934 |
-
fn=audio_effect_load_presets,
|
| 935 |
-
inputs=[
|
| 936 |
-
presets_name,
|
| 937 |
-
resample_checkbox,
|
| 938 |
-
audio_effect_resample_sr,
|
| 939 |
-
chorus_depth,
|
| 940 |
-
chorus_rate_hz,
|
| 941 |
-
chorus_mix,
|
| 942 |
-
chorus_center_delay_ms,
|
| 943 |
-
chorus_feedback,
|
| 944 |
-
distortion_drive_db,
|
| 945 |
-
reverb_room_size,
|
| 946 |
-
reverb_damping,
|
| 947 |
-
reverb_wet_level,
|
| 948 |
-
reverb_dry_level,
|
| 949 |
-
reverb_width,
|
| 950 |
-
reverb_freeze_mode,
|
| 951 |
-
pitch_shift_semitones,
|
| 952 |
-
delay_second,
|
| 953 |
-
delay_feedback,
|
| 954 |
-
delay_mix,
|
| 955 |
-
compressor_threshold_db,
|
| 956 |
-
compressor_ratio,
|
| 957 |
-
compressor_attack_ms,
|
| 958 |
-
compressor_release_ms,
|
| 959 |
-
limiter_threshold_db,
|
| 960 |
-
limiter_release_ms,
|
| 961 |
-
gain_db,
|
| 962 |
-
bitcrush_bit_depth,
|
| 963 |
-
clipping_threshold_db,
|
| 964 |
-
phaser_rate_hz,
|
| 965 |
-
phaser_depth,
|
| 966 |
-
phaser_centre_frequency_hz,
|
| 967 |
-
phaser_feedback,
|
| 968 |
-
phaser_mix,
|
| 969 |
-
bass_boost,
|
| 970 |
-
bass_frequency,
|
| 971 |
-
treble_boost,
|
| 972 |
-
treble_frequency,
|
| 973 |
-
fade_in,
|
| 974 |
-
fade_out,
|
| 975 |
-
chorus_check_box,
|
| 976 |
-
distortion_checkbox,
|
| 977 |
-
reverb_check_box,
|
| 978 |
-
delay_check_box,
|
| 979 |
-
compressor_check_box,
|
| 980 |
-
limiter,
|
| 981 |
-
gain_checkbox,
|
| 982 |
-
bitcrush_checkbox,
|
| 983 |
-
clipping_checkbox,
|
| 984 |
-
phaser_check_box,
|
| 985 |
-
bass_or_treble,
|
| 986 |
-
fade
|
| 987 |
-
],
|
| 988 |
-
outputs=[
|
| 989 |
-
resample_checkbox,
|
| 990 |
-
audio_effect_resample_sr,
|
| 991 |
-
chorus_depth,
|
| 992 |
-
chorus_rate_hz,
|
| 993 |
-
chorus_mix,
|
| 994 |
-
chorus_center_delay_ms,
|
| 995 |
-
chorus_feedback,
|
| 996 |
-
distortion_drive_db,
|
| 997 |
-
reverb_room_size,
|
| 998 |
-
reverb_damping,
|
| 999 |
-
reverb_wet_level,
|
| 1000 |
-
reverb_dry_level,
|
| 1001 |
-
reverb_width,
|
| 1002 |
-
reverb_freeze_mode,
|
| 1003 |
-
pitch_shift_semitones,
|
| 1004 |
-
delay_second,
|
| 1005 |
-
delay_feedback,
|
| 1006 |
-
delay_mix,
|
| 1007 |
-
compressor_threshold_db,
|
| 1008 |
-
compressor_ratio,
|
| 1009 |
-
compressor_attack_ms,
|
| 1010 |
-
compressor_release_ms,
|
| 1011 |
-
limiter_threshold_db,
|
| 1012 |
-
limiter_release_ms,
|
| 1013 |
-
gain_db,
|
| 1014 |
-
bitcrush_bit_depth,
|
| 1015 |
-
clipping_threshold_db,
|
| 1016 |
-
phaser_rate_hz,
|
| 1017 |
-
phaser_depth,
|
| 1018 |
-
phaser_centre_frequency_hz,
|
| 1019 |
-
phaser_feedback,
|
| 1020 |
-
phaser_mix,
|
| 1021 |
-
bass_boost,
|
| 1022 |
-
bass_frequency,
|
| 1023 |
-
treble_boost,
|
| 1024 |
-
treble_frequency,
|
| 1025 |
-
fade_in,
|
| 1026 |
-
fade_out,
|
| 1027 |
-
chorus_check_box,
|
| 1028 |
-
distortion_checkbox,
|
| 1029 |
-
reverb_check_box,
|
| 1030 |
-
delay_check_box,
|
| 1031 |
-
compressor_check_box,
|
| 1032 |
-
limiter,
|
| 1033 |
-
gain_checkbox,
|
| 1034 |
-
bitcrush_checkbox,
|
| 1035 |
-
clipping_checkbox,
|
| 1036 |
-
phaser_check_box,
|
| 1037 |
-
bass_or_treble,
|
| 1038 |
-
fade
|
| 1039 |
-
],
|
| 1040 |
-
)
|
| 1041 |
-
save_file_button.click(
|
| 1042 |
-
fn=audio_effect_save_presets,
|
| 1043 |
-
inputs=[
|
| 1044 |
-
name_to_save_file,
|
| 1045 |
-
resample_checkbox,
|
| 1046 |
-
audio_effect_resample_sr,
|
| 1047 |
-
chorus_depth,
|
| 1048 |
-
chorus_rate_hz,
|
| 1049 |
-
chorus_mix,
|
| 1050 |
-
chorus_center_delay_ms,
|
| 1051 |
-
chorus_feedback,
|
| 1052 |
-
distortion_drive_db,
|
| 1053 |
-
reverb_room_size,
|
| 1054 |
-
reverb_damping,
|
| 1055 |
-
reverb_wet_level,
|
| 1056 |
-
reverb_dry_level,
|
| 1057 |
-
reverb_width,
|
| 1058 |
-
reverb_freeze_mode,
|
| 1059 |
-
pitch_shift_semitones,
|
| 1060 |
-
delay_second,
|
| 1061 |
-
delay_feedback,
|
| 1062 |
-
delay_mix,
|
| 1063 |
-
compressor_threshold_db,
|
| 1064 |
-
compressor_ratio,
|
| 1065 |
-
compressor_attack_ms,
|
| 1066 |
-
compressor_release_ms,
|
| 1067 |
-
limiter_threshold_db,
|
| 1068 |
-
limiter_release_ms,
|
| 1069 |
-
gain_db,
|
| 1070 |
-
bitcrush_bit_depth,
|
| 1071 |
-
clipping_threshold_db,
|
| 1072 |
-
phaser_rate_hz,
|
| 1073 |
-
phaser_depth,
|
| 1074 |
-
phaser_centre_frequency_hz,
|
| 1075 |
-
phaser_feedback,
|
| 1076 |
-
phaser_mix,
|
| 1077 |
-
bass_boost,
|
| 1078 |
-
bass_frequency,
|
| 1079 |
-
treble_boost,
|
| 1080 |
-
treble_frequency,
|
| 1081 |
-
fade_in,
|
| 1082 |
-
fade_out,
|
| 1083 |
-
chorus_check_box,
|
| 1084 |
-
distortion_checkbox,
|
| 1085 |
-
reverb_check_box,
|
| 1086 |
-
delay_check_box,
|
| 1087 |
-
compressor_check_box,
|
| 1088 |
-
limiter,
|
| 1089 |
-
gain_checkbox,
|
| 1090 |
-
bitcrush_checkbox,
|
| 1091 |
-
clipping_checkbox,
|
| 1092 |
-
phaser_check_box,
|
| 1093 |
-
bass_or_treble,
|
| 1094 |
-
fade
|
| 1095 |
-
],
|
| 1096 |
-
outputs=[
|
| 1097 |
-
presets_name
|
| 1098 |
-
]
|
| 1099 |
-
)
|
| 1100 |
-
apply_effects_button.click(
|
| 1101 |
-
fn=audio_effects,
|
| 1102 |
-
inputs=[
|
| 1103 |
-
audio_in_path,
|
| 1104 |
-
audio_out_path,
|
| 1105 |
-
resample_checkbox,
|
| 1106 |
-
audio_effect_resample_sr,
|
| 1107 |
-
chorus_depth,
|
| 1108 |
-
chorus_rate_hz,
|
| 1109 |
-
chorus_mix,
|
| 1110 |
-
chorus_center_delay_ms,
|
| 1111 |
-
chorus_feedback,
|
| 1112 |
-
distortion_drive_db,
|
| 1113 |
-
reverb_room_size,
|
| 1114 |
-
reverb_damping,
|
| 1115 |
-
reverb_wet_level,
|
| 1116 |
-
reverb_dry_level,
|
| 1117 |
-
reverb_width,
|
| 1118 |
-
reverb_freeze_mode,
|
| 1119 |
-
pitch_shift_semitones,
|
| 1120 |
-
delay_second,
|
| 1121 |
-
delay_feedback,
|
| 1122 |
-
delay_mix,
|
| 1123 |
-
compressor_threshold_db,
|
| 1124 |
-
compressor_ratio,
|
| 1125 |
-
compressor_attack_ms,
|
| 1126 |
-
compressor_release_ms,
|
| 1127 |
-
limiter_threshold_db,
|
| 1128 |
-
limiter_release_ms,
|
| 1129 |
-
gain_db,
|
| 1130 |
-
bitcrush_bit_depth,
|
| 1131 |
-
clipping_threshold_db,
|
| 1132 |
-
phaser_rate_hz,
|
| 1133 |
-
phaser_depth,
|
| 1134 |
-
phaser_centre_frequency_hz,
|
| 1135 |
-
phaser_feedback,
|
| 1136 |
-
phaser_mix,
|
| 1137 |
-
bass_boost,
|
| 1138 |
-
bass_frequency,
|
| 1139 |
-
treble_boost,
|
| 1140 |
-
treble_frequency,
|
| 1141 |
-
fade_in,
|
| 1142 |
-
fade_out,
|
| 1143 |
-
audio_output_format,
|
| 1144 |
-
chorus_check_box,
|
| 1145 |
-
distortion_checkbox,
|
| 1146 |
-
reverb_check_box,
|
| 1147 |
-
delay_check_box,
|
| 1148 |
-
compressor_check_box,
|
| 1149 |
-
limiter,
|
| 1150 |
-
gain_checkbox,
|
| 1151 |
-
bitcrush_checkbox,
|
| 1152 |
-
clipping_checkbox,
|
| 1153 |
-
phaser_check_box,
|
| 1154 |
-
bass_or_treble,
|
| 1155 |
-
fade,
|
| 1156 |
-
audio_combination,
|
| 1157 |
-
audio_combination_input,
|
| 1158 |
-
main_volume,
|
| 1159 |
-
combine_volume
|
| 1160 |
-
],
|
| 1161 |
-
outputs=[
|
| 1162 |
-
audio_play_output
|
| 1163 |
-
],
|
| 1164 |
-
api_name="audio_effects"
|
| 1165 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/editing/child/quirk.py
DELETED
|
@@ -1,130 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.editing import apply_voice_quirk
|
| 9 |
-
|
| 10 |
-
from main.app.core.ui import (
|
| 11 |
-
shutil_move,
|
| 12 |
-
change_audios_choices
|
| 13 |
-
)
|
| 14 |
-
|
| 15 |
-
from main.app.variables import (
|
| 16 |
-
configs,
|
| 17 |
-
file_types,
|
| 18 |
-
audio_params,
|
| 19 |
-
translations,
|
| 20 |
-
paths_for_files,
|
| 21 |
-
export_format_choices
|
| 22 |
-
)
|
| 23 |
-
|
| 24 |
-
def quirk_tab():
|
| 25 |
-
with gr.Row():
|
| 26 |
-
gr.Markdown(translations["quirk_markdown"])
|
| 27 |
-
with gr.Row():
|
| 28 |
-
input_audio_play = gr.Audio(
|
| 29 |
-
interactive=False,
|
| 30 |
-
label=translations["input_audio"],
|
| 31 |
-
**audio_params
|
| 32 |
-
)
|
| 33 |
-
with gr.Row():
|
| 34 |
-
quirk_choice = gr.Radio(
|
| 35 |
-
label=translations["quirk_label"],
|
| 36 |
-
info=translations["quirk_label_info"],
|
| 37 |
-
choices=list(translations["quirk_choice"].keys()),
|
| 38 |
-
interactive=True,
|
| 39 |
-
value=list(translations["quirk_choice"].keys())[0]
|
| 40 |
-
)
|
| 41 |
-
with gr.Row():
|
| 42 |
-
apply_quirk_button = gr.Button(
|
| 43 |
-
translations["apply"],
|
| 44 |
-
variant="primary"
|
| 45 |
-
)
|
| 46 |
-
with gr.Row():
|
| 47 |
-
with gr.Accordion(translations["input_output"], open=False):
|
| 48 |
-
with gr.Row():
|
| 49 |
-
quirk_upload_audio = gr.Files(
|
| 50 |
-
label=translations["drop_audio"],
|
| 51 |
-
file_types=file_types
|
| 52 |
-
)
|
| 53 |
-
with gr.Column():
|
| 54 |
-
quirk_export_format = gr.Radio(
|
| 55 |
-
label=translations["export_format"],
|
| 56 |
-
info=translations["export_info"],
|
| 57 |
-
choices=export_format_choices,
|
| 58 |
-
value="wav",
|
| 59 |
-
interactive=True
|
| 60 |
-
)
|
| 61 |
-
quirk_input_path = gr.Dropdown(
|
| 62 |
-
label=translations["audio_path"],
|
| 63 |
-
value="",
|
| 64 |
-
choices=paths_for_files,
|
| 65 |
-
info=translations["provide_audio"],
|
| 66 |
-
allow_custom_value=True,
|
| 67 |
-
interactive=True
|
| 68 |
-
)
|
| 69 |
-
quirk_output_path = gr.Textbox(
|
| 70 |
-
label=translations["output_path"],
|
| 71 |
-
value="audios/output.wav",
|
| 72 |
-
placeholder="audios/output.wav",
|
| 73 |
-
info=translations["output_path_info"],
|
| 74 |
-
interactive=True
|
| 75 |
-
)
|
| 76 |
-
with gr.Column():
|
| 77 |
-
quirk_refresh = gr.Button(
|
| 78 |
-
translations["refresh"]
|
| 79 |
-
)
|
| 80 |
-
with gr.Row():
|
| 81 |
-
output_audio_play = gr.Audio(
|
| 82 |
-
interactive=False,
|
| 83 |
-
label=translations["output_audio"],
|
| 84 |
-
**audio_params
|
| 85 |
-
)
|
| 86 |
-
with gr.Row():
|
| 87 |
-
quirk_upload_audio.upload(
|
| 88 |
-
fn=lambda audio_in: [
|
| 89 |
-
shutil_move(audio.name, configs["audios_path"])
|
| 90 |
-
for audio in audio_in
|
| 91 |
-
][0],
|
| 92 |
-
inputs=[
|
| 93 |
-
quirk_upload_audio
|
| 94 |
-
],
|
| 95 |
-
outputs=[
|
| 96 |
-
quirk_input_path
|
| 97 |
-
]
|
| 98 |
-
)
|
| 99 |
-
quirk_input_path.change(
|
| 100 |
-
fn=lambda audio: audio if audio else None,
|
| 101 |
-
inputs=[
|
| 102 |
-
quirk_input_path
|
| 103 |
-
],
|
| 104 |
-
outputs=[
|
| 105 |
-
input_audio_play
|
| 106 |
-
]
|
| 107 |
-
)
|
| 108 |
-
quirk_refresh.click(
|
| 109 |
-
fn=change_audios_choices,
|
| 110 |
-
inputs=[
|
| 111 |
-
quirk_input_path
|
| 112 |
-
],
|
| 113 |
-
outputs=[
|
| 114 |
-
quirk_input_path
|
| 115 |
-
]
|
| 116 |
-
)
|
| 117 |
-
with gr.Row():
|
| 118 |
-
apply_quirk_button.click(
|
| 119 |
-
fn=apply_voice_quirk,
|
| 120 |
-
inputs=[
|
| 121 |
-
quirk_input_path,
|
| 122 |
-
quirk_choice,
|
| 123 |
-
quirk_output_path,
|
| 124 |
-
quirk_export_format
|
| 125 |
-
],
|
| 126 |
-
outputs=[
|
| 127 |
-
output_audio_play
|
| 128 |
-
],
|
| 129 |
-
api_name="quirk"
|
| 130 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/editing/editing.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.variables import (
|
| 9 |
-
configs,
|
| 10 |
-
translations
|
| 11 |
-
)
|
| 12 |
-
|
| 13 |
-
def editing_tab():
|
| 14 |
-
with gr.TabItem(translations["editing"]):
|
| 15 |
-
if configs.get("effects_tab", True):
|
| 16 |
-
from main.app.tabs.editing.child.audio_effects import audio_effects_tab
|
| 17 |
-
|
| 18 |
-
with gr.TabItem(translations["audio_effects"]):
|
| 19 |
-
gr.Markdown(translations["apply_audio_effects"])
|
| 20 |
-
audio_effects_tab()
|
| 21 |
-
|
| 22 |
-
if configs.get("quirk_tab", True):
|
| 23 |
-
from main.app.tabs.editing.child.quirk import quirk_tab
|
| 24 |
-
|
| 25 |
-
with gr.TabItem(translations["quirk"]):
|
| 26 |
-
gr.Markdown(translations["quirk_info"])
|
| 27 |
-
quirk_tab()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/extra/child/analyzer.py
DELETED
|
@@ -1,94 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.tools.analyzer import analyze_audio
|
| 9 |
-
from main.app.core.ui import change_audios_choices, shutil_move
|
| 10 |
-
from main.app.variables import translations, paths_for_files, audio_params, file_types, configs
|
| 11 |
-
|
| 12 |
-
def analyzer_tab():
|
| 13 |
-
with gr.Row():
|
| 14 |
-
gr.Markdown(translations["analyzer_markdown_2"])
|
| 15 |
-
with gr.Row():
|
| 16 |
-
with gr.Accordion(
|
| 17 |
-
translations["input_output"],
|
| 18 |
-
open=False
|
| 19 |
-
):
|
| 20 |
-
input_audio = gr.Dropdown(
|
| 21 |
-
label=translations["audio_path"],
|
| 22 |
-
value="",
|
| 23 |
-
choices=paths_for_files,
|
| 24 |
-
info=translations["provide_audio"],
|
| 25 |
-
allow_custom_value=True,
|
| 26 |
-
interactive=True
|
| 27 |
-
)
|
| 28 |
-
upload_audio_file = gr.Files(
|
| 29 |
-
label=translations["drop_audio"],
|
| 30 |
-
file_types=file_types
|
| 31 |
-
)
|
| 32 |
-
with gr.Row():
|
| 33 |
-
play_audio = gr.Audio(
|
| 34 |
-
interactive=False,
|
| 35 |
-
label=translations["input_audio"],
|
| 36 |
-
**audio_params
|
| 37 |
-
)
|
| 38 |
-
with gr.Row():
|
| 39 |
-
refresh_audio = gr.Button(
|
| 40 |
-
translations["refresh"]
|
| 41 |
-
)
|
| 42 |
-
with gr.Row():
|
| 43 |
-
get_info_button = gr.Button(
|
| 44 |
-
value=translations["read_audio"],
|
| 45 |
-
variant="primary"
|
| 46 |
-
)
|
| 47 |
-
with gr.Row():
|
| 48 |
-
output_info = gr.Textbox(
|
| 49 |
-
label=translations["output_information"],
|
| 50 |
-
value="",
|
| 51 |
-
max_lines=8,
|
| 52 |
-
interactive=False,
|
| 53 |
-
)
|
| 54 |
-
with gr.Row():
|
| 55 |
-
image_output = gr.Image(
|
| 56 |
-
interactive=False
|
| 57 |
-
)
|
| 58 |
-
with gr.Row():
|
| 59 |
-
get_info_button.click(
|
| 60 |
-
fn=analyze_audio,
|
| 61 |
-
inputs=[input_audio],
|
| 62 |
-
outputs=[output_info, image_output],
|
| 63 |
-
)
|
| 64 |
-
input_audio.change(
|
| 65 |
-
fn=lambda audio: audio if os.path.isfile(audio) else None,
|
| 66 |
-
inputs=[
|
| 67 |
-
input_audio
|
| 68 |
-
],
|
| 69 |
-
outputs=[
|
| 70 |
-
play_audio
|
| 71 |
-
]
|
| 72 |
-
)
|
| 73 |
-
refresh_audio.click(
|
| 74 |
-
fn=change_audios_choices,
|
| 75 |
-
inputs=[
|
| 76 |
-
input_audio
|
| 77 |
-
],
|
| 78 |
-
outputs=[
|
| 79 |
-
input_audio
|
| 80 |
-
]
|
| 81 |
-
)
|
| 82 |
-
with gr.Row():
|
| 83 |
-
upload_audio_file.upload(
|
| 84 |
-
fn=lambda audio_in: [
|
| 85 |
-
shutil_move(audio.name, configs["audios_path"])
|
| 86 |
-
for audio in audio_in
|
| 87 |
-
][0],
|
| 88 |
-
inputs=[
|
| 89 |
-
upload_audio_file
|
| 90 |
-
],
|
| 91 |
-
outputs=[
|
| 92 |
-
input_audio
|
| 93 |
-
]
|
| 94 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/extra/child/convert_model_onnx.py
DELETED
|
@@ -1,93 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.model_utils import onnx_export
|
| 9 |
-
|
| 10 |
-
from main.app.core.ui import (
|
| 11 |
-
visible,
|
| 12 |
-
shutil_move,
|
| 13 |
-
change_models_choices
|
| 14 |
-
)
|
| 15 |
-
|
| 16 |
-
from main.app.variables import (
|
| 17 |
-
configs,
|
| 18 |
-
model_name,
|
| 19 |
-
translations
|
| 20 |
-
)
|
| 21 |
-
|
| 22 |
-
def convert_onnx_model_tab():
|
| 23 |
-
with gr.Row():
|
| 24 |
-
gr.Markdown(translations["pytorch2onnx_markdown"])
|
| 25 |
-
with gr.Row():
|
| 26 |
-
model_pth_upload = gr.File(
|
| 27 |
-
label=translations["drop_model"],
|
| 28 |
-
file_types=[".pth"]
|
| 29 |
-
)
|
| 30 |
-
with gr.Accordion(
|
| 31 |
-
label=translations["model_name"],
|
| 32 |
-
open=True
|
| 33 |
-
):
|
| 34 |
-
with gr.Row():
|
| 35 |
-
model_pth_path = gr.Dropdown(
|
| 36 |
-
label=translations["model_name"],
|
| 37 |
-
choices=model_name,
|
| 38 |
-
value=model_name[0] if len(model_name) >= 1 else "",
|
| 39 |
-
interactive=True,
|
| 40 |
-
allow_custom_value=True
|
| 41 |
-
)
|
| 42 |
-
with gr.Row():
|
| 43 |
-
refresh_model = gr.Button(
|
| 44 |
-
translations["refresh"]
|
| 45 |
-
)
|
| 46 |
-
with gr.Row():
|
| 47 |
-
convert_onnx_button = gr.Button(
|
| 48 |
-
translations["convert_model"],
|
| 49 |
-
variant="primary",
|
| 50 |
-
scale=2
|
| 51 |
-
)
|
| 52 |
-
with gr.Row():
|
| 53 |
-
output_model_file = gr.File(
|
| 54 |
-
label=translations["output_model_path"],
|
| 55 |
-
file_types=[".onnx"],
|
| 56 |
-
interactive=False,
|
| 57 |
-
visible=False
|
| 58 |
-
)
|
| 59 |
-
with gr.Row():
|
| 60 |
-
model_pth_upload.upload(
|
| 61 |
-
fn=lambda model_pth_upload: shutil_move(model_pth_upload.name, configs["weights_path"]),
|
| 62 |
-
inputs=[
|
| 63 |
-
model_pth_upload
|
| 64 |
-
],
|
| 65 |
-
outputs=[
|
| 66 |
-
model_pth_path
|
| 67 |
-
]
|
| 68 |
-
)
|
| 69 |
-
refresh_model.click(
|
| 70 |
-
fn=lambda: change_models_choices()[0],
|
| 71 |
-
inputs=[],
|
| 72 |
-
outputs=[
|
| 73 |
-
model_pth_path
|
| 74 |
-
]
|
| 75 |
-
)
|
| 76 |
-
with gr.Row():
|
| 77 |
-
convert_onnx_button.click(
|
| 78 |
-
fn=onnx_export,
|
| 79 |
-
inputs=[
|
| 80 |
-
model_pth_path
|
| 81 |
-
],
|
| 82 |
-
outputs=[
|
| 83 |
-
output_model_file
|
| 84 |
-
],
|
| 85 |
-
api_name="model_onnx_export"
|
| 86 |
-
)
|
| 87 |
-
convert_onnx_button.click(
|
| 88 |
-
fn=lambda: visible(True),
|
| 89 |
-
inputs=[],
|
| 90 |
-
outputs=[
|
| 91 |
-
output_model_file
|
| 92 |
-
]
|
| 93 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/extra/child/convert_model_svc.py
DELETED
|
@@ -1,128 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.model_utils import svc_export
|
| 9 |
-
|
| 10 |
-
from main.app.core.ui import (
|
| 11 |
-
visible,
|
| 12 |
-
shutil_move,
|
| 13 |
-
change_models_choices
|
| 14 |
-
)
|
| 15 |
-
|
| 16 |
-
from main.app.variables import (
|
| 17 |
-
configs,
|
| 18 |
-
model_name,
|
| 19 |
-
translations
|
| 20 |
-
)
|
| 21 |
-
|
| 22 |
-
def convert_svc_model_tab():
|
| 23 |
-
with gr.Row():
|
| 24 |
-
gr.Markdown(translations["convert_model_svc_markdown_2"])
|
| 25 |
-
with gr.Row():
|
| 26 |
-
delete_when_success = gr.Checkbox(
|
| 27 |
-
label=translations["delete_when_success"],
|
| 28 |
-
value=True,
|
| 29 |
-
interactive=True
|
| 30 |
-
)
|
| 31 |
-
with gr.Row():
|
| 32 |
-
model_pth_upload = gr.File(
|
| 33 |
-
label=translations["drop_model"],
|
| 34 |
-
file_types=[".pth"]
|
| 35 |
-
)
|
| 36 |
-
config_upload = gr.File(
|
| 37 |
-
label=translations["drop_json"],
|
| 38 |
-
file_types=[".json"]
|
| 39 |
-
)
|
| 40 |
-
with gr.Accordion(
|
| 41 |
-
label=translations["model_name"],
|
| 42 |
-
open=True
|
| 43 |
-
):
|
| 44 |
-
with gr.Row():
|
| 45 |
-
model_pth_path = gr.Dropdown(
|
| 46 |
-
label=translations["model_name"],
|
| 47 |
-
choices=model_name,
|
| 48 |
-
value=model_name[0] if len(model_name) >= 1 else "",
|
| 49 |
-
interactive=True,
|
| 50 |
-
allow_custom_value=True
|
| 51 |
-
)
|
| 52 |
-
config_path = gr.Textbox(
|
| 53 |
-
label=translations["config_path"],
|
| 54 |
-
value="",
|
| 55 |
-
placeholder="config.json",
|
| 56 |
-
interactive=True
|
| 57 |
-
)
|
| 58 |
-
with gr.Row():
|
| 59 |
-
modelname = gr.Textbox(
|
| 60 |
-
label=translations["modelname"],
|
| 61 |
-
value="",
|
| 62 |
-
placeholder=translations["modelname"],
|
| 63 |
-
interactive=True
|
| 64 |
-
)
|
| 65 |
-
with gr.Row():
|
| 66 |
-
refresh_model = gr.Button(
|
| 67 |
-
translations["refresh"]
|
| 68 |
-
)
|
| 69 |
-
with gr.Row():
|
| 70 |
-
convert_svc_button = gr.Button(
|
| 71 |
-
translations["convert_model_svc"],
|
| 72 |
-
variant="primary",
|
| 73 |
-
scale=2
|
| 74 |
-
)
|
| 75 |
-
with gr.Row():
|
| 76 |
-
output_model_file = gr.File(
|
| 77 |
-
label=translations["output_model_path"],
|
| 78 |
-
file_types=[".pth", ".onnx"],
|
| 79 |
-
interactive=False,
|
| 80 |
-
visible=False
|
| 81 |
-
)
|
| 82 |
-
with gr.Row():
|
| 83 |
-
model_pth_upload.upload(
|
| 84 |
-
fn=lambda model_pth_upload: shutil_move(model_pth_upload.name, configs["weights_path"]),
|
| 85 |
-
inputs=[
|
| 86 |
-
model_pth_upload
|
| 87 |
-
],
|
| 88 |
-
outputs=[
|
| 89 |
-
model_pth_path
|
| 90 |
-
]
|
| 91 |
-
)
|
| 92 |
-
config_upload.upload(
|
| 93 |
-
fn=lambda config: shutil_move(config.name, configs["weights_path"]),
|
| 94 |
-
inputs=[
|
| 95 |
-
config_upload
|
| 96 |
-
],
|
| 97 |
-
outputs=[
|
| 98 |
-
config_path
|
| 99 |
-
]
|
| 100 |
-
)
|
| 101 |
-
refresh_model.click(
|
| 102 |
-
fn=lambda: change_models_choices()[0],
|
| 103 |
-
inputs=[],
|
| 104 |
-
outputs=[
|
| 105 |
-
model_pth_path
|
| 106 |
-
]
|
| 107 |
-
)
|
| 108 |
-
with gr.Row():
|
| 109 |
-
convert_svc_button.click(
|
| 110 |
-
fn=svc_export,
|
| 111 |
-
inputs=[
|
| 112 |
-
model_pth_path,
|
| 113 |
-
config_path,
|
| 114 |
-
modelname,
|
| 115 |
-
delete_when_success
|
| 116 |
-
],
|
| 117 |
-
outputs=[
|
| 118 |
-
output_model_file
|
| 119 |
-
],
|
| 120 |
-
api_name="model_svc_export"
|
| 121 |
-
)
|
| 122 |
-
convert_svc_button.click(
|
| 123 |
-
fn=lambda: visible(True),
|
| 124 |
-
inputs=[],
|
| 125 |
-
outputs=[
|
| 126 |
-
output_model_file
|
| 127 |
-
]
|
| 128 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/extra/child/create_srt.py
DELETED
|
@@ -1,145 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.csrt import create_srt
|
| 9 |
-
|
| 10 |
-
from main.app.core.ui import (
|
| 11 |
-
shutil_move,
|
| 12 |
-
change_audios_choices
|
| 13 |
-
)
|
| 14 |
-
|
| 15 |
-
from main.app.variables import (
|
| 16 |
-
configs,
|
| 17 |
-
file_types,
|
| 18 |
-
translations,
|
| 19 |
-
audio_params,
|
| 20 |
-
whisper_model,
|
| 21 |
-
paths_for_files,
|
| 22 |
-
whisper_languages
|
| 23 |
-
)
|
| 24 |
-
|
| 25 |
-
def create_srt_tab():
|
| 26 |
-
with gr.Row():
|
| 27 |
-
gr.Markdown(translations["create_srt_markdown_2"])
|
| 28 |
-
with gr.Row():
|
| 29 |
-
with gr.Column():
|
| 30 |
-
srt_content = gr.Textbox(
|
| 31 |
-
label=translations["srt_content"],
|
| 32 |
-
value="",
|
| 33 |
-
lines=11,
|
| 34 |
-
max_lines=11,
|
| 35 |
-
interactive=False
|
| 36 |
-
)
|
| 37 |
-
with gr.Column():
|
| 38 |
-
with gr.Group():
|
| 39 |
-
language = gr.Dropdown(
|
| 40 |
-
label=translations["whisper_languages"],
|
| 41 |
-
value="vi",
|
| 42 |
-
choices=whisper_languages,
|
| 43 |
-
info=translations["whisper_languages_info"],
|
| 44 |
-
interactive=True
|
| 45 |
-
)
|
| 46 |
-
model_size = gr.Radio(
|
| 47 |
-
label=translations["model_size"],
|
| 48 |
-
info=translations["model_size_info"],
|
| 49 |
-
choices=whisper_model,
|
| 50 |
-
value=whisper_model[0],
|
| 51 |
-
interactive=True
|
| 52 |
-
)
|
| 53 |
-
with gr.Row():
|
| 54 |
-
convert_button = gr.Button(
|
| 55 |
-
translations["convert_audio"],
|
| 56 |
-
variant="primary"
|
| 57 |
-
)
|
| 58 |
-
with gr.Row():
|
| 59 |
-
with gr.Accordion(
|
| 60 |
-
translations["input_output"],
|
| 61 |
-
open=False
|
| 62 |
-
):
|
| 63 |
-
with gr.Column():
|
| 64 |
-
input_audio = gr.Dropdown(
|
| 65 |
-
label=translations["audio_path"],
|
| 66 |
-
value="",
|
| 67 |
-
choices=paths_for_files,
|
| 68 |
-
info=translations["provide_audio"],
|
| 69 |
-
allow_custom_value=True,
|
| 70 |
-
interactive=True
|
| 71 |
-
)
|
| 72 |
-
output_file = gr.Textbox(
|
| 73 |
-
label=translations["srt_path_output_file"],
|
| 74 |
-
value="srt/output.srt",
|
| 75 |
-
placeholder="srt/output.srt",
|
| 76 |
-
interactive=True
|
| 77 |
-
)
|
| 78 |
-
with gr.Column():
|
| 79 |
-
refresh = gr.Button(
|
| 80 |
-
translations["refresh"]
|
| 81 |
-
)
|
| 82 |
-
with gr.Row():
|
| 83 |
-
upload_audio_files = gr.Files(
|
| 84 |
-
label=translations["drop_audio"],
|
| 85 |
-
file_types=file_types
|
| 86 |
-
)
|
| 87 |
-
with gr.Row():
|
| 88 |
-
play_audio = gr.Audio(
|
| 89 |
-
interactive=False,
|
| 90 |
-
label=translations["input_audio"],
|
| 91 |
-
**audio_params
|
| 92 |
-
)
|
| 93 |
-
with gr.Row():
|
| 94 |
-
output_srt = gr.File(
|
| 95 |
-
label=translations["srt_output_file"],
|
| 96 |
-
file_types=[".srt"],
|
| 97 |
-
interactive=False,
|
| 98 |
-
visible=False
|
| 99 |
-
)
|
| 100 |
-
with gr.Row():
|
| 101 |
-
upload_audio_files.upload(
|
| 102 |
-
fn=lambda audio_in: [
|
| 103 |
-
shutil_move(audio.name, configs["audios_path"])
|
| 104 |
-
for audio in audio_in
|
| 105 |
-
][0],
|
| 106 |
-
inputs=[
|
| 107 |
-
upload_audio_files
|
| 108 |
-
],
|
| 109 |
-
outputs=[
|
| 110 |
-
input_audio
|
| 111 |
-
]
|
| 112 |
-
)
|
| 113 |
-
input_audio.change(
|
| 114 |
-
fn=lambda audio: audio if os.path.isfile(audio) else None,
|
| 115 |
-
inputs=[
|
| 116 |
-
input_audio
|
| 117 |
-
],
|
| 118 |
-
outputs=[
|
| 119 |
-
play_audio
|
| 120 |
-
]
|
| 121 |
-
)
|
| 122 |
-
refresh.click(
|
| 123 |
-
fn=change_audios_choices,
|
| 124 |
-
inputs=[
|
| 125 |
-
input_audio
|
| 126 |
-
],
|
| 127 |
-
outputs=[
|
| 128 |
-
input_audio
|
| 129 |
-
]
|
| 130 |
-
)
|
| 131 |
-
with gr.Row():
|
| 132 |
-
convert_button.click(
|
| 133 |
-
fn=create_srt,
|
| 134 |
-
inputs=[
|
| 135 |
-
model_size,
|
| 136 |
-
input_audio,
|
| 137 |
-
output_file,
|
| 138 |
-
language
|
| 139 |
-
],
|
| 140 |
-
outputs=[
|
| 141 |
-
output_srt,
|
| 142 |
-
srt_content
|
| 143 |
-
],
|
| 144 |
-
api_name="create_srt"
|
| 145 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/extra/child/f0_extract.py
DELETED
|
@@ -1,225 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.f0_extract import f0_extract
|
| 9 |
-
|
| 10 |
-
from main.app.core.ui import (
|
| 11 |
-
visible,
|
| 12 |
-
unlock_f0,
|
| 13 |
-
shutil_move,
|
| 14 |
-
change_audios_choices
|
| 15 |
-
)
|
| 16 |
-
|
| 17 |
-
from main.app.variables import (
|
| 18 |
-
configs,
|
| 19 |
-
method_f0,
|
| 20 |
-
file_types,
|
| 21 |
-
audio_params,
|
| 22 |
-
translations,
|
| 23 |
-
paths_for_files
|
| 24 |
-
)
|
| 25 |
-
|
| 26 |
-
def f0_extract_tab():
|
| 27 |
-
with gr.Row():
|
| 28 |
-
gr.Markdown(translations["f0_extractor_markdown_2"])
|
| 29 |
-
with gr.Row():
|
| 30 |
-
extractor_button = gr.Button(
|
| 31 |
-
translations["extract_button"].replace("2. ", ""),
|
| 32 |
-
variant="primary"
|
| 33 |
-
)
|
| 34 |
-
with gr.Row():
|
| 35 |
-
with gr.Column():
|
| 36 |
-
upload_audio_file = gr.Files(
|
| 37 |
-
label=translations["drop_audio"],
|
| 38 |
-
file_types=file_types
|
| 39 |
-
)
|
| 40 |
-
audioplay = gr.Audio(
|
| 41 |
-
interactive=False,
|
| 42 |
-
label=translations["input_audio"],
|
| 43 |
-
**audio_params
|
| 44 |
-
)
|
| 45 |
-
with gr.Column():
|
| 46 |
-
with gr.Accordion(
|
| 47 |
-
translations["f0_method"],
|
| 48 |
-
open=False
|
| 49 |
-
):
|
| 50 |
-
with gr.Group():
|
| 51 |
-
with gr.Row():
|
| 52 |
-
predictor_onnx = gr.Checkbox(
|
| 53 |
-
label=translations["predictor_onnx"],
|
| 54 |
-
value=False,
|
| 55 |
-
interactive=True
|
| 56 |
-
)
|
| 57 |
-
unlock_full_method = gr.Checkbox(
|
| 58 |
-
label=translations["f0_unlock"],
|
| 59 |
-
value=False,
|
| 60 |
-
interactive=True
|
| 61 |
-
)
|
| 62 |
-
autotune = gr.Checkbox(
|
| 63 |
-
label=translations["autotune"],
|
| 64 |
-
value=False,
|
| 65 |
-
interactive=True
|
| 66 |
-
)
|
| 67 |
-
proposal_pitch = gr.Checkbox(
|
| 68 |
-
label=translations["proposal_pitch"],
|
| 69 |
-
value=False,
|
| 70 |
-
interactive=True
|
| 71 |
-
)
|
| 72 |
-
f0_method_extract = gr.Radio(
|
| 73 |
-
label=translations["f0_method"],
|
| 74 |
-
info=translations["f0_method_info"],
|
| 75 |
-
choices=[m for m in method_f0 if m != "hybrid"],
|
| 76 |
-
value="rmvpe",
|
| 77 |
-
interactive=True
|
| 78 |
-
)
|
| 79 |
-
pitch = gr.Slider(
|
| 80 |
-
minimum=-24,
|
| 81 |
-
maximum=24,
|
| 82 |
-
step=1,
|
| 83 |
-
info=translations["pitch_info"],
|
| 84 |
-
label=translations["pitch"],
|
| 85 |
-
value=0,
|
| 86 |
-
interactive=True
|
| 87 |
-
)
|
| 88 |
-
f0_autotune_strength = gr.Slider(
|
| 89 |
-
minimum=0,
|
| 90 |
-
maximum=1,
|
| 91 |
-
label=translations["autotune_rate"],
|
| 92 |
-
info=translations["autotune_rate_info"],
|
| 93 |
-
value=1,
|
| 94 |
-
step=0.1,
|
| 95 |
-
interactive=True,
|
| 96 |
-
visible=False
|
| 97 |
-
)
|
| 98 |
-
proposal_pitch_threshold = gr.Slider(
|
| 99 |
-
minimum=50.0,
|
| 100 |
-
maximum=1200.0,
|
| 101 |
-
label=translations["proposal_pitch_threshold"],
|
| 102 |
-
info=translations["proposal_pitch_threshold_info"],
|
| 103 |
-
value=255.0,
|
| 104 |
-
step=0.1,
|
| 105 |
-
interactive=True,
|
| 106 |
-
visible=False
|
| 107 |
-
)
|
| 108 |
-
filter_radius = gr.Slider(
|
| 109 |
-
minimum=0,
|
| 110 |
-
maximum=7,
|
| 111 |
-
label=translations["filter_radius"],
|
| 112 |
-
info=translations["filter_radius_info"],
|
| 113 |
-
value=3,
|
| 114 |
-
step=1,
|
| 115 |
-
interactive=True
|
| 116 |
-
)
|
| 117 |
-
with gr.Accordion(
|
| 118 |
-
translations["audio_path"],
|
| 119 |
-
open=True
|
| 120 |
-
):
|
| 121 |
-
input_audio_path = gr.Dropdown(
|
| 122 |
-
label=translations["audio_path"],
|
| 123 |
-
value="",
|
| 124 |
-
choices=paths_for_files,
|
| 125 |
-
allow_custom_value=True,
|
| 126 |
-
interactive=True
|
| 127 |
-
)
|
| 128 |
-
refresh_audio_button = gr.Button(
|
| 129 |
-
translations["refresh"]
|
| 130 |
-
)
|
| 131 |
-
with gr.Row():
|
| 132 |
-
gr.Markdown("___")
|
| 133 |
-
with gr.Row():
|
| 134 |
-
file_output = gr.File(
|
| 135 |
-
label="",
|
| 136 |
-
file_types=[".txt"],
|
| 137 |
-
interactive=False
|
| 138 |
-
)
|
| 139 |
-
image_output = gr.Image(
|
| 140 |
-
label="",
|
| 141 |
-
interactive=False
|
| 142 |
-
)
|
| 143 |
-
with gr.Row():
|
| 144 |
-
upload_audio_file.upload(
|
| 145 |
-
fn=lambda audio_in: [
|
| 146 |
-
shutil_move(audio.name, configs["audios_path"])
|
| 147 |
-
for audio in audio_in
|
| 148 |
-
][0],
|
| 149 |
-
inputs=[
|
| 150 |
-
upload_audio_file
|
| 151 |
-
],
|
| 152 |
-
outputs=[
|
| 153 |
-
input_audio_path
|
| 154 |
-
]
|
| 155 |
-
)
|
| 156 |
-
input_audio_path.change(
|
| 157 |
-
fn=lambda audio: audio if os.path.isfile(audio) else None,
|
| 158 |
-
inputs=[
|
| 159 |
-
input_audio_path
|
| 160 |
-
],
|
| 161 |
-
outputs=[
|
| 162 |
-
audioplay
|
| 163 |
-
]
|
| 164 |
-
)
|
| 165 |
-
refresh_audio_button.click(
|
| 166 |
-
fn=change_audios_choices,
|
| 167 |
-
inputs=[
|
| 168 |
-
input_audio_path
|
| 169 |
-
],
|
| 170 |
-
outputs=[
|
| 171 |
-
input_audio_path
|
| 172 |
-
]
|
| 173 |
-
)
|
| 174 |
-
with gr.Row():
|
| 175 |
-
autotune.change(
|
| 176 |
-
fn=visible,
|
| 177 |
-
inputs=[
|
| 178 |
-
autotune
|
| 179 |
-
],
|
| 180 |
-
outputs=[
|
| 181 |
-
f0_autotune_strength
|
| 182 |
-
]
|
| 183 |
-
)
|
| 184 |
-
proposal_pitch.change(
|
| 185 |
-
fn=visible,
|
| 186 |
-
inputs=[
|
| 187 |
-
proposal_pitch
|
| 188 |
-
],
|
| 189 |
-
outputs=[
|
| 190 |
-
proposal_pitch_threshold
|
| 191 |
-
]
|
| 192 |
-
)
|
| 193 |
-
with gr.Row():
|
| 194 |
-
unlock_full_method.change(
|
| 195 |
-
fn=lambda method: {
|
| 196 |
-
"choices": [m for m in unlock_f0(method)["choices"] if m != "hybrid"],
|
| 197 |
-
"value": "rmvpe",
|
| 198 |
-
"__type__": "update"
|
| 199 |
-
},
|
| 200 |
-
inputs=[
|
| 201 |
-
unlock_full_method
|
| 202 |
-
],
|
| 203 |
-
outputs=[
|
| 204 |
-
f0_method_extract
|
| 205 |
-
]
|
| 206 |
-
)
|
| 207 |
-
extractor_button.click(
|
| 208 |
-
fn=f0_extract,
|
| 209 |
-
inputs=[
|
| 210 |
-
input_audio_path,
|
| 211 |
-
f0_method_extract,
|
| 212 |
-
predictor_onnx,
|
| 213 |
-
pitch,
|
| 214 |
-
filter_radius,
|
| 215 |
-
autotune,
|
| 216 |
-
f0_autotune_strength,
|
| 217 |
-
proposal_pitch,
|
| 218 |
-
proposal_pitch_threshold
|
| 219 |
-
],
|
| 220 |
-
outputs=[
|
| 221 |
-
file_output,
|
| 222 |
-
image_output
|
| 223 |
-
],
|
| 224 |
-
api_name="f0_extract"
|
| 225 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/extra/child/fushion.py
DELETED
|
@@ -1,132 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.model_utils import fushion_model
|
| 9 |
-
|
| 10 |
-
from main.app.core.ui import (
|
| 11 |
-
visible,
|
| 12 |
-
shutil_move,
|
| 13 |
-
change_models_choices
|
| 14 |
-
)
|
| 15 |
-
|
| 16 |
-
from main.app.variables import (
|
| 17 |
-
configs,
|
| 18 |
-
model_name,
|
| 19 |
-
translations
|
| 20 |
-
)
|
| 21 |
-
|
| 22 |
-
def fushion_tab():
|
| 23 |
-
with gr.Row():
|
| 24 |
-
gr.Markdown(translations["fushion_markdown_2"])
|
| 25 |
-
with gr.Row():
|
| 26 |
-
modelname = gr.Textbox(
|
| 27 |
-
label=translations["modelname"],
|
| 28 |
-
placeholder="Model.pth",
|
| 29 |
-
value="",
|
| 30 |
-
max_lines=2,
|
| 31 |
-
interactive=True
|
| 32 |
-
)
|
| 33 |
-
with gr.Row():
|
| 34 |
-
fushion_button = gr.Button(
|
| 35 |
-
translations["fushion"],
|
| 36 |
-
variant="primary",
|
| 37 |
-
scale=4
|
| 38 |
-
)
|
| 39 |
-
with gr.Column():
|
| 40 |
-
with gr.Row():
|
| 41 |
-
upload_model_1 = gr.File(
|
| 42 |
-
label=f"{translations['model_name']} 1",
|
| 43 |
-
file_types=[".pth"]
|
| 44 |
-
)
|
| 45 |
-
upload_model_2 = gr.File(
|
| 46 |
-
label=f"{translations['model_name']} 2",
|
| 47 |
-
file_types=[".pth"]
|
| 48 |
-
)
|
| 49 |
-
with gr.Row():
|
| 50 |
-
model_path_1 = gr.Dropdown(
|
| 51 |
-
label=translations["model_name"] + " 1",
|
| 52 |
-
choices=model_name,
|
| 53 |
-
value=model_name[0] if len(model_name) >= 1 else "",
|
| 54 |
-
interactive=True,
|
| 55 |
-
allow_custom_value=True
|
| 56 |
-
)
|
| 57 |
-
model_path_2 = gr.Dropdown(
|
| 58 |
-
label=translations["model_name"] + " 2",
|
| 59 |
-
choices=model_name,
|
| 60 |
-
value=model_name[0] if len(model_name) >= 1 else "",
|
| 61 |
-
interactive=True,
|
| 62 |
-
allow_custom_value=True
|
| 63 |
-
)
|
| 64 |
-
with gr.Row():
|
| 65 |
-
refresh_model = gr.Button(
|
| 66 |
-
translations["refresh"]
|
| 67 |
-
)
|
| 68 |
-
with gr.Row():
|
| 69 |
-
ratio = gr.Slider(
|
| 70 |
-
minimum=0,
|
| 71 |
-
maximum=1,
|
| 72 |
-
label=translations["model_ratio"],
|
| 73 |
-
info=translations["model_ratio_info"],
|
| 74 |
-
value=0.5,
|
| 75 |
-
interactive=True
|
| 76 |
-
)
|
| 77 |
-
with gr.Row():
|
| 78 |
-
output_model = gr.File(
|
| 79 |
-
label=translations["output_model_path"],
|
| 80 |
-
file_types=[".pth", ".onnx"],
|
| 81 |
-
interactive=False,
|
| 82 |
-
visible=False
|
| 83 |
-
)
|
| 84 |
-
with gr.Row():
|
| 85 |
-
upload_model_1.upload(
|
| 86 |
-
fn=lambda model: shutil_move(model.name, configs["weights_path"]),
|
| 87 |
-
inputs=[
|
| 88 |
-
upload_model_1
|
| 89 |
-
],
|
| 90 |
-
outputs=[
|
| 91 |
-
model_path_1
|
| 92 |
-
]
|
| 93 |
-
)
|
| 94 |
-
upload_model_2.upload(
|
| 95 |
-
fn=lambda model: shutil_move(model.name, configs["weights_path"]),
|
| 96 |
-
inputs=[
|
| 97 |
-
upload_model_2
|
| 98 |
-
],
|
| 99 |
-
outputs=[
|
| 100 |
-
model_path_2
|
| 101 |
-
]
|
| 102 |
-
)
|
| 103 |
-
refresh_model.click(
|
| 104 |
-
fn=lambda: [change_models_choices()[0] for _ in range(2)],
|
| 105 |
-
inputs=[],
|
| 106 |
-
outputs=[
|
| 107 |
-
model_path_1,
|
| 108 |
-
model_path_2
|
| 109 |
-
]
|
| 110 |
-
)
|
| 111 |
-
with gr.Row():
|
| 112 |
-
fushion_button.click(
|
| 113 |
-
fn=fushion_model,
|
| 114 |
-
inputs=[
|
| 115 |
-
modelname,
|
| 116 |
-
model_path_1,
|
| 117 |
-
model_path_2,
|
| 118 |
-
ratio
|
| 119 |
-
],
|
| 120 |
-
outputs=[
|
| 121 |
-
modelname,
|
| 122 |
-
output_model
|
| 123 |
-
],
|
| 124 |
-
api_name="fushion_model"
|
| 125 |
-
)
|
| 126 |
-
fushion_button.click(
|
| 127 |
-
fn=lambda: visible(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-
from main.app.core.model_utils import model_info
|
| 9 |
-
|
| 10 |
-
from main.app.core.ui import (
|
| 11 |
-
shutil_move,
|
| 12 |
-
change_models_choices
|
| 13 |
-
)
|
| 14 |
-
|
| 15 |
-
from main.app.variables import (
|
| 16 |
-
configs,
|
| 17 |
-
model_name,
|
| 18 |
-
translations,
|
| 19 |
-
)
|
| 20 |
-
|
| 21 |
-
def read_model_tab():
|
| 22 |
-
with gr.Row():
|
| 23 |
-
gr.Markdown(translations["read_model_markdown_2"])
|
| 24 |
-
with gr.Row():
|
| 25 |
-
model = gr.File(
|
| 26 |
-
label=translations["drop_model"],
|
| 27 |
-
file_types=[".pth", ".onnx"]
|
| 28 |
-
)
|
| 29 |
-
with gr.Accordion(
|
| 30 |
-
label=translations["model_name"],
|
| 31 |
-
open=True
|
| 32 |
-
):
|
| 33 |
-
model_path = gr.Dropdown(
|
| 34 |
-
label=translations["model_name"],
|
| 35 |
-
choices=model_name,
|
| 36 |
-
value=model_name[0] if len(model_name) >= 1 else "",
|
| 37 |
-
interactive=True,
|
| 38 |
-
allow_custom_value=True
|
| 39 |
-
)
|
| 40 |
-
with gr.Row():
|
| 41 |
-
refresh_model = gr.Button(
|
| 42 |
-
translations["refresh"]
|
| 43 |
-
)
|
| 44 |
-
with gr.Row():
|
| 45 |
-
read_button = gr.Button(
|
| 46 |
-
translations["readmodel"],
|
| 47 |
-
variant="primary",
|
| 48 |
-
scale=2
|
| 49 |
-
)
|
| 50 |
-
with gr.Row():
|
| 51 |
-
output_info = gr.Textbox(
|
| 52 |
-
label=translations["modelinfo"],
|
| 53 |
-
value="",
|
| 54 |
-
interactive=False,
|
| 55 |
-
lines=10
|
| 56 |
-
)
|
| 57 |
-
with gr.Row():
|
| 58 |
-
model.upload(
|
| 59 |
-
fn=lambda model: shutil_move(model.name, configs["weights_path"]),
|
| 60 |
-
inputs=[
|
| 61 |
-
model
|
| 62 |
-
],
|
| 63 |
-
outputs=[
|
| 64 |
-
model_path
|
| 65 |
-
]
|
| 66 |
-
)
|
| 67 |
-
read_button.click(
|
| 68 |
-
fn=model_info,
|
| 69 |
-
inputs=[
|
| 70 |
-
model_path
|
| 71 |
-
],
|
| 72 |
-
outputs=[
|
| 73 |
-
output_info
|
| 74 |
-
],
|
| 75 |
-
api_name="read_model"
|
| 76 |
-
)
|
| 77 |
-
refresh_model.click(
|
| 78 |
-
fn=lambda: change_models_choices()[0],
|
| 79 |
-
inputs=[],
|
| 80 |
-
outputs=[
|
| 81 |
-
model_path
|
| 82 |
-
]
|
| 83 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/extra/child/settings.py
DELETED
|
@@ -1,217 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.utils import stop_pid
|
| 9 |
-
from main.app.core.ui import change_fp, run_commands
|
| 10 |
-
|
| 11 |
-
from main.app.core.restart import restart
|
| 12 |
-
|
| 13 |
-
from main.app.variables import (
|
| 14 |
-
font,
|
| 15 |
-
theme,
|
| 16 |
-
config,
|
| 17 |
-
configs,
|
| 18 |
-
language,
|
| 19 |
-
translations
|
| 20 |
-
)
|
| 21 |
-
|
| 22 |
-
reload_js = """
|
| 23 |
-
() => {
|
| 24 |
-
function Checking() {
|
| 25 |
-
fetch(window.location.origin)
|
| 26 |
-
.then(response => {
|
| 27 |
-
if (response.ok) {
|
| 28 |
-
location.reload();
|
| 29 |
-
} else {
|
| 30 |
-
setTimeout(Checking, 3000);
|
| 31 |
-
}
|
| 32 |
-
})
|
| 33 |
-
.catch(err => {
|
| 34 |
-
setTimeout(Checking, 3000);
|
| 35 |
-
});
|
| 36 |
-
}
|
| 37 |
-
setTimeout(Checking, 10000);
|
| 38 |
-
}
|
| 39 |
-
"""
|
| 40 |
-
|
| 41 |
-
def settings_tab(app):
|
| 42 |
-
with gr.Row():
|
| 43 |
-
gr.Markdown(translations["settings_markdown_2"])
|
| 44 |
-
with gr.Row():
|
| 45 |
-
toggle_button = gr.Button(
|
| 46 |
-
translations["change_light_dark"],
|
| 47 |
-
variant="secondary",
|
| 48 |
-
scale=2
|
| 49 |
-
)
|
| 50 |
-
with gr.Row():
|
| 51 |
-
with gr.Column():
|
| 52 |
-
language_dropdown = gr.Dropdown(
|
| 53 |
-
label=translations["lang"],
|
| 54 |
-
interactive=True,
|
| 55 |
-
info=translations["lang_restart"],
|
| 56 |
-
choices=configs.get("support_language", "vi-VN"),
|
| 57 |
-
value=language
|
| 58 |
-
)
|
| 59 |
-
with gr.Column():
|
| 60 |
-
theme_dropdown = gr.Dropdown(
|
| 61 |
-
label=translations["theme"],
|
| 62 |
-
interactive=True,
|
| 63 |
-
info=translations["theme_restart"],
|
| 64 |
-
choices=configs.get("themes", theme),
|
| 65 |
-
value=theme,
|
| 66 |
-
allow_custom_value=True
|
| 67 |
-
)
|
| 68 |
-
with gr.Column():
|
| 69 |
-
font_choice = gr.Textbox(
|
| 70 |
-
label=translations["font"],
|
| 71 |
-
info=translations["font_info"],
|
| 72 |
-
value=font,
|
| 73 |
-
interactive=True
|
| 74 |
-
)
|
| 75 |
-
with gr.Row():
|
| 76 |
-
restart_button = gr.Button(
|
| 77 |
-
translations["restart_button"]
|
| 78 |
-
)
|
| 79 |
-
with gr.Row():
|
| 80 |
-
with gr.Column():
|
| 81 |
-
with gr.Group():
|
| 82 |
-
with gr.Row():
|
| 83 |
-
bf16_checkbox = gr.Checkbox(
|
| 84 |
-
label=translations["bf16"],
|
| 85 |
-
value=False,
|
| 86 |
-
interactive=config.device.startswith(("cuda", "xpu")) and config.bf16_support
|
| 87 |
-
)
|
| 88 |
-
tf32_checkbox = gr.Checkbox(
|
| 89 |
-
label=translations["tf32"],
|
| 90 |
-
value=False,
|
| 91 |
-
interactive=config.device.startswith("cuda") and config.tf32_support
|
| 92 |
-
)
|
| 93 |
-
fp_choice = gr.Radio(
|
| 94 |
-
choices=["fp16","fp32"],
|
| 95 |
-
value="fp16" if configs.get("fp16", False) else "fp32",
|
| 96 |
-
label=translations["precision"],
|
| 97 |
-
info=translations["precision_info"],
|
| 98 |
-
interactive=config.allow_is_half
|
| 99 |
-
)
|
| 100 |
-
fp_button = gr.Button(
|
| 101 |
-
translations["update_precision"],
|
| 102 |
-
variant="primary",
|
| 103 |
-
scale=2
|
| 104 |
-
)
|
| 105 |
-
with gr.Row():
|
| 106 |
-
commands = gr.Textbox(
|
| 107 |
-
label=translations["commands"],
|
| 108 |
-
info=translations["commands_info"],
|
| 109 |
-
value="",
|
| 110 |
-
interactive=True
|
| 111 |
-
)
|
| 112 |
-
with gr.Row():
|
| 113 |
-
run_commands_button = gr.Button(
|
| 114 |
-
translations["run_commands"]
|
| 115 |
-
)
|
| 116 |
-
with gr.Row():
|
| 117 |
-
with gr.Column():
|
| 118 |
-
with gr.Accordion(translations["stop"], open=False, visible=True):
|
| 119 |
-
separate_stop = gr.Button(
|
| 120 |
-
translations["stop_separate"]
|
| 121 |
-
)
|
| 122 |
-
convert_stop = gr.Button(
|
| 123 |
-
translations["stop_convert"]
|
| 124 |
-
)
|
| 125 |
-
create_dataset_stop = gr.Button(
|
| 126 |
-
translations["stop_create_dataset"]
|
| 127 |
-
)
|
| 128 |
-
with gr.Accordion(translations["stop_training"], open=False):
|
| 129 |
-
model_name_stop = gr.Textbox(
|
| 130 |
-
label=translations["modelname"],
|
| 131 |
-
info=translations["training_model_name"],
|
| 132 |
-
value="",
|
| 133 |
-
placeholder=translations["modelname"],
|
| 134 |
-
interactive=True
|
| 135 |
-
)
|
| 136 |
-
preprocess_stop = gr.Button(
|
| 137 |
-
translations["stop_preprocess"]
|
| 138 |
-
)
|
| 139 |
-
extract_stop = gr.Button(
|
| 140 |
-
translations["stop_extract"]
|
| 141 |
-
)
|
| 142 |
-
train_stop = gr.Button(
|
| 143 |
-
translations["stop_training"]
|
| 144 |
-
)
|
| 145 |
-
with gr.Row():
|
| 146 |
-
toggle_button.click(
|
| 147 |
-
fn=None,
|
| 148 |
-
js="() => {document.body.classList.toggle('dark')}"
|
| 149 |
-
)
|
| 150 |
-
fp_button.click(
|
| 151 |
-
fn=change_fp,
|
| 152 |
-
inputs=[
|
| 153 |
-
fp_choice,
|
| 154 |
-
bf16_checkbox,
|
| 155 |
-
tf32_checkbox
|
| 156 |
-
],
|
| 157 |
-
outputs=[
|
| 158 |
-
fp_choice
|
| 159 |
-
]
|
| 160 |
-
)
|
| 161 |
-
run_commands_button.click(
|
| 162 |
-
fn=run_commands,
|
| 163 |
-
inputs=[
|
| 164 |
-
commands
|
| 165 |
-
],
|
| 166 |
-
outputs=[]
|
| 167 |
-
)
|
| 168 |
-
with gr.Row():
|
| 169 |
-
restart_button.click(
|
| 170 |
-
fn=lambda lang, theme, font: restart(lang, theme, font, app),
|
| 171 |
-
inputs=[language_dropdown, theme_dropdown, font_choice],
|
| 172 |
-
outputs=[]
|
| 173 |
-
)
|
| 174 |
-
restart_button.click(
|
| 175 |
-
fn=None,
|
| 176 |
-
js=reload_js,
|
| 177 |
-
inputs=[],
|
| 178 |
-
outputs=[]
|
| 179 |
-
)
|
| 180 |
-
with gr.Row():
|
| 181 |
-
separate_stop.click(
|
| 182 |
-
fn=lambda: stop_pid("separate_pid", None, False),
|
| 183 |
-
inputs=[],
|
| 184 |
-
outputs=[]
|
| 185 |
-
)
|
| 186 |
-
convert_stop.click(
|
| 187 |
-
fn=lambda: stop_pid("convert_pid", None, False),
|
| 188 |
-
inputs=[],
|
| 189 |
-
outputs=[]
|
| 190 |
-
)
|
| 191 |
-
create_dataset_stop.click(
|
| 192 |
-
fn=lambda: stop_pid("create_dataset_pid", None, False),
|
| 193 |
-
inputs=[],
|
| 194 |
-
outputs=[]
|
| 195 |
-
)
|
| 196 |
-
with gr.Row():
|
| 197 |
-
preprocess_stop.click(
|
| 198 |
-
fn=lambda model_name_stop: stop_pid("preprocess_pid", model_name_stop, False),
|
| 199 |
-
inputs=[
|
| 200 |
-
model_name_stop
|
| 201 |
-
],
|
| 202 |
-
outputs=[]
|
| 203 |
-
)
|
| 204 |
-
extract_stop.click(
|
| 205 |
-
fn=lambda model_name_stop: stop_pid("extract_pid", model_name_stop, False),
|
| 206 |
-
inputs=[
|
| 207 |
-
model_name_stop
|
| 208 |
-
],
|
| 209 |
-
outputs=[]
|
| 210 |
-
)
|
| 211 |
-
train_stop.click(
|
| 212 |
-
fn=lambda model_name_stop: stop_pid("train_pid", model_name_stop, True),
|
| 213 |
-
inputs=[
|
| 214 |
-
model_name_stop
|
| 215 |
-
],
|
| 216 |
-
outputs=[]
|
| 217 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/extra/extra.py
DELETED
|
@@ -1,62 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.variables import (
|
| 9 |
-
configs,
|
| 10 |
-
translations
|
| 11 |
-
)
|
| 12 |
-
|
| 13 |
-
from main.app.tabs.extra.child.fushion import fushion_tab
|
| 14 |
-
from main.app.tabs.extra.child.analyzer import analyzer_tab
|
| 15 |
-
from main.app.tabs.extra.child.settings import settings_tab
|
| 16 |
-
from main.app.tabs.extra.child.read_model import read_model_tab
|
| 17 |
-
from main.app.tabs.extra.child.f0_extract import f0_extract_tab
|
| 18 |
-
from main.app.tabs.extra.child.create_srt import create_srt_tab
|
| 19 |
-
from main.app.tabs.extra.child.convert_model_svc import convert_svc_model_tab
|
| 20 |
-
from main.app.tabs.extra.child.convert_model_onnx import convert_onnx_model_tab
|
| 21 |
-
|
| 22 |
-
def extra_tab(app):
|
| 23 |
-
with gr.TabItem(translations["extra"]):
|
| 24 |
-
if configs.get("fushion_tab", True):
|
| 25 |
-
with gr.TabItem(translations["fushion"]):
|
| 26 |
-
gr.Markdown(translations["fushion_markdown"])
|
| 27 |
-
fushion_tab()
|
| 28 |
-
|
| 29 |
-
if configs.get("read_tab", True):
|
| 30 |
-
with gr.TabItem(translations["read_model"]):
|
| 31 |
-
gr.Markdown(translations["read_model_markdown"])
|
| 32 |
-
read_model_tab()
|
| 33 |
-
|
| 34 |
-
if configs.get("onnx_tab", True):
|
| 35 |
-
with gr.TabItem(translations["convert_model"]):
|
| 36 |
-
gr.Markdown(translations["pytorch2onnx"])
|
| 37 |
-
convert_onnx_model_tab()
|
| 38 |
-
|
| 39 |
-
if configs.get("svc_tab", True):
|
| 40 |
-
with gr.TabItem(translations["convert_model_svc"]):
|
| 41 |
-
gr.Markdown(translations["convert_model_svc_markdown"])
|
| 42 |
-
convert_svc_model_tab()
|
| 43 |
-
|
| 44 |
-
if configs.get("f0_extractor_tab", True):
|
| 45 |
-
with gr.TabItem(translations["f0_extractor_tab"]):
|
| 46 |
-
gr.Markdown(translations["f0_extractor_markdown"])
|
| 47 |
-
f0_extract_tab()
|
| 48 |
-
|
| 49 |
-
if configs.get("create_srt_tab", True):
|
| 50 |
-
with gr.TabItem(translations["create_srt_tab"]):
|
| 51 |
-
gr.Markdown(translations["create_srt_markdown"])
|
| 52 |
-
create_srt_tab()
|
| 53 |
-
|
| 54 |
-
if configs.get("analyzer_tab", True):
|
| 55 |
-
with gr.TabItem(translations["analyzer_tab"]):
|
| 56 |
-
gr.Markdown(translations["analyzer_markdown"])
|
| 57 |
-
analyzer_tab()
|
| 58 |
-
|
| 59 |
-
if configs.get("settings_tab", True):
|
| 60 |
-
with gr.TabItem(translations["settings"]):
|
| 61 |
-
gr.Markdown(translations["settings_markdown"])
|
| 62 |
-
settings_tab(app)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/inference/child/convert.py
DELETED
|
@@ -1,1142 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.presets import (
|
| 9 |
-
load_presets,
|
| 10 |
-
save_presets
|
| 11 |
-
)
|
| 12 |
-
|
| 13 |
-
from main.app.core.inference import (
|
| 14 |
-
convert_audio,
|
| 15 |
-
convert_selection
|
| 16 |
-
)
|
| 17 |
-
|
| 18 |
-
from main.app.variables import (
|
| 19 |
-
configs,
|
| 20 |
-
f0_file,
|
| 21 |
-
method_f0,
|
| 22 |
-
file_types,
|
| 23 |
-
model_name,
|
| 24 |
-
index_path,
|
| 25 |
-
audio_params,
|
| 26 |
-
presets_file,
|
| 27 |
-
translations,
|
| 28 |
-
embedders_mode,
|
| 29 |
-
embedders_model,
|
| 30 |
-
paths_for_files,
|
| 31 |
-
sample_rate_choice,
|
| 32 |
-
hybrid_f0_method,
|
| 33 |
-
export_format_choices,
|
| 34 |
-
)
|
| 35 |
-
|
| 36 |
-
from main.app.core.ui import (
|
| 37 |
-
visible,
|
| 38 |
-
unlock_f0,
|
| 39 |
-
get_index,
|
| 40 |
-
shutil_move,
|
| 41 |
-
hoplength_show,
|
| 42 |
-
change_f0_choices,
|
| 43 |
-
index_strength_show,
|
| 44 |
-
change_embedders_mode,
|
| 45 |
-
change_models_choices,
|
| 46 |
-
change_preset_choices,
|
| 47 |
-
change_audios_choices,
|
| 48 |
-
valueFalse_interactive,
|
| 49 |
-
change_backing_choices,
|
| 50 |
-
get_speakers_id_and_architecture
|
| 51 |
-
)
|
| 52 |
-
|
| 53 |
-
def convert_tab():
|
| 54 |
-
with gr.Row():
|
| 55 |
-
gr.Markdown(translations["convert_info"])
|
| 56 |
-
with gr.Row():
|
| 57 |
-
with gr.Column():
|
| 58 |
-
with gr.Group():
|
| 59 |
-
with gr.Row():
|
| 60 |
-
cleaner = gr.Checkbox(
|
| 61 |
-
label=translations["clear_audio"],
|
| 62 |
-
value=False,
|
| 63 |
-
interactive=True
|
| 64 |
-
)
|
| 65 |
-
autotune = gr.Checkbox(
|
| 66 |
-
label=translations["autotune"],
|
| 67 |
-
value=False,
|
| 68 |
-
interactive=True
|
| 69 |
-
)
|
| 70 |
-
use_audio = gr.Checkbox(
|
| 71 |
-
label=translations["use_audio"],
|
| 72 |
-
value=False,
|
| 73 |
-
interactive=True
|
| 74 |
-
)
|
| 75 |
-
checkpointing = gr.Checkbox(
|
| 76 |
-
label=translations["memory_efficient_training"],
|
| 77 |
-
value=False,
|
| 78 |
-
interactive=True
|
| 79 |
-
)
|
| 80 |
-
with gr.Row():
|
| 81 |
-
use_original = gr.Checkbox(
|
| 82 |
-
label=translations["convert_original"],
|
| 83 |
-
value=False,
|
| 84 |
-
interactive=True,
|
| 85 |
-
visible=False
|
| 86 |
-
)
|
| 87 |
-
convert_backing = gr.Checkbox(
|
| 88 |
-
label=translations["convert_backing"],
|
| 89 |
-
value=False,
|
| 90 |
-
interactive=True,
|
| 91 |
-
visible=False
|
| 92 |
-
)
|
| 93 |
-
not_merge_backing = gr.Checkbox(
|
| 94 |
-
label=translations["not_merge_backing"],
|
| 95 |
-
value=False,
|
| 96 |
-
interactive=True,
|
| 97 |
-
visible=False
|
| 98 |
-
)
|
| 99 |
-
merge_instrument = gr.Checkbox(
|
| 100 |
-
label=translations["merge_instruments"],
|
| 101 |
-
value=False,
|
| 102 |
-
interactive=True,
|
| 103 |
-
visible=False
|
| 104 |
-
)
|
| 105 |
-
with gr.Row():
|
| 106 |
-
pitch = gr.Slider(
|
| 107 |
-
minimum=-24,
|
| 108 |
-
maximum=24,
|
| 109 |
-
step=1,
|
| 110 |
-
info=translations["pitch_info"],
|
| 111 |
-
label=translations["pitch"],
|
| 112 |
-
value=0,
|
| 113 |
-
interactive=True
|
| 114 |
-
)
|
| 115 |
-
clean_strength = gr.Slider(
|
| 116 |
-
label=translations["clean_strength"],
|
| 117 |
-
info=translations["clean_strength_info"],
|
| 118 |
-
minimum=0,
|
| 119 |
-
maximum=1,
|
| 120 |
-
value=0.5,
|
| 121 |
-
step=0.1,
|
| 122 |
-
interactive=True,
|
| 123 |
-
visible=False
|
| 124 |
-
)
|
| 125 |
-
with gr.Row():
|
| 126 |
-
with gr.Column():
|
| 127 |
-
convert_select_audio = gr.Dropdown(
|
| 128 |
-
label=translations["select_separate"],
|
| 129 |
-
choices=[],
|
| 130 |
-
value="",
|
| 131 |
-
interactive=True,
|
| 132 |
-
allow_custom_value=True,
|
| 133 |
-
visible=False
|
| 134 |
-
)
|
| 135 |
-
convert_select_audio_button = gr.Button(
|
| 136 |
-
translations["convert_audio"],
|
| 137 |
-
visible=False
|
| 138 |
-
)
|
| 139 |
-
with gr.Row():
|
| 140 |
-
with gr.Column():
|
| 141 |
-
convert_audio_button = gr.Button(
|
| 142 |
-
translations["convert_audio"],
|
| 143 |
-
variant="primary"
|
| 144 |
-
)
|
| 145 |
-
with gr.Row():
|
| 146 |
-
with gr.Column():
|
| 147 |
-
drop_audio_file = gr.Files(
|
| 148 |
-
label=translations["drop_audio"],
|
| 149 |
-
file_types=file_types
|
| 150 |
-
)
|
| 151 |
-
play_audio = gr.Audio(
|
| 152 |
-
interactive=False,
|
| 153 |
-
label=translations["input_audio"],
|
| 154 |
-
**audio_params
|
| 155 |
-
)
|
| 156 |
-
with gr.Column():
|
| 157 |
-
with gr.Accordion(
|
| 158 |
-
translations["model_accordion"],
|
| 159 |
-
open=True
|
| 160 |
-
):
|
| 161 |
-
with gr.Row():
|
| 162 |
-
model_pth = gr.Dropdown(
|
| 163 |
-
label=translations["model_name"],
|
| 164 |
-
choices=model_name,
|
| 165 |
-
value=model_name[0] if len(model_name) >= 1 else "",
|
| 166 |
-
interactive=True,
|
| 167 |
-
allow_custom_value=True
|
| 168 |
-
)
|
| 169 |
-
model_index = gr.Dropdown(
|
| 170 |
-
label=translations["index_path"],
|
| 171 |
-
choices=index_path,
|
| 172 |
-
value=index_path[0] if len(index_path) >= 1 else "",
|
| 173 |
-
interactive=True,
|
| 174 |
-
allow_custom_value=True
|
| 175 |
-
)
|
| 176 |
-
with gr.Row():
|
| 177 |
-
refresh_model = gr.Button(
|
| 178 |
-
translations["refresh"]
|
| 179 |
-
)
|
| 180 |
-
with gr.Row():
|
| 181 |
-
index_strength = gr.Slider(
|
| 182 |
-
label=translations["index_strength"],
|
| 183 |
-
info=translations["index_strength_info"],
|
| 184 |
-
minimum=0,
|
| 185 |
-
maximum=1,
|
| 186 |
-
value=0.5,
|
| 187 |
-
step=0.01,
|
| 188 |
-
interactive=True,
|
| 189 |
-
visible=True
|
| 190 |
-
)
|
| 191 |
-
nprobe = gr.Slider(
|
| 192 |
-
label=translations["nprobe"],
|
| 193 |
-
info=translations["nprobe_info"],
|
| 194 |
-
minimum=1,
|
| 195 |
-
maximum=64,
|
| 196 |
-
value=9,
|
| 197 |
-
step=1,
|
| 198 |
-
interactive=True,
|
| 199 |
-
visible=True
|
| 200 |
-
)
|
| 201 |
-
with gr.Row():
|
| 202 |
-
sid_dict, architecture_dict = get_speakers_id_and_architecture(model_pth.value)
|
| 203 |
-
if sid_dict["visible"] == "hidden": sid_dict["visible"] = False
|
| 204 |
-
if architecture_dict["visible"] == "hidden": architecture_dict["visible"] = False
|
| 205 |
-
|
| 206 |
-
sids = gr.Dropdown(
|
| 207 |
-
label=translations["sids_label"],
|
| 208 |
-
info=translations["sids_info"],
|
| 209 |
-
choices=sid_dict["choices"],
|
| 210 |
-
value=sid_dict["value"],
|
| 211 |
-
visible=sid_dict["visible"],
|
| 212 |
-
interactive=True
|
| 213 |
-
)
|
| 214 |
-
with gr.Accordion(
|
| 215 |
-
translations["input_output"],
|
| 216 |
-
open=False
|
| 217 |
-
):
|
| 218 |
-
with gr.Column():
|
| 219 |
-
export_format = gr.Radio(
|
| 220 |
-
label=translations["export_format"],
|
| 221 |
-
info=translations["export_info"],
|
| 222 |
-
choices=export_format_choices,
|
| 223 |
-
value="wav",
|
| 224 |
-
interactive=True
|
| 225 |
-
)
|
| 226 |
-
input_audio = gr.Dropdown(
|
| 227 |
-
label=translations["audio_path"],
|
| 228 |
-
value="",
|
| 229 |
-
choices=paths_for_files,
|
| 230 |
-
info=translations["provide_audio"],
|
| 231 |
-
allow_custom_value=True,
|
| 232 |
-
interactive=True
|
| 233 |
-
)
|
| 234 |
-
output_audio = gr.Textbox(
|
| 235 |
-
label=translations["output_path"],
|
| 236 |
-
value="audios/output.wav",
|
| 237 |
-
placeholder="audios/output.wav",
|
| 238 |
-
info=translations["output_path_info"],
|
| 239 |
-
interactive=True
|
| 240 |
-
)
|
| 241 |
-
with gr.Column():
|
| 242 |
-
refresh_audio = gr.Button(
|
| 243 |
-
translations["refresh"]
|
| 244 |
-
)
|
| 245 |
-
with gr.Accordion(
|
| 246 |
-
translations["setting"],
|
| 247 |
-
open=False
|
| 248 |
-
):
|
| 249 |
-
with gr.Accordion(
|
| 250 |
-
translations["f0_method"],
|
| 251 |
-
open=False
|
| 252 |
-
):
|
| 253 |
-
with gr.Group():
|
| 254 |
-
with gr.Row():
|
| 255 |
-
predictor_onnx = gr.Checkbox(
|
| 256 |
-
label=translations["predictor_onnx"],
|
| 257 |
-
info=translations["predictor_onnx_info"],
|
| 258 |
-
value=False,
|
| 259 |
-
interactive=True
|
| 260 |
-
)
|
| 261 |
-
unlock_full_method = gr.Checkbox(
|
| 262 |
-
label=translations["f0_unlock"],
|
| 263 |
-
info=translations["f0_unlock_info"],
|
| 264 |
-
value=False,
|
| 265 |
-
interactive=True
|
| 266 |
-
)
|
| 267 |
-
f0_method = gr.Radio(
|
| 268 |
-
label=translations["f0_method"],
|
| 269 |
-
info=translations["f0_method_info"],
|
| 270 |
-
choices=method_f0,
|
| 271 |
-
value="rmvpe",
|
| 272 |
-
interactive=True
|
| 273 |
-
)
|
| 274 |
-
hybrid_method = gr.Dropdown(
|
| 275 |
-
label=translations["f0_method_hybrid"],
|
| 276 |
-
info=translations["f0_method_hybrid_info"],
|
| 277 |
-
choices=hybrid_f0_method,
|
| 278 |
-
value=hybrid_f0_method[0],
|
| 279 |
-
interactive=True,
|
| 280 |
-
allow_custom_value=True,
|
| 281 |
-
visible=False
|
| 282 |
-
)
|
| 283 |
-
hop_length = gr.Slider(
|
| 284 |
-
label=translations['hop_length'],
|
| 285 |
-
info=translations["hop_length_info"],
|
| 286 |
-
minimum=64,
|
| 287 |
-
maximum=512,
|
| 288 |
-
value=160,
|
| 289 |
-
step=1,
|
| 290 |
-
interactive=True,
|
| 291 |
-
visible=False
|
| 292 |
-
)
|
| 293 |
-
alpha = gr.Slider(
|
| 294 |
-
label=translations["alpha_label"],
|
| 295 |
-
info=translations["alpha_info"],
|
| 296 |
-
minimum=0.1,
|
| 297 |
-
maximum=1,
|
| 298 |
-
value=0.5,
|
| 299 |
-
step=0.1,
|
| 300 |
-
interactive=True,
|
| 301 |
-
visible=False
|
| 302 |
-
)
|
| 303 |
-
with gr.Accordion(
|
| 304 |
-
translations["f0_file"],
|
| 305 |
-
open=False
|
| 306 |
-
):
|
| 307 |
-
upload_f0_file = gr.File(
|
| 308 |
-
label=translations["upload_f0"],
|
| 309 |
-
file_types=[".txt"]
|
| 310 |
-
)
|
| 311 |
-
f0_file_dropdown = gr.Dropdown(
|
| 312 |
-
label=translations["f0_file_2"],
|
| 313 |
-
value="",
|
| 314 |
-
choices=f0_file,
|
| 315 |
-
allow_custom_value=True,
|
| 316 |
-
interactive=True
|
| 317 |
-
)
|
| 318 |
-
refresh_f0_file = gr.Button(
|
| 319 |
-
translations["refresh"]
|
| 320 |
-
)
|
| 321 |
-
with gr.Accordion(
|
| 322 |
-
translations["hubert_model"],
|
| 323 |
-
open=False
|
| 324 |
-
):
|
| 325 |
-
embedders_mix = gr.Checkbox(
|
| 326 |
-
label=translations["embedders_mix"],
|
| 327 |
-
info=translations["embedders_mix_info"],
|
| 328 |
-
value=False,
|
| 329 |
-
interactive=True
|
| 330 |
-
)
|
| 331 |
-
embedder_mode = gr.Radio(
|
| 332 |
-
label=translations["embed_mode"],
|
| 333 |
-
info=translations["embed_mode_info"],
|
| 334 |
-
value="fairseq",
|
| 335 |
-
choices=embedders_mode,
|
| 336 |
-
interactive=True,
|
| 337 |
-
visible=True
|
| 338 |
-
)
|
| 339 |
-
embedders = gr.Radio(
|
| 340 |
-
label=translations["hubert_model"],
|
| 341 |
-
info=translations["hubert_info"],
|
| 342 |
-
choices=embedders_model,
|
| 343 |
-
value="hubert_base",
|
| 344 |
-
interactive=True
|
| 345 |
-
)
|
| 346 |
-
custom_embedders = gr.Textbox(
|
| 347 |
-
label=translations["modelname"],
|
| 348 |
-
info=translations["modelname_info"],
|
| 349 |
-
value="",
|
| 350 |
-
placeholder="hubert_base",
|
| 351 |
-
interactive=True,
|
| 352 |
-
visible=False
|
| 353 |
-
)
|
| 354 |
-
with gr.Column(visible=False) as embedders_mix_column:
|
| 355 |
-
embedders_mix_layers = gr.Slider(
|
| 356 |
-
label=translations["embedders_mix_layers"],
|
| 357 |
-
info=translations["embedders_mix_layers_info"],
|
| 358 |
-
minimum=1,
|
| 359 |
-
maximum=12,
|
| 360 |
-
value=9,
|
| 361 |
-
step=1,
|
| 362 |
-
interactive=True
|
| 363 |
-
)
|
| 364 |
-
embedders_mix_ratio = gr.Slider(
|
| 365 |
-
label=translations["embedders_mix_ratio"],
|
| 366 |
-
info=translations["embedders_mix_ratio_info"],
|
| 367 |
-
minimum=0.1,
|
| 368 |
-
maximum=1,
|
| 369 |
-
value=0.5,
|
| 370 |
-
step=0.1,
|
| 371 |
-
interactive=True
|
| 372 |
-
)
|
| 373 |
-
with gr.Accordion(
|
| 374 |
-
translations["use_presets"],
|
| 375 |
-
open=False
|
| 376 |
-
):
|
| 377 |
-
with gr.Row():
|
| 378 |
-
presets_name = gr.Dropdown(
|
| 379 |
-
label=translations["file_preset"],
|
| 380 |
-
choices=presets_file,
|
| 381 |
-
value=presets_file[0] if len(presets_file) > 0 else '',
|
| 382 |
-
interactive=True,
|
| 383 |
-
allow_custom_value=True
|
| 384 |
-
)
|
| 385 |
-
with gr.Row():
|
| 386 |
-
load_preset_button = gr.Button(
|
| 387 |
-
translations["load_file"],
|
| 388 |
-
variant="primary"
|
| 389 |
-
)
|
| 390 |
-
refresh_preset_button = gr.Button(
|
| 391 |
-
translations["refresh"]
|
| 392 |
-
)
|
| 393 |
-
with gr.Accordion(
|
| 394 |
-
translations["export_file"],
|
| 395 |
-
open=False
|
| 396 |
-
):
|
| 397 |
-
with gr.Row():
|
| 398 |
-
with gr.Column():
|
| 399 |
-
with gr.Group():
|
| 400 |
-
with gr.Row():
|
| 401 |
-
cleaner_checkbox = gr.Checkbox(
|
| 402 |
-
label=translations["save_clean"],
|
| 403 |
-
value=True,
|
| 404 |
-
interactive=True
|
| 405 |
-
)
|
| 406 |
-
autotune_checkbox = gr.Checkbox(
|
| 407 |
-
label=translations["save_autotune"],
|
| 408 |
-
value=True,
|
| 409 |
-
interactive=True
|
| 410 |
-
)
|
| 411 |
-
pitch_checkbox = gr.Checkbox(
|
| 412 |
-
label=translations["save_pitch"],
|
| 413 |
-
value=True,
|
| 414 |
-
interactive=True
|
| 415 |
-
)
|
| 416 |
-
index_strength_checkbox = gr.Checkbox(
|
| 417 |
-
label=translations["save_index_2"],
|
| 418 |
-
value=True,
|
| 419 |
-
interactive=True
|
| 420 |
-
)
|
| 421 |
-
resample_sr_checkbox = gr.Checkbox(
|
| 422 |
-
label=translations["save_resample"],
|
| 423 |
-
value=True,
|
| 424 |
-
interactive=True
|
| 425 |
-
)
|
| 426 |
-
filter_radius_checkbox = gr.Checkbox(
|
| 427 |
-
label=translations["save_filter"],
|
| 428 |
-
value=True,
|
| 429 |
-
interactive=True
|
| 430 |
-
)
|
| 431 |
-
rms_mix_rate_checkbox = gr.Checkbox(
|
| 432 |
-
label=translations["save_envelope"],
|
| 433 |
-
value=True,
|
| 434 |
-
interactive=True
|
| 435 |
-
)
|
| 436 |
-
protect_checkbox = gr.Checkbox(
|
| 437 |
-
label=translations["save_protect"],
|
| 438 |
-
value=True,
|
| 439 |
-
interactive=True
|
| 440 |
-
)
|
| 441 |
-
split_audio_checkbox = gr.Checkbox(
|
| 442 |
-
label=translations["save_split"],
|
| 443 |
-
value=True,
|
| 444 |
-
interactive=True
|
| 445 |
-
)
|
| 446 |
-
formant_shifting_checkbox = gr.Checkbox(
|
| 447 |
-
label=translations["formantshift"],
|
| 448 |
-
value=True,
|
| 449 |
-
interactive=True
|
| 450 |
-
)
|
| 451 |
-
with gr.Row():
|
| 452 |
-
with gr.Column():
|
| 453 |
-
name_to_save_file = gr.Textbox(
|
| 454 |
-
label=translations["filename_to_save"]
|
| 455 |
-
)
|
| 456 |
-
save_file_button = gr.Button(
|
| 457 |
-
translations["export_file"]
|
| 458 |
-
)
|
| 459 |
-
with gr.Row():
|
| 460 |
-
upload_presets = gr.Files(
|
| 461 |
-
label=translations["upload_presets"],
|
| 462 |
-
file_types=[".conversion.json"]
|
| 463 |
-
)
|
| 464 |
-
with gr.Column():
|
| 465 |
-
with gr.Group():
|
| 466 |
-
with gr.Row():
|
| 467 |
-
split_audio = gr.Checkbox(
|
| 468 |
-
label=translations["split_audio"],
|
| 469 |
-
value=False,
|
| 470 |
-
interactive=True
|
| 471 |
-
)
|
| 472 |
-
formant_shifting = gr.Checkbox(
|
| 473 |
-
label=translations["formantshift"],
|
| 474 |
-
value=False,
|
| 475 |
-
interactive=True
|
| 476 |
-
)
|
| 477 |
-
with gr.Row():
|
| 478 |
-
proposal_pitch = gr.Checkbox(
|
| 479 |
-
label=translations["proposal_pitch"],
|
| 480 |
-
value=False,
|
| 481 |
-
interactive=True
|
| 482 |
-
)
|
| 483 |
-
audio_processing = gr.Checkbox(
|
| 484 |
-
label=translations["audio_processing"],
|
| 485 |
-
value=False,
|
| 486 |
-
interactive=True
|
| 487 |
-
)
|
| 488 |
-
with gr.Row():
|
| 489 |
-
audio_upscaler = gr.Checkbox(
|
| 490 |
-
label=translations["audio_upscaler"],
|
| 491 |
-
info=translations["audio_upscaler_info"],
|
| 492 |
-
value=False,
|
| 493 |
-
interactive=True
|
| 494 |
-
)
|
| 495 |
-
resample_sr = gr.Radio(
|
| 496 |
-
choices=[0]+sample_rate_choice,
|
| 497 |
-
label=translations["resample"],
|
| 498 |
-
info=translations["resample_info"],
|
| 499 |
-
value=0,
|
| 500 |
-
interactive=True
|
| 501 |
-
)
|
| 502 |
-
proposal_pitch_threshold = gr.Slider(
|
| 503 |
-
minimum=50.0,
|
| 504 |
-
maximum=1200.0,
|
| 505 |
-
label=translations["proposal_pitch_threshold"],
|
| 506 |
-
info=translations["proposal_pitch_threshold_info"],
|
| 507 |
-
value=255.0,
|
| 508 |
-
step=0.1,
|
| 509 |
-
interactive=True,
|
| 510 |
-
visible=False
|
| 511 |
-
)
|
| 512 |
-
f0_autotune_strength = gr.Slider(
|
| 513 |
-
minimum=0,
|
| 514 |
-
maximum=1,
|
| 515 |
-
label=translations["autotune_rate"],
|
| 516 |
-
info=translations["autotune_rate_info"],
|
| 517 |
-
value=1,
|
| 518 |
-
step=0.1,
|
| 519 |
-
interactive=True,
|
| 520 |
-
visible=False
|
| 521 |
-
)
|
| 522 |
-
filter_radius = gr.Slider(
|
| 523 |
-
minimum=0,
|
| 524 |
-
maximum=7,
|
| 525 |
-
label=translations["filter_radius"],
|
| 526 |
-
info=translations["filter_radius_info"],
|
| 527 |
-
value=3,
|
| 528 |
-
step=1,
|
| 529 |
-
interactive=True
|
| 530 |
-
)
|
| 531 |
-
rms_mix_rate = gr.Slider(
|
| 532 |
-
minimum=0,
|
| 533 |
-
maximum=1,
|
| 534 |
-
label=translations["rms_mix_rate"],
|
| 535 |
-
info=translations["rms_mix_rate_info"],
|
| 536 |
-
value=1,
|
| 537 |
-
step=0.1,
|
| 538 |
-
interactive=True
|
| 539 |
-
)
|
| 540 |
-
protect = gr.Slider(
|
| 541 |
-
minimum=0,
|
| 542 |
-
maximum=1,
|
| 543 |
-
label=translations["protect"],
|
| 544 |
-
info=translations["protect_info"],
|
| 545 |
-
value=0.5,
|
| 546 |
-
step=0.01,
|
| 547 |
-
interactive=True
|
| 548 |
-
)
|
| 549 |
-
noise_scale = gr.Slider(
|
| 550 |
-
minimum=0.1,
|
| 551 |
-
maximum=1.0,
|
| 552 |
-
label=translations["noise_scale"],
|
| 553 |
-
info=translations["noise_scale_info"],
|
| 554 |
-
value=0.4,
|
| 555 |
-
step=0.01,
|
| 556 |
-
interactive=True,
|
| 557 |
-
visible=architecture_dict["visible"]
|
| 558 |
-
)
|
| 559 |
-
with gr.Row():
|
| 560 |
-
formant_qfrency = gr.Slider(
|
| 561 |
-
value=1.0,
|
| 562 |
-
label=translations["formant_qfrency"],
|
| 563 |
-
info=translations["formant_qfrency"],
|
| 564 |
-
minimum=0.0,
|
| 565 |
-
maximum=16.0,
|
| 566 |
-
step=0.1,
|
| 567 |
-
interactive=True,
|
| 568 |
-
visible=False
|
| 569 |
-
)
|
| 570 |
-
formant_timbre = gr.Slider(
|
| 571 |
-
value=1.0,
|
| 572 |
-
label=translations["formant_timbre"],
|
| 573 |
-
info=translations["formant_timbre"],
|
| 574 |
-
minimum=0.0,
|
| 575 |
-
maximum=16.0,
|
| 576 |
-
step=0.1,
|
| 577 |
-
interactive=True,
|
| 578 |
-
visible=False
|
| 579 |
-
)
|
| 580 |
-
with gr.Row():
|
| 581 |
-
gr.Markdown(translations["output_convert"])
|
| 582 |
-
with gr.Row():
|
| 583 |
-
main_convert = gr.Audio(
|
| 584 |
-
interactive=False,
|
| 585 |
-
label=translations["main_convert"],
|
| 586 |
-
visible=True,
|
| 587 |
-
**audio_params
|
| 588 |
-
)
|
| 589 |
-
backing_convert = gr.Audio(
|
| 590 |
-
interactive=False,
|
| 591 |
-
label=translations["convert_backing"],
|
| 592 |
-
visible=False,
|
| 593 |
-
**audio_params
|
| 594 |
-
)
|
| 595 |
-
main_backing = gr.Audio(
|
| 596 |
-
interactive=False,
|
| 597 |
-
label=translations["main_or_backing"],
|
| 598 |
-
visible=False,
|
| 599 |
-
**audio_params
|
| 600 |
-
)
|
| 601 |
-
with gr.Row():
|
| 602 |
-
original_convert = gr.Audio(
|
| 603 |
-
interactive=False,
|
| 604 |
-
label=translations["convert_original"],
|
| 605 |
-
visible=False,
|
| 606 |
-
**audio_params
|
| 607 |
-
)
|
| 608 |
-
vocal_instrument = gr.Audio(
|
| 609 |
-
interactive=False,
|
| 610 |
-
label=translations["voice_or_instruments"],
|
| 611 |
-
visible=False,
|
| 612 |
-
**audio_params
|
| 613 |
-
)
|
| 614 |
-
with gr.Row():
|
| 615 |
-
upload_f0_file.upload(
|
| 616 |
-
fn=lambda inp: shutil_move(inp.name, configs["f0_path"]),
|
| 617 |
-
inputs=[
|
| 618 |
-
upload_f0_file
|
| 619 |
-
],
|
| 620 |
-
outputs=[
|
| 621 |
-
f0_file_dropdown
|
| 622 |
-
]
|
| 623 |
-
)
|
| 624 |
-
refresh_f0_file.click(
|
| 625 |
-
fn=change_f0_choices,
|
| 626 |
-
inputs=[],
|
| 627 |
-
outputs=[
|
| 628 |
-
f0_file_dropdown
|
| 629 |
-
]
|
| 630 |
-
)
|
| 631 |
-
unlock_full_method.change(
|
| 632 |
-
fn=unlock_f0,
|
| 633 |
-
inputs=[
|
| 634 |
-
unlock_full_method
|
| 635 |
-
],
|
| 636 |
-
outputs=[
|
| 637 |
-
f0_method
|
| 638 |
-
]
|
| 639 |
-
)
|
| 640 |
-
with gr.Row():
|
| 641 |
-
load_preset_button.click(
|
| 642 |
-
fn=load_presets,
|
| 643 |
-
inputs=[
|
| 644 |
-
presets_name,
|
| 645 |
-
cleaner,
|
| 646 |
-
autotune,
|
| 647 |
-
pitch,
|
| 648 |
-
clean_strength,
|
| 649 |
-
index_strength,
|
| 650 |
-
resample_sr,
|
| 651 |
-
filter_radius,
|
| 652 |
-
rms_mix_rate,
|
| 653 |
-
protect,
|
| 654 |
-
split_audio,
|
| 655 |
-
f0_autotune_strength,
|
| 656 |
-
formant_shifting,
|
| 657 |
-
formant_qfrency,
|
| 658 |
-
formant_timbre,
|
| 659 |
-
proposal_pitch,
|
| 660 |
-
proposal_pitch_threshold,
|
| 661 |
-
embedders_mix,
|
| 662 |
-
embedders_mix_layers,
|
| 663 |
-
embedders_mix_ratio
|
| 664 |
-
],
|
| 665 |
-
outputs=[
|
| 666 |
-
cleaner,
|
| 667 |
-
autotune,
|
| 668 |
-
pitch,
|
| 669 |
-
clean_strength,
|
| 670 |
-
index_strength,
|
| 671 |
-
resample_sr,
|
| 672 |
-
filter_radius,
|
| 673 |
-
rms_mix_rate,
|
| 674 |
-
protect,
|
| 675 |
-
split_audio,
|
| 676 |
-
f0_autotune_strength,
|
| 677 |
-
formant_shifting,
|
| 678 |
-
formant_qfrency,
|
| 679 |
-
formant_timbre,
|
| 680 |
-
proposal_pitch,
|
| 681 |
-
proposal_pitch_threshold,
|
| 682 |
-
embedders_mix,
|
| 683 |
-
embedders_mix_layers,
|
| 684 |
-
embedders_mix_ratio
|
| 685 |
-
]
|
| 686 |
-
)
|
| 687 |
-
refresh_preset_button.click(
|
| 688 |
-
fn=change_preset_choices,
|
| 689 |
-
inputs=[],
|
| 690 |
-
outputs=[
|
| 691 |
-
presets_name
|
| 692 |
-
]
|
| 693 |
-
)
|
| 694 |
-
save_file_button.click(
|
| 695 |
-
fn=save_presets,
|
| 696 |
-
inputs=[
|
| 697 |
-
name_to_save_file,
|
| 698 |
-
cleaner,
|
| 699 |
-
autotune,
|
| 700 |
-
pitch,
|
| 701 |
-
clean_strength,
|
| 702 |
-
index_strength,
|
| 703 |
-
resample_sr,
|
| 704 |
-
filter_radius,
|
| 705 |
-
rms_mix_rate,
|
| 706 |
-
protect,
|
| 707 |
-
split_audio,
|
| 708 |
-
f0_autotune_strength,
|
| 709 |
-
cleaner_checkbox,
|
| 710 |
-
autotune_checkbox,
|
| 711 |
-
pitch_checkbox,
|
| 712 |
-
index_strength_checkbox,
|
| 713 |
-
resample_sr_checkbox,
|
| 714 |
-
filter_radius_checkbox,
|
| 715 |
-
rms_mix_rate_checkbox,
|
| 716 |
-
protect_checkbox,
|
| 717 |
-
split_audio_checkbox,
|
| 718 |
-
formant_shifting_checkbox,
|
| 719 |
-
formant_shifting,
|
| 720 |
-
formant_qfrency,
|
| 721 |
-
formant_timbre,
|
| 722 |
-
proposal_pitch,
|
| 723 |
-
proposal_pitch_threshold,
|
| 724 |
-
embedders_mix,
|
| 725 |
-
embedders_mix_layers,
|
| 726 |
-
embedders_mix_ratio
|
| 727 |
-
],
|
| 728 |
-
outputs=[
|
| 729 |
-
presets_name
|
| 730 |
-
]
|
| 731 |
-
)
|
| 732 |
-
with gr.Row():
|
| 733 |
-
upload_presets.upload(
|
| 734 |
-
fn=lambda presets_in: [
|
| 735 |
-
shutil_move(preset.name, configs["presets_path"])
|
| 736 |
-
for preset in presets_in
|
| 737 |
-
][0],
|
| 738 |
-
inputs=[
|
| 739 |
-
upload_presets
|
| 740 |
-
],
|
| 741 |
-
outputs=[
|
| 742 |
-
presets_name
|
| 743 |
-
]
|
| 744 |
-
)
|
| 745 |
-
autotune.change(
|
| 746 |
-
fn=visible,
|
| 747 |
-
inputs=[
|
| 748 |
-
autotune
|
| 749 |
-
],
|
| 750 |
-
outputs=[
|
| 751 |
-
f0_autotune_strength
|
| 752 |
-
]
|
| 753 |
-
)
|
| 754 |
-
use_audio.change(
|
| 755 |
-
fn=lambda a: [
|
| 756 |
-
visible(a),
|
| 757 |
-
visible(a),
|
| 758 |
-
visible(a),
|
| 759 |
-
visible(a),
|
| 760 |
-
visible(a),
|
| 761 |
-
valueFalse_interactive(a),
|
| 762 |
-
valueFalse_interactive(a),
|
| 763 |
-
valueFalse_interactive(a),
|
| 764 |
-
valueFalse_interactive(a),
|
| 765 |
-
visible(not a),
|
| 766 |
-
visible(not a),
|
| 767 |
-
visible(not a),
|
| 768 |
-
visible(not a)
|
| 769 |
-
],
|
| 770 |
-
inputs=[
|
| 771 |
-
use_audio
|
| 772 |
-
],
|
| 773 |
-
outputs=[
|
| 774 |
-
main_backing,
|
| 775 |
-
use_original,
|
| 776 |
-
convert_backing,
|
| 777 |
-
not_merge_backing,
|
| 778 |
-
merge_instrument,
|
| 779 |
-
use_original,
|
| 780 |
-
convert_backing,
|
| 781 |
-
not_merge_backing,
|
| 782 |
-
merge_instrument,
|
| 783 |
-
input_audio,
|
| 784 |
-
output_audio,
|
| 785 |
-
drop_audio_file,
|
| 786 |
-
play_audio
|
| 787 |
-
]
|
| 788 |
-
)
|
| 789 |
-
with gr.Row():
|
| 790 |
-
convert_backing.change(
|
| 791 |
-
fn=lambda a,b: [
|
| 792 |
-
change_backing_choices(a, b),
|
| 793 |
-
visible(a)
|
| 794 |
-
],
|
| 795 |
-
inputs=[
|
| 796 |
-
convert_backing,
|
| 797 |
-
not_merge_backing
|
| 798 |
-
],
|
| 799 |
-
outputs=[
|
| 800 |
-
use_original,
|
| 801 |
-
backing_convert
|
| 802 |
-
]
|
| 803 |
-
)
|
| 804 |
-
use_original.change(
|
| 805 |
-
fn=lambda audio, original: [
|
| 806 |
-
visible(original),
|
| 807 |
-
visible(not original),
|
| 808 |
-
visible(audio and not original),
|
| 809 |
-
valueFalse_interactive(not original),
|
| 810 |
-
valueFalse_interactive(not original)
|
| 811 |
-
],
|
| 812 |
-
inputs=[
|
| 813 |
-
use_audio,
|
| 814 |
-
use_original
|
| 815 |
-
],
|
| 816 |
-
outputs=[
|
| 817 |
-
original_convert,
|
| 818 |
-
main_convert,
|
| 819 |
-
main_backing,
|
| 820 |
-
convert_backing,
|
| 821 |
-
not_merge_backing
|
| 822 |
-
]
|
| 823 |
-
)
|
| 824 |
-
cleaner.change(
|
| 825 |
-
fn=visible,
|
| 826 |
-
inputs=[
|
| 827 |
-
cleaner
|
| 828 |
-
],
|
| 829 |
-
outputs=[
|
| 830 |
-
clean_strength
|
| 831 |
-
]
|
| 832 |
-
)
|
| 833 |
-
with gr.Row():
|
| 834 |
-
merge_instrument.change(
|
| 835 |
-
fn=visible,
|
| 836 |
-
inputs=[
|
| 837 |
-
merge_instrument
|
| 838 |
-
],
|
| 839 |
-
outputs=[
|
| 840 |
-
vocal_instrument
|
| 841 |
-
]
|
| 842 |
-
)
|
| 843 |
-
not_merge_backing.change(
|
| 844 |
-
fn=lambda audio, merge, cvb: [
|
| 845 |
-
visible(audio and not merge),
|
| 846 |
-
change_backing_choices(cvb, merge)
|
| 847 |
-
],
|
| 848 |
-
inputs=[
|
| 849 |
-
use_audio,
|
| 850 |
-
not_merge_backing,
|
| 851 |
-
convert_backing
|
| 852 |
-
],
|
| 853 |
-
outputs=[
|
| 854 |
-
main_backing,
|
| 855 |
-
use_original
|
| 856 |
-
]
|
| 857 |
-
)
|
| 858 |
-
f0_method.change(
|
| 859 |
-
fn=lambda f0_method, hybrid: [
|
| 860 |
-
visible(f0_method == "hybrid"),
|
| 861 |
-
visible(f0_method == "hybrid"),
|
| 862 |
-
hoplength_show(f0_method, hybrid)
|
| 863 |
-
],
|
| 864 |
-
inputs=[
|
| 865 |
-
f0_method,
|
| 866 |
-
hybrid_method
|
| 867 |
-
],
|
| 868 |
-
outputs=[
|
| 869 |
-
hybrid_method,
|
| 870 |
-
alpha,
|
| 871 |
-
hop_length
|
| 872 |
-
]
|
| 873 |
-
)
|
| 874 |
-
with gr.Row():
|
| 875 |
-
hybrid_method.change(
|
| 876 |
-
fn=hoplength_show,
|
| 877 |
-
inputs=[
|
| 878 |
-
f0_method,
|
| 879 |
-
hybrid_method
|
| 880 |
-
],
|
| 881 |
-
outputs=[
|
| 882 |
-
hop_length
|
| 883 |
-
]
|
| 884 |
-
)
|
| 885 |
-
refresh_model.click(
|
| 886 |
-
fn=change_models_choices,
|
| 887 |
-
inputs=[],
|
| 888 |
-
outputs=[
|
| 889 |
-
model_pth,
|
| 890 |
-
model_index
|
| 891 |
-
]
|
| 892 |
-
)
|
| 893 |
-
model_pth.change(
|
| 894 |
-
fn=get_index,
|
| 895 |
-
inputs=[
|
| 896 |
-
model_pth
|
| 897 |
-
],
|
| 898 |
-
outputs=[
|
| 899 |
-
model_index
|
| 900 |
-
]
|
| 901 |
-
)
|
| 902 |
-
with gr.Row():
|
| 903 |
-
drop_audio_file.upload(
|
| 904 |
-
fn=lambda audio_in: [
|
| 905 |
-
shutil_move(audio.name, configs["audios_path"])
|
| 906 |
-
for audio in audio_in
|
| 907 |
-
][0],
|
| 908 |
-
inputs=[
|
| 909 |
-
drop_audio_file
|
| 910 |
-
],
|
| 911 |
-
outputs=[
|
| 912 |
-
input_audio
|
| 913 |
-
]
|
| 914 |
-
)
|
| 915 |
-
input_audio.change(
|
| 916 |
-
fn=lambda audio: audio if os.path.isfile(audio) else None,
|
| 917 |
-
inputs=[
|
| 918 |
-
input_audio
|
| 919 |
-
],
|
| 920 |
-
outputs=[
|
| 921 |
-
play_audio
|
| 922 |
-
]
|
| 923 |
-
)
|
| 924 |
-
formant_shifting.change(
|
| 925 |
-
fn=lambda a: [
|
| 926 |
-
visible(a)
|
| 927 |
-
for _ in range(2)
|
| 928 |
-
],
|
| 929 |
-
inputs=[
|
| 930 |
-
formant_shifting
|
| 931 |
-
],
|
| 932 |
-
outputs=[
|
| 933 |
-
formant_qfrency,
|
| 934 |
-
formant_timbre
|
| 935 |
-
]
|
| 936 |
-
)
|
| 937 |
-
with gr.Row():
|
| 938 |
-
embedders.change(
|
| 939 |
-
fn=lambda embedders: visible(embedders == "custom"),
|
| 940 |
-
inputs=[
|
| 941 |
-
embedders
|
| 942 |
-
],
|
| 943 |
-
outputs=[
|
| 944 |
-
custom_embedders
|
| 945 |
-
]
|
| 946 |
-
)
|
| 947 |
-
refresh_audio.click(
|
| 948 |
-
fn=change_audios_choices,
|
| 949 |
-
inputs=[
|
| 950 |
-
input_audio
|
| 951 |
-
],
|
| 952 |
-
outputs=[
|
| 953 |
-
input_audio
|
| 954 |
-
]
|
| 955 |
-
)
|
| 956 |
-
model_index.change(
|
| 957 |
-
fn=index_strength_show,
|
| 958 |
-
inputs=[
|
| 959 |
-
model_index
|
| 960 |
-
],
|
| 961 |
-
outputs=[
|
| 962 |
-
index_strength,
|
| 963 |
-
nprobe
|
| 964 |
-
]
|
| 965 |
-
)
|
| 966 |
-
with gr.Row():
|
| 967 |
-
convert_audio_button.click(
|
| 968 |
-
fn=lambda: visible(False),
|
| 969 |
-
inputs=[],
|
| 970 |
-
outputs=[
|
| 971 |
-
convert_audio_button
|
| 972 |
-
]
|
| 973 |
-
)
|
| 974 |
-
convert_select_audio_button.click(
|
| 975 |
-
fn=lambda: [
|
| 976 |
-
visible(False)
|
| 977 |
-
for _ in range(2)
|
| 978 |
-
],
|
| 979 |
-
inputs=[],
|
| 980 |
-
outputs=[
|
| 981 |
-
convert_select_audio,
|
| 982 |
-
convert_select_audio_button
|
| 983 |
-
]
|
| 984 |
-
)
|
| 985 |
-
with gr.Row():
|
| 986 |
-
proposal_pitch.change(
|
| 987 |
-
fn=visible,
|
| 988 |
-
inputs=[
|
| 989 |
-
proposal_pitch
|
| 990 |
-
],
|
| 991 |
-
outputs=[
|
| 992 |
-
proposal_pitch_threshold
|
| 993 |
-
]
|
| 994 |
-
)
|
| 995 |
-
embedder_mode.change(
|
| 996 |
-
fn=change_embedders_mode,
|
| 997 |
-
inputs=[
|
| 998 |
-
embedder_mode
|
| 999 |
-
],
|
| 1000 |
-
outputs=[
|
| 1001 |
-
embedders
|
| 1002 |
-
]
|
| 1003 |
-
)
|
| 1004 |
-
model_pth.change(
|
| 1005 |
-
fn=get_speakers_id_and_architecture,
|
| 1006 |
-
inputs=[
|
| 1007 |
-
model_pth
|
| 1008 |
-
],
|
| 1009 |
-
outputs=[
|
| 1010 |
-
sids,
|
| 1011 |
-
noise_scale
|
| 1012 |
-
]
|
| 1013 |
-
)
|
| 1014 |
-
with gr.Row():
|
| 1015 |
-
embedders_mix.change(
|
| 1016 |
-
fn=visible,
|
| 1017 |
-
inputs=[
|
| 1018 |
-
embedders_mix
|
| 1019 |
-
],
|
| 1020 |
-
outputs=[
|
| 1021 |
-
embedders_mix_column
|
| 1022 |
-
]
|
| 1023 |
-
)
|
| 1024 |
-
convert_audio_button.click(
|
| 1025 |
-
fn=convert_selection,
|
| 1026 |
-
inputs=[
|
| 1027 |
-
cleaner,
|
| 1028 |
-
autotune,
|
| 1029 |
-
use_audio,
|
| 1030 |
-
use_original,
|
| 1031 |
-
convert_backing,
|
| 1032 |
-
not_merge_backing,
|
| 1033 |
-
merge_instrument,
|
| 1034 |
-
pitch,
|
| 1035 |
-
clean_strength,
|
| 1036 |
-
model_pth,
|
| 1037 |
-
model_index,
|
| 1038 |
-
index_strength,
|
| 1039 |
-
input_audio,
|
| 1040 |
-
output_audio,
|
| 1041 |
-
export_format,
|
| 1042 |
-
f0_method,
|
| 1043 |
-
hybrid_method,
|
| 1044 |
-
hop_length,
|
| 1045 |
-
embedders,
|
| 1046 |
-
custom_embedders,
|
| 1047 |
-
resample_sr,
|
| 1048 |
-
filter_radius,
|
| 1049 |
-
rms_mix_rate,
|
| 1050 |
-
protect,
|
| 1051 |
-
split_audio,
|
| 1052 |
-
f0_autotune_strength,
|
| 1053 |
-
checkpointing,
|
| 1054 |
-
predictor_onnx,
|
| 1055 |
-
formant_shifting,
|
| 1056 |
-
formant_qfrency,
|
| 1057 |
-
formant_timbre,
|
| 1058 |
-
f0_file_dropdown,
|
| 1059 |
-
embedder_mode,
|
| 1060 |
-
proposal_pitch,
|
| 1061 |
-
proposal_pitch_threshold,
|
| 1062 |
-
audio_processing,
|
| 1063 |
-
alpha,
|
| 1064 |
-
sids,
|
| 1065 |
-
embedders_mix,
|
| 1066 |
-
embedders_mix_layers,
|
| 1067 |
-
embedders_mix_ratio,
|
| 1068 |
-
noise_scale,
|
| 1069 |
-
nprobe,
|
| 1070 |
-
audio_upscaler
|
| 1071 |
-
],
|
| 1072 |
-
outputs=[
|
| 1073 |
-
convert_select_audio,
|
| 1074 |
-
main_convert,
|
| 1075 |
-
backing_convert,
|
| 1076 |
-
main_backing,
|
| 1077 |
-
original_convert,
|
| 1078 |
-
vocal_instrument,
|
| 1079 |
-
convert_audio_button,
|
| 1080 |
-
convert_select_audio_button
|
| 1081 |
-
],
|
| 1082 |
-
api_name="convert_selection"
|
| 1083 |
-
)
|
| 1084 |
-
convert_select_audio_button.click(
|
| 1085 |
-
fn=convert_audio,
|
| 1086 |
-
inputs=[
|
| 1087 |
-
cleaner,
|
| 1088 |
-
autotune,
|
| 1089 |
-
use_audio,
|
| 1090 |
-
use_original,
|
| 1091 |
-
convert_backing,
|
| 1092 |
-
not_merge_backing,
|
| 1093 |
-
merge_instrument,
|
| 1094 |
-
pitch,
|
| 1095 |
-
clean_strength,
|
| 1096 |
-
model_pth,
|
| 1097 |
-
model_index,
|
| 1098 |
-
index_strength,
|
| 1099 |
-
input_audio,
|
| 1100 |
-
output_audio,
|
| 1101 |
-
export_format,
|
| 1102 |
-
f0_method,
|
| 1103 |
-
hybrid_method,
|
| 1104 |
-
hop_length,
|
| 1105 |
-
embedders,
|
| 1106 |
-
custom_embedders,
|
| 1107 |
-
resample_sr,
|
| 1108 |
-
filter_radius,
|
| 1109 |
-
rms_mix_rate,
|
| 1110 |
-
protect,
|
| 1111 |
-
split_audio,
|
| 1112 |
-
f0_autotune_strength,
|
| 1113 |
-
convert_select_audio,
|
| 1114 |
-
checkpointing,
|
| 1115 |
-
predictor_onnx,
|
| 1116 |
-
formant_shifting,
|
| 1117 |
-
formant_qfrency,
|
| 1118 |
-
formant_timbre,
|
| 1119 |
-
f0_file_dropdown,
|
| 1120 |
-
embedder_mode,
|
| 1121 |
-
proposal_pitch,
|
| 1122 |
-
proposal_pitch_threshold,
|
| 1123 |
-
audio_processing,
|
| 1124 |
-
alpha,
|
| 1125 |
-
sids,
|
| 1126 |
-
embedders_mix,
|
| 1127 |
-
embedders_mix_layers,
|
| 1128 |
-
embedders_mix_ratio,
|
| 1129 |
-
noise_scale,
|
| 1130 |
-
nprobe,
|
| 1131 |
-
audio_upscaler
|
| 1132 |
-
],
|
| 1133 |
-
outputs=[
|
| 1134 |
-
main_convert,
|
| 1135 |
-
backing_convert,
|
| 1136 |
-
main_backing,
|
| 1137 |
-
original_convert,
|
| 1138 |
-
vocal_instrument,
|
| 1139 |
-
convert_audio_button
|
| 1140 |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/inference/child/convert_tts.py
DELETED
|
@@ -1,979 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.tts import TTS
|
| 9 |
-
from main.app.core.process import process_input
|
| 10 |
-
from main.app.core.inference import convert_tts
|
| 11 |
-
from main.app.core.utils import google_translate
|
| 12 |
-
|
| 13 |
-
from main.app.core.presets import (
|
| 14 |
-
save_presets,
|
| 15 |
-
load_presets
|
| 16 |
-
)
|
| 17 |
-
|
| 18 |
-
from main.app.variables import (
|
| 19 |
-
configs,
|
| 20 |
-
edgetts,
|
| 21 |
-
f0_file,
|
| 22 |
-
method_f0,
|
| 23 |
-
model_name,
|
| 24 |
-
index_path,
|
| 25 |
-
presets_file,
|
| 26 |
-
translations,
|
| 27 |
-
audio_params,
|
| 28 |
-
embedders_mode,
|
| 29 |
-
embedders_model,
|
| 30 |
-
google_tts_voice,
|
| 31 |
-
hybrid_f0_method,
|
| 32 |
-
sample_rate_choice,
|
| 33 |
-
export_format_choices
|
| 34 |
-
)
|
| 35 |
-
|
| 36 |
-
from main.app.core.ui import (
|
| 37 |
-
visible,
|
| 38 |
-
unlock_f0,
|
| 39 |
-
get_index,
|
| 40 |
-
shutil_move,
|
| 41 |
-
hoplength_show,
|
| 42 |
-
change_f0_choices,
|
| 43 |
-
index_strength_show,
|
| 44 |
-
change_models_choices,
|
| 45 |
-
change_preset_choices,
|
| 46 |
-
change_embedders_mode,
|
| 47 |
-
change_tts_voice_choices,
|
| 48 |
-
get_speakers_id_and_architecture
|
| 49 |
-
)
|
| 50 |
-
|
| 51 |
-
def convert_tts_tab():
|
| 52 |
-
with gr.Row():
|
| 53 |
-
gr.Markdown(translations["convert_text_markdown_2"])
|
| 54 |
-
with gr.Row():
|
| 55 |
-
with gr.Column():
|
| 56 |
-
with gr.Group():
|
| 57 |
-
with gr.Row():
|
| 58 |
-
use_txt = gr.Checkbox(
|
| 59 |
-
label=translations["input_txt"],
|
| 60 |
-
value=False,
|
| 61 |
-
interactive=True
|
| 62 |
-
)
|
| 63 |
-
google_tts_check_box = gr.Checkbox(
|
| 64 |
-
label=translations["googletts"],
|
| 65 |
-
value=False,
|
| 66 |
-
interactive=True
|
| 67 |
-
)
|
| 68 |
-
prompt = gr.Textbox(
|
| 69 |
-
label=translations["text_to_speech"],
|
| 70 |
-
value="",
|
| 71 |
-
placeholder="Hello Words",
|
| 72 |
-
lines=5,
|
| 73 |
-
max_lines=5
|
| 74 |
-
)
|
| 75 |
-
with gr.Column():
|
| 76 |
-
speed = gr.Slider(
|
| 77 |
-
label=translations["voice_speed"],
|
| 78 |
-
info=translations["voice_speed_info"],
|
| 79 |
-
minimum=-100,
|
| 80 |
-
maximum=100,
|
| 81 |
-
value=0,
|
| 82 |
-
step=1
|
| 83 |
-
)
|
| 84 |
-
pitch = gr.Slider(
|
| 85 |
-
minimum=-24,
|
| 86 |
-
maximum=24,
|
| 87 |
-
step=1,
|
| 88 |
-
info=translations["pitch_info"],
|
| 89 |
-
label=translations["pitch"],
|
| 90 |
-
value=0,
|
| 91 |
-
interactive=True
|
| 92 |
-
)
|
| 93 |
-
with gr.Row():
|
| 94 |
-
tts_button = gr.Button(
|
| 95 |
-
translations["tts_1"],
|
| 96 |
-
variant="primary",
|
| 97 |
-
scale=2
|
| 98 |
-
)
|
| 99 |
-
convert_button = gr.Button(
|
| 100 |
-
translations["tts_2"],
|
| 101 |
-
variant="secondary",
|
| 102 |
-
scale=2
|
| 103 |
-
)
|
| 104 |
-
with gr.Row():
|
| 105 |
-
with gr.Column():
|
| 106 |
-
txt_input = gr.File(
|
| 107 |
-
label=translations["drop_text"],
|
| 108 |
-
file_types=[".txt", ".srt", ".docx"],
|
| 109 |
-
visible=False
|
| 110 |
-
)
|
| 111 |
-
tts_voice = gr.Dropdown(
|
| 112 |
-
label=translations["voice"],
|
| 113 |
-
choices=edgetts,
|
| 114 |
-
interactive=True,
|
| 115 |
-
value="vi-VN-NamMinhNeural"
|
| 116 |
-
)
|
| 117 |
-
tts_pitch = gr.Slider(
|
| 118 |
-
minimum=-24,
|
| 119 |
-
maximum=24,
|
| 120 |
-
step=1,
|
| 121 |
-
info=translations["pitch_info_2"],
|
| 122 |
-
label=translations["pitch"],
|
| 123 |
-
value=0,
|
| 124 |
-
interactive=True
|
| 125 |
-
)
|
| 126 |
-
with gr.Accordion(
|
| 127 |
-
translations["translate"],
|
| 128 |
-
open=False
|
| 129 |
-
):
|
| 130 |
-
with gr.Row():
|
| 131 |
-
source_lang = gr.Dropdown(
|
| 132 |
-
label=translations["source_lang"],
|
| 133 |
-
choices=["auto"]+google_tts_voice,
|
| 134 |
-
interactive=True,
|
| 135 |
-
value="auto"
|
| 136 |
-
)
|
| 137 |
-
target_lang = gr.Dropdown(
|
| 138 |
-
label=translations["target_lang"],
|
| 139 |
-
choices=google_tts_voice,
|
| 140 |
-
interactive=True,
|
| 141 |
-
value="en"
|
| 142 |
-
)
|
| 143 |
-
translate_button = gr.Button(
|
| 144 |
-
translations["translate"]
|
| 145 |
-
)
|
| 146 |
-
with gr.Column():
|
| 147 |
-
with gr.Accordion(
|
| 148 |
-
translations["model_accordion"],
|
| 149 |
-
open=True
|
| 150 |
-
):
|
| 151 |
-
with gr.Row():
|
| 152 |
-
model_pth = gr.Dropdown(
|
| 153 |
-
label=translations["model_name"],
|
| 154 |
-
choices=model_name,
|
| 155 |
-
value=model_name[0] if len(model_name) >= 1 else "",
|
| 156 |
-
interactive=True,
|
| 157 |
-
allow_custom_value=True
|
| 158 |
-
)
|
| 159 |
-
model_index = gr.Dropdown(
|
| 160 |
-
label=translations["index_path"],
|
| 161 |
-
choices=index_path,
|
| 162 |
-
value=index_path[0] if len(index_path) >= 1 else "",
|
| 163 |
-
interactive=True,
|
| 164 |
-
allow_custom_value=True
|
| 165 |
-
)
|
| 166 |
-
with gr.Row():
|
| 167 |
-
refresh = gr.Button(
|
| 168 |
-
translations["refresh"]
|
| 169 |
-
)
|
| 170 |
-
with gr.Row():
|
| 171 |
-
index_strength = gr.Slider(
|
| 172 |
-
label=translations["index_strength"],
|
| 173 |
-
info=translations["index_strength_info"],
|
| 174 |
-
minimum=0,
|
| 175 |
-
maximum=1,
|
| 176 |
-
value=0.5,
|
| 177 |
-
step=0.01,
|
| 178 |
-
interactive=True,
|
| 179 |
-
visible=True
|
| 180 |
-
)
|
| 181 |
-
nprobe = gr.Slider(
|
| 182 |
-
label=translations["nprobe"],
|
| 183 |
-
info=translations["nprobe_info"],
|
| 184 |
-
minimum=1,
|
| 185 |
-
maximum=64,
|
| 186 |
-
value=9,
|
| 187 |
-
step=1,
|
| 188 |
-
interactive=True,
|
| 189 |
-
visible=True
|
| 190 |
-
)
|
| 191 |
-
with gr.Row():
|
| 192 |
-
sid_dict, architecture_dict = get_speakers_id_and_architecture(model_pth.value)
|
| 193 |
-
if sid_dict["visible"] == "hidden": sid_dict["visible"] = False
|
| 194 |
-
if architecture_dict["visible"] == "hidden": architecture_dict["visible"] = False
|
| 195 |
-
|
| 196 |
-
sids = gr.Dropdown(
|
| 197 |
-
label=translations["sids_label"],
|
| 198 |
-
info=translations["sids_info"],
|
| 199 |
-
choices=sid_dict["choices"],
|
| 200 |
-
value=sid_dict["value"],
|
| 201 |
-
visible=sid_dict["visible"],
|
| 202 |
-
interactive=True
|
| 203 |
-
)
|
| 204 |
-
with gr.Accordion(
|
| 205 |
-
translations["output_path"],
|
| 206 |
-
open=False
|
| 207 |
-
):
|
| 208 |
-
export_format = gr.Radio(
|
| 209 |
-
label=translations["export_format"],
|
| 210 |
-
info=translations["export_info"],
|
| 211 |
-
choices=export_format_choices,
|
| 212 |
-
value="wav",
|
| 213 |
-
interactive=True
|
| 214 |
-
)
|
| 215 |
-
output_audio_tts = gr.Textbox(
|
| 216 |
-
label=translations["output_tts"],
|
| 217 |
-
value="audios/tts.wav",
|
| 218 |
-
placeholder="audios/tts.wav",
|
| 219 |
-
info=translations["tts_output"],
|
| 220 |
-
interactive=True
|
| 221 |
-
)
|
| 222 |
-
output_audio = gr.Textbox(
|
| 223 |
-
label=translations["output_tts_convert"],
|
| 224 |
-
value="audios/tts-convert.wav",
|
| 225 |
-
placeholder="audios/tts-convert.wav",
|
| 226 |
-
info=translations["tts_output"],
|
| 227 |
-
interactive=True
|
| 228 |
-
)
|
| 229 |
-
with gr.Accordion(
|
| 230 |
-
translations["setting"],
|
| 231 |
-
open=False
|
| 232 |
-
):
|
| 233 |
-
with gr.Accordion(
|
| 234 |
-
translations["f0_method"],
|
| 235 |
-
open=False
|
| 236 |
-
):
|
| 237 |
-
with gr.Group():
|
| 238 |
-
with gr.Row():
|
| 239 |
-
predictor_onnx = gr.Checkbox(
|
| 240 |
-
label=translations["predictor_onnx"],
|
| 241 |
-
info=translations["predictor_onnx_info"],
|
| 242 |
-
value=False,
|
| 243 |
-
interactive=True
|
| 244 |
-
)
|
| 245 |
-
unlock_full_method = gr.Checkbox(
|
| 246 |
-
label=translations["f0_unlock"],
|
| 247 |
-
info=translations["f0_unlock_info"],
|
| 248 |
-
value=False,
|
| 249 |
-
interactive=True
|
| 250 |
-
)
|
| 251 |
-
f0_method = gr.Radio(
|
| 252 |
-
label=translations["f0_method"],
|
| 253 |
-
info=translations["f0_method_info"],
|
| 254 |
-
choices=method_f0,
|
| 255 |
-
value="rmvpe",
|
| 256 |
-
interactive=True
|
| 257 |
-
)
|
| 258 |
-
hybrid_f0method = gr.Dropdown(
|
| 259 |
-
label=translations["f0_method_hybrid"],
|
| 260 |
-
info=translations["f0_method_hybrid_info"],
|
| 261 |
-
choices=hybrid_f0_method,
|
| 262 |
-
value=hybrid_f0_method[0],
|
| 263 |
-
interactive=True,
|
| 264 |
-
allow_custom_value=True,
|
| 265 |
-
visible=False
|
| 266 |
-
)
|
| 267 |
-
hop_length = gr.Slider(
|
| 268 |
-
label=translations['hop_length'],
|
| 269 |
-
info=translations["hop_length_info"],
|
| 270 |
-
minimum=64,
|
| 271 |
-
maximum=512,
|
| 272 |
-
value=160,
|
| 273 |
-
step=1,
|
| 274 |
-
interactive=True,
|
| 275 |
-
visible=False
|
| 276 |
-
)
|
| 277 |
-
alpha = gr.Slider(
|
| 278 |
-
label=translations["alpha_label"],
|
| 279 |
-
info=translations["alpha_info"],
|
| 280 |
-
minimum=0.1,
|
| 281 |
-
maximum=1,
|
| 282 |
-
value=0.5,
|
| 283 |
-
step=0.1,
|
| 284 |
-
interactive=True,
|
| 285 |
-
visible=False
|
| 286 |
-
)
|
| 287 |
-
with gr.Accordion(
|
| 288 |
-
translations["f0_file"],
|
| 289 |
-
open=False
|
| 290 |
-
):
|
| 291 |
-
upload_f0_file = gr.File(
|
| 292 |
-
label=translations["upload_f0"],
|
| 293 |
-
file_types=[".txt"]
|
| 294 |
-
)
|
| 295 |
-
f0_file_dropdown = gr.Dropdown(
|
| 296 |
-
label=translations["f0_file_2"],
|
| 297 |
-
value="",
|
| 298 |
-
choices=f0_file,
|
| 299 |
-
allow_custom_value=True,
|
| 300 |
-
interactive=True
|
| 301 |
-
)
|
| 302 |
-
refresh_f0_file = gr.Button(
|
| 303 |
-
translations["refresh"]
|
| 304 |
-
)
|
| 305 |
-
with gr.Accordion(
|
| 306 |
-
translations["hubert_model"],
|
| 307 |
-
open=False
|
| 308 |
-
):
|
| 309 |
-
embedders_mix = gr.Checkbox(
|
| 310 |
-
label=translations["embedders_mix"],
|
| 311 |
-
info=translations["embedders_mix_info"],
|
| 312 |
-
value=False,
|
| 313 |
-
interactive=True
|
| 314 |
-
)
|
| 315 |
-
embedder_mode = gr.Radio(
|
| 316 |
-
label=translations["embed_mode"],
|
| 317 |
-
info=translations["embed_mode_info"],
|
| 318 |
-
value="fairseq",
|
| 319 |
-
choices=embedders_mode,
|
| 320 |
-
interactive=True,
|
| 321 |
-
visible=True
|
| 322 |
-
)
|
| 323 |
-
embedders = gr.Radio(
|
| 324 |
-
label=translations["hubert_model"],
|
| 325 |
-
info=translations["hubert_info"],
|
| 326 |
-
choices=embedders_model,
|
| 327 |
-
value="hubert_base",
|
| 328 |
-
interactive=True
|
| 329 |
-
)
|
| 330 |
-
custom_embedders = gr.Textbox(
|
| 331 |
-
label=translations["modelname"],
|
| 332 |
-
info=translations["modelname_info"],
|
| 333 |
-
value="",
|
| 334 |
-
placeholder="hubert_base",
|
| 335 |
-
interactive=True,
|
| 336 |
-
visible=False
|
| 337 |
-
)
|
| 338 |
-
with gr.Column(visible=False) as embedders_mix_column:
|
| 339 |
-
embedders_mix_layers = gr.Slider(
|
| 340 |
-
label=translations["embedders_mix_layers"],
|
| 341 |
-
info=translations["embedders_mix_layers_info"],
|
| 342 |
-
minimum=1,
|
| 343 |
-
maximum=12,
|
| 344 |
-
value=9,
|
| 345 |
-
step=1,
|
| 346 |
-
interactive=True
|
| 347 |
-
)
|
| 348 |
-
embedders_mix_ratio = gr.Slider(
|
| 349 |
-
label=translations["embedders_mix_ratio"],
|
| 350 |
-
info=translations["embedders_mix_ratio_info"],
|
| 351 |
-
minimum=0.1,
|
| 352 |
-
maximum=1,
|
| 353 |
-
value=0.5,
|
| 354 |
-
step=0.1,
|
| 355 |
-
interactive=True
|
| 356 |
-
)
|
| 357 |
-
with gr.Accordion(
|
| 358 |
-
translations["use_presets"],
|
| 359 |
-
open=False
|
| 360 |
-
):
|
| 361 |
-
with gr.Row():
|
| 362 |
-
presets_name = gr.Dropdown(
|
| 363 |
-
label=translations["file_preset"],
|
| 364 |
-
choices=presets_file,
|
| 365 |
-
value=presets_file[0] if len(presets_file) > 0 else '',
|
| 366 |
-
interactive=True,
|
| 367 |
-
allow_custom_value=True
|
| 368 |
-
)
|
| 369 |
-
with gr.Row():
|
| 370 |
-
load_preset_button = gr.Button(
|
| 371 |
-
translations["load_file"],
|
| 372 |
-
variant="primary"
|
| 373 |
-
)
|
| 374 |
-
refresh_preset_button = gr.Button(
|
| 375 |
-
translations["refresh"]
|
| 376 |
-
)
|
| 377 |
-
with gr.Accordion(
|
| 378 |
-
translations["export_file"],
|
| 379 |
-
open=False
|
| 380 |
-
):
|
| 381 |
-
with gr.Row():
|
| 382 |
-
with gr.Column():
|
| 383 |
-
with gr.Group():
|
| 384 |
-
with gr.Row():
|
| 385 |
-
cleaner_checkbox = gr.Checkbox(
|
| 386 |
-
label=translations["save_clean"],
|
| 387 |
-
value=True,
|
| 388 |
-
interactive=True
|
| 389 |
-
)
|
| 390 |
-
autotune_checkbox = gr.Checkbox(
|
| 391 |
-
label=translations["save_autotune"],
|
| 392 |
-
value=True,
|
| 393 |
-
interactive=True
|
| 394 |
-
)
|
| 395 |
-
pitch_checkbox = gr.Checkbox(
|
| 396 |
-
label=translations["save_pitch"],
|
| 397 |
-
value=True,
|
| 398 |
-
interactive=True
|
| 399 |
-
)
|
| 400 |
-
index_strength_checkbox = gr.Checkbox(
|
| 401 |
-
label=translations["save_index_2"],
|
| 402 |
-
value=True,
|
| 403 |
-
interactive=True
|
| 404 |
-
)
|
| 405 |
-
resample_sr_checkbox = gr.Checkbox(
|
| 406 |
-
label=translations["save_resample"],
|
| 407 |
-
value=True,
|
| 408 |
-
interactive=True
|
| 409 |
-
)
|
| 410 |
-
filter_radius_checkbox = gr.Checkbox(
|
| 411 |
-
label=translations["save_filter"],
|
| 412 |
-
value=True,
|
| 413 |
-
interactive=True
|
| 414 |
-
)
|
| 415 |
-
rms_mix_rate_checkbox = gr.Checkbox(
|
| 416 |
-
label=translations["save_envelope"],
|
| 417 |
-
value=True,
|
| 418 |
-
interactive=True
|
| 419 |
-
)
|
| 420 |
-
protect_checkbox = gr.Checkbox(
|
| 421 |
-
label=translations["save_protect"],
|
| 422 |
-
value=True,
|
| 423 |
-
interactive=True
|
| 424 |
-
)
|
| 425 |
-
split_audio_checkbox = gr.Checkbox(
|
| 426 |
-
label=translations["save_split"],
|
| 427 |
-
value=True,
|
| 428 |
-
interactive=True
|
| 429 |
-
)
|
| 430 |
-
formant_shifting_checkbox = gr.Checkbox(
|
| 431 |
-
label=translations["formantshift"],
|
| 432 |
-
value=True,
|
| 433 |
-
interactive=True
|
| 434 |
-
)
|
| 435 |
-
with gr.Row():
|
| 436 |
-
with gr.Column():
|
| 437 |
-
name_to_save_file = gr.Textbox(
|
| 438 |
-
label=translations["filename_to_save"]
|
| 439 |
-
)
|
| 440 |
-
save_file_button = gr.Button(
|
| 441 |
-
translations["export_file"]
|
| 442 |
-
)
|
| 443 |
-
with gr.Row():
|
| 444 |
-
upload_presets = gr.Files(
|
| 445 |
-
label=translations["upload_presets"],
|
| 446 |
-
file_types=[".conversion.json"]
|
| 447 |
-
)
|
| 448 |
-
with gr.Group():
|
| 449 |
-
with gr.Row():
|
| 450 |
-
audio_processing = gr.Checkbox(
|
| 451 |
-
label=translations["audio_processing"],
|
| 452 |
-
value=False,
|
| 453 |
-
interactive=True
|
| 454 |
-
)
|
| 455 |
-
with gr.Row():
|
| 456 |
-
formant_shifting = gr.Checkbox(
|
| 457 |
-
label=translations["formantshift"],
|
| 458 |
-
value=False,
|
| 459 |
-
interactive=True
|
| 460 |
-
)
|
| 461 |
-
split_audio = gr.Checkbox(
|
| 462 |
-
label=translations["split_audio"],
|
| 463 |
-
value=False,
|
| 464 |
-
interactive=True
|
| 465 |
-
)
|
| 466 |
-
cleaner = gr.Checkbox(
|
| 467 |
-
label=translations["clear_audio"],
|
| 468 |
-
value=False,
|
| 469 |
-
interactive=True
|
| 470 |
-
)
|
| 471 |
-
with gr.Row():
|
| 472 |
-
autotune = gr.Checkbox(
|
| 473 |
-
label=translations["autotune"],
|
| 474 |
-
value=False,
|
| 475 |
-
interactive=True
|
| 476 |
-
)
|
| 477 |
-
checkpointing = gr.Checkbox(
|
| 478 |
-
label=translations["memory_efficient_training"],
|
| 479 |
-
value=False,
|
| 480 |
-
interactive=True
|
| 481 |
-
)
|
| 482 |
-
proposal_pitch = gr.Checkbox(
|
| 483 |
-
label=translations["proposal_pitch"],
|
| 484 |
-
value=False,
|
| 485 |
-
interactive=True
|
| 486 |
-
)
|
| 487 |
-
with gr.Row():
|
| 488 |
-
audio_upscaler = gr.Checkbox(
|
| 489 |
-
label=translations["audio_upscaler"],
|
| 490 |
-
info=translations["audio_upscaler_info"],
|
| 491 |
-
value=False,
|
| 492 |
-
interactive=True
|
| 493 |
-
)
|
| 494 |
-
with gr.Column():
|
| 495 |
-
resample_sr = gr.Radio(
|
| 496 |
-
choices=[0]+sample_rate_choice,
|
| 497 |
-
label=translations["resample"],
|
| 498 |
-
info=translations["resample_info"],
|
| 499 |
-
value=0,
|
| 500 |
-
interactive=True
|
| 501 |
-
)
|
| 502 |
-
proposal_pitch_threshold = gr.Slider(
|
| 503 |
-
minimum=50.0,
|
| 504 |
-
maximum=1200.0,
|
| 505 |
-
label=translations["proposal_pitch_threshold"],
|
| 506 |
-
info=translations["proposal_pitch_threshold_info"],
|
| 507 |
-
value=255.0,
|
| 508 |
-
step=0.1,
|
| 509 |
-
interactive=True,
|
| 510 |
-
visible=False
|
| 511 |
-
)
|
| 512 |
-
f0_autotune_strength = gr.Slider(
|
| 513 |
-
minimum=0,
|
| 514 |
-
maximum=1,
|
| 515 |
-
label=translations["autotune_rate"],
|
| 516 |
-
info=translations["autotune_rate_info"],
|
| 517 |
-
value=1,
|
| 518 |
-
step=0.1,
|
| 519 |
-
interactive=True,
|
| 520 |
-
visible=False
|
| 521 |
-
)
|
| 522 |
-
clean_strength = gr.Slider(
|
| 523 |
-
minimum=0,
|
| 524 |
-
maximum=1,
|
| 525 |
-
label=translations["clean_strength"],
|
| 526 |
-
info=translations["clean_strength_info"],
|
| 527 |
-
value=0.5,
|
| 528 |
-
step=0.1,
|
| 529 |
-
interactive=True,
|
| 530 |
-
visible=False
|
| 531 |
-
)
|
| 532 |
-
filter_radius = gr.Slider(
|
| 533 |
-
minimum=0,
|
| 534 |
-
maximum=7,
|
| 535 |
-
label=translations["filter_radius"],
|
| 536 |
-
info=translations["filter_radius_info"],
|
| 537 |
-
value=3,
|
| 538 |
-
step=1,
|
| 539 |
-
interactive=True
|
| 540 |
-
)
|
| 541 |
-
rms_mix_rate = gr.Slider(
|
| 542 |
-
minimum=0,
|
| 543 |
-
maximum=1,
|
| 544 |
-
label=translations["rms_mix_rate"],
|
| 545 |
-
info=translations["rms_mix_rate_info"],
|
| 546 |
-
value=1,
|
| 547 |
-
step=0.1,
|
| 548 |
-
interactive=True
|
| 549 |
-
)
|
| 550 |
-
protect = gr.Slider(
|
| 551 |
-
minimum=0,
|
| 552 |
-
maximum=1,
|
| 553 |
-
label=translations["protect"],
|
| 554 |
-
info=translations["protect_info"],
|
| 555 |
-
value=0.5,
|
| 556 |
-
step=0.01,
|
| 557 |
-
interactive=True
|
| 558 |
-
)
|
| 559 |
-
noise_scale = gr.Slider(
|
| 560 |
-
minimum=0.1,
|
| 561 |
-
maximum=1.0,
|
| 562 |
-
label=translations["noise_scale"],
|
| 563 |
-
info=translations["noise_scale_info"],
|
| 564 |
-
value=0.4,
|
| 565 |
-
step=0.01,
|
| 566 |
-
interactive=True,
|
| 567 |
-
visible=architecture_dict["visible"]
|
| 568 |
-
)
|
| 569 |
-
with gr.Row():
|
| 570 |
-
formant_qfrency = gr.Slider(
|
| 571 |
-
value=1.0,
|
| 572 |
-
label=translations["formant_qfrency"],
|
| 573 |
-
info=translations["formant_qfrency"],
|
| 574 |
-
minimum=0.0,
|
| 575 |
-
maximum=16.0,
|
| 576 |
-
step=0.1,
|
| 577 |
-
interactive=True,
|
| 578 |
-
visible=False
|
| 579 |
-
)
|
| 580 |
-
formant_timbre = gr.Slider(
|
| 581 |
-
value=1.0,
|
| 582 |
-
label=translations["formant_timbre"],
|
| 583 |
-
info=translations["formant_timbre"],
|
| 584 |
-
minimum=0.0,
|
| 585 |
-
maximum=16.0,
|
| 586 |
-
step=0.1,
|
| 587 |
-
interactive=True,
|
| 588 |
-
visible=False
|
| 589 |
-
)
|
| 590 |
-
with gr.Row():
|
| 591 |
-
gr.Markdown(translations["output_tts_markdown"])
|
| 592 |
-
with gr.Row():
|
| 593 |
-
tts_voice_audio = gr.Audio(
|
| 594 |
-
interactive=False,
|
| 595 |
-
label=translations["output_text_to_speech"],
|
| 596 |
-
**audio_params
|
| 597 |
-
)
|
| 598 |
-
tts_voice_convert = gr.Audio(
|
| 599 |
-
interactive=False,
|
| 600 |
-
label=translations["output_file_tts_convert"],
|
| 601 |
-
**audio_params
|
| 602 |
-
)
|
| 603 |
-
with gr.Row():
|
| 604 |
-
load_preset_button.click(
|
| 605 |
-
fn=load_presets,
|
| 606 |
-
inputs=[
|
| 607 |
-
presets_name,
|
| 608 |
-
cleaner,
|
| 609 |
-
autotune,
|
| 610 |
-
pitch,
|
| 611 |
-
clean_strength,
|
| 612 |
-
index_strength,
|
| 613 |
-
resample_sr,
|
| 614 |
-
filter_radius,
|
| 615 |
-
rms_mix_rate,
|
| 616 |
-
protect,
|
| 617 |
-
split_audio,
|
| 618 |
-
f0_autotune_strength,
|
| 619 |
-
formant_shifting,
|
| 620 |
-
formant_qfrency,
|
| 621 |
-
formant_timbre,
|
| 622 |
-
proposal_pitch,
|
| 623 |
-
proposal_pitch_threshold,
|
| 624 |
-
embedders_mix,
|
| 625 |
-
embedders_mix_layers,
|
| 626 |
-
embedders_mix_ratio
|
| 627 |
-
],
|
| 628 |
-
outputs=[
|
| 629 |
-
cleaner,
|
| 630 |
-
autotune,
|
| 631 |
-
pitch,
|
| 632 |
-
clean_strength,
|
| 633 |
-
index_strength,
|
| 634 |
-
resample_sr,
|
| 635 |
-
filter_radius,
|
| 636 |
-
rms_mix_rate,
|
| 637 |
-
protect,
|
| 638 |
-
split_audio,
|
| 639 |
-
f0_autotune_strength,
|
| 640 |
-
formant_shifting,
|
| 641 |
-
formant_qfrency,
|
| 642 |
-
formant_timbre,
|
| 643 |
-
proposal_pitch,
|
| 644 |
-
proposal_pitch_threshold,
|
| 645 |
-
embedders_mix,
|
| 646 |
-
embedders_mix_layers,
|
| 647 |
-
embedders_mix_ratio
|
| 648 |
-
]
|
| 649 |
-
)
|
| 650 |
-
save_file_button.click(
|
| 651 |
-
fn=save_presets,
|
| 652 |
-
inputs=[
|
| 653 |
-
name_to_save_file,
|
| 654 |
-
cleaner,
|
| 655 |
-
autotune,
|
| 656 |
-
pitch,
|
| 657 |
-
clean_strength,
|
| 658 |
-
index_strength,
|
| 659 |
-
resample_sr,
|
| 660 |
-
filter_radius,
|
| 661 |
-
rms_mix_rate,
|
| 662 |
-
protect,
|
| 663 |
-
split_audio,
|
| 664 |
-
f0_autotune_strength,
|
| 665 |
-
cleaner_checkbox,
|
| 666 |
-
autotune_checkbox,
|
| 667 |
-
pitch_checkbox,
|
| 668 |
-
index_strength_checkbox,
|
| 669 |
-
resample_sr_checkbox,
|
| 670 |
-
filter_radius_checkbox,
|
| 671 |
-
rms_mix_rate_checkbox,
|
| 672 |
-
protect_checkbox,
|
| 673 |
-
split_audio_checkbox,
|
| 674 |
-
formant_shifting_checkbox,
|
| 675 |
-
formant_shifting,
|
| 676 |
-
formant_qfrency,
|
| 677 |
-
formant_timbre,
|
| 678 |
-
proposal_pitch,
|
| 679 |
-
proposal_pitch_threshold,
|
| 680 |
-
embedders_mix,
|
| 681 |
-
embedders_mix_layers,
|
| 682 |
-
embedders_mix_ratio
|
| 683 |
-
],
|
| 684 |
-
outputs=[
|
| 685 |
-
presets_name
|
| 686 |
-
]
|
| 687 |
-
)
|
| 688 |
-
refresh_preset_button.click(
|
| 689 |
-
fn=change_preset_choices,
|
| 690 |
-
inputs=[],
|
| 691 |
-
outputs=[
|
| 692 |
-
presets_name
|
| 693 |
-
]
|
| 694 |
-
)
|
| 695 |
-
with gr.Row():
|
| 696 |
-
proposal_pitch.change(
|
| 697 |
-
fn=visible,
|
| 698 |
-
inputs=[
|
| 699 |
-
proposal_pitch
|
| 700 |
-
],
|
| 701 |
-
outputs=[
|
| 702 |
-
proposal_pitch_threshold
|
| 703 |
-
]
|
| 704 |
-
)
|
| 705 |
-
upload_presets.upload(
|
| 706 |
-
fn=lambda presets_in: [
|
| 707 |
-
shutil_move(preset.name, configs["presets_path"])
|
| 708 |
-
for preset in presets_in
|
| 709 |
-
][0],
|
| 710 |
-
inputs=[
|
| 711 |
-
upload_presets
|
| 712 |
-
],
|
| 713 |
-
outputs=[
|
| 714 |
-
presets_name
|
| 715 |
-
]
|
| 716 |
-
)
|
| 717 |
-
translate_button.click(
|
| 718 |
-
fn=google_translate,
|
| 719 |
-
inputs=[
|
| 720 |
-
prompt,
|
| 721 |
-
source_lang,
|
| 722 |
-
target_lang
|
| 723 |
-
],
|
| 724 |
-
outputs=[
|
| 725 |
-
prompt
|
| 726 |
-
],
|
| 727 |
-
api_name="google_translate"
|
| 728 |
-
)
|
| 729 |
-
with gr.Row():
|
| 730 |
-
unlock_full_method.change(
|
| 731 |
-
fn=unlock_f0,
|
| 732 |
-
inputs=[
|
| 733 |
-
unlock_full_method
|
| 734 |
-
],
|
| 735 |
-
outputs=[
|
| 736 |
-
f0_method
|
| 737 |
-
]
|
| 738 |
-
)
|
| 739 |
-
upload_f0_file.upload(
|
| 740 |
-
fn=lambda inp: shutil_move(inp.name, configs["f0_path"]),
|
| 741 |
-
inputs=[
|
| 742 |
-
upload_f0_file
|
| 743 |
-
],
|
| 744 |
-
outputs=[
|
| 745 |
-
f0_file_dropdown
|
| 746 |
-
]
|
| 747 |
-
)
|
| 748 |
-
refresh_f0_file.click(
|
| 749 |
-
fn=change_f0_choices,
|
| 750 |
-
inputs=[],
|
| 751 |
-
outputs=[
|
| 752 |
-
f0_file_dropdown
|
| 753 |
-
]
|
| 754 |
-
)
|
| 755 |
-
with gr.Row():
|
| 756 |
-
embedder_mode.change(
|
| 757 |
-
fn=change_embedders_mode,
|
| 758 |
-
inputs=[
|
| 759 |
-
embedder_mode
|
| 760 |
-
],
|
| 761 |
-
outputs=[
|
| 762 |
-
embedders
|
| 763 |
-
]
|
| 764 |
-
)
|
| 765 |
-
autotune.change(
|
| 766 |
-
fn=visible,
|
| 767 |
-
inputs=[
|
| 768 |
-
autotune
|
| 769 |
-
],
|
| 770 |
-
outputs=[
|
| 771 |
-
f0_autotune_strength
|
| 772 |
-
]
|
| 773 |
-
)
|
| 774 |
-
model_pth.change(
|
| 775 |
-
fn=get_index,
|
| 776 |
-
inputs=[
|
| 777 |
-
model_pth
|
| 778 |
-
],
|
| 779 |
-
outputs=[
|
| 780 |
-
model_index
|
| 781 |
-
]
|
| 782 |
-
)
|
| 783 |
-
with gr.Row():
|
| 784 |
-
cleaner.change(
|
| 785 |
-
fn=visible,
|
| 786 |
-
inputs=[
|
| 787 |
-
cleaner
|
| 788 |
-
],
|
| 789 |
-
outputs=[
|
| 790 |
-
clean_strength
|
| 791 |
-
]
|
| 792 |
-
)
|
| 793 |
-
f0_method.change(
|
| 794 |
-
fn=lambda method, hybrid: [
|
| 795 |
-
visible(method == "hybrid"),
|
| 796 |
-
visible(method == "hybrid"),
|
| 797 |
-
hoplength_show(method, hybrid)
|
| 798 |
-
],
|
| 799 |
-
inputs=[
|
| 800 |
-
f0_method,
|
| 801 |
-
hybrid_f0method
|
| 802 |
-
],
|
| 803 |
-
outputs=[
|
| 804 |
-
hybrid_f0method,
|
| 805 |
-
alpha,
|
| 806 |
-
hop_length
|
| 807 |
-
]
|
| 808 |
-
)
|
| 809 |
-
hybrid_f0method.change(
|
| 810 |
-
fn=hoplength_show,
|
| 811 |
-
inputs=[
|
| 812 |
-
f0_method,
|
| 813 |
-
hybrid_f0method
|
| 814 |
-
],
|
| 815 |
-
outputs=[
|
| 816 |
-
hop_length
|
| 817 |
-
]
|
| 818 |
-
)
|
| 819 |
-
with gr.Row():
|
| 820 |
-
refresh.click(
|
| 821 |
-
fn=change_models_choices,
|
| 822 |
-
inputs=[],
|
| 823 |
-
outputs=[
|
| 824 |
-
model_pth,
|
| 825 |
-
model_index
|
| 826 |
-
]
|
| 827 |
-
)
|
| 828 |
-
embedders.change(
|
| 829 |
-
fn=lambda embedders: visible(embedders == "custom"),
|
| 830 |
-
inputs=[
|
| 831 |
-
embedders
|
| 832 |
-
],
|
| 833 |
-
outputs=[
|
| 834 |
-
custom_embedders
|
| 835 |
-
]
|
| 836 |
-
)
|
| 837 |
-
formant_shifting.change(
|
| 838 |
-
fn=lambda a: [
|
| 839 |
-
visible(a)
|
| 840 |
-
for _ in range(2)
|
| 841 |
-
],
|
| 842 |
-
inputs=[
|
| 843 |
-
formant_shifting
|
| 844 |
-
],
|
| 845 |
-
outputs=[
|
| 846 |
-
formant_qfrency,
|
| 847 |
-
formant_timbre
|
| 848 |
-
]
|
| 849 |
-
)
|
| 850 |
-
with gr.Row():
|
| 851 |
-
model_index.change(
|
| 852 |
-
fn=index_strength_show,
|
| 853 |
-
inputs=[
|
| 854 |
-
model_index
|
| 855 |
-
],
|
| 856 |
-
outputs=[
|
| 857 |
-
index_strength,
|
| 858 |
-
nprobe
|
| 859 |
-
]
|
| 860 |
-
)
|
| 861 |
-
txt_input.upload(
|
| 862 |
-
fn=process_input,
|
| 863 |
-
inputs=[
|
| 864 |
-
txt_input
|
| 865 |
-
],
|
| 866 |
-
outputs=[
|
| 867 |
-
prompt
|
| 868 |
-
]
|
| 869 |
-
)
|
| 870 |
-
use_txt.change(
|
| 871 |
-
fn=visible,
|
| 872 |
-
inputs=[
|
| 873 |
-
use_txt
|
| 874 |
-
],
|
| 875 |
-
outputs=[
|
| 876 |
-
txt_input
|
| 877 |
-
]
|
| 878 |
-
)
|
| 879 |
-
use_txt.change(
|
| 880 |
-
fn=lambda: None,
|
| 881 |
-
inputs=[],
|
| 882 |
-
outputs=[
|
| 883 |
-
txt_input
|
| 884 |
-
]
|
| 885 |
-
)
|
| 886 |
-
with gr.Row():
|
| 887 |
-
google_tts_check_box.change(
|
| 888 |
-
fn=change_tts_voice_choices,
|
| 889 |
-
inputs=[
|
| 890 |
-
google_tts_check_box
|
| 891 |
-
],
|
| 892 |
-
outputs=[
|
| 893 |
-
tts_voice
|
| 894 |
-
]
|
| 895 |
-
)
|
| 896 |
-
model_pth.change(
|
| 897 |
-
fn=get_speakers_id_and_architecture,
|
| 898 |
-
inputs=[
|
| 899 |
-
model_pth
|
| 900 |
-
],
|
| 901 |
-
outputs=[
|
| 902 |
-
sids,
|
| 903 |
-
noise_scale
|
| 904 |
-
]
|
| 905 |
-
)
|
| 906 |
-
embedders_mix.change(
|
| 907 |
-
fn=visible,
|
| 908 |
-
inputs=[
|
| 909 |
-
embedders_mix
|
| 910 |
-
],
|
| 911 |
-
outputs=[
|
| 912 |
-
embedders_mix_column
|
| 913 |
-
]
|
| 914 |
-
)
|
| 915 |
-
with gr.Row():
|
| 916 |
-
tts_button.click(
|
| 917 |
-
fn=TTS,
|
| 918 |
-
inputs=[
|
| 919 |
-
prompt,
|
| 920 |
-
tts_voice,
|
| 921 |
-
speed,
|
| 922 |
-
output_audio_tts,
|
| 923 |
-
tts_pitch,
|
| 924 |
-
google_tts_check_box,
|
| 925 |
-
txt_input
|
| 926 |
-
],
|
| 927 |
-
outputs=[
|
| 928 |
-
tts_voice_audio
|
| 929 |
-
],
|
| 930 |
-
api_name="text-to-speech"
|
| 931 |
-
)
|
| 932 |
-
convert_button.click(
|
| 933 |
-
fn=convert_tts,
|
| 934 |
-
inputs=[
|
| 935 |
-
cleaner,
|
| 936 |
-
autotune,
|
| 937 |
-
pitch,
|
| 938 |
-
clean_strength,
|
| 939 |
-
model_pth,
|
| 940 |
-
model_index,
|
| 941 |
-
index_strength,
|
| 942 |
-
output_audio_tts,
|
| 943 |
-
output_audio,
|
| 944 |
-
export_format,
|
| 945 |
-
f0_method,
|
| 946 |
-
hybrid_f0method,
|
| 947 |
-
hop_length,
|
| 948 |
-
embedders,
|
| 949 |
-
custom_embedders,
|
| 950 |
-
resample_sr,
|
| 951 |
-
filter_radius,
|
| 952 |
-
rms_mix_rate,
|
| 953 |
-
protect,
|
| 954 |
-
split_audio,
|
| 955 |
-
f0_autotune_strength,
|
| 956 |
-
checkpointing,
|
| 957 |
-
predictor_onnx,
|
| 958 |
-
formant_shifting,
|
| 959 |
-
formant_qfrency,
|
| 960 |
-
formant_timbre,
|
| 961 |
-
f0_file_dropdown,
|
| 962 |
-
embedder_mode,
|
| 963 |
-
proposal_pitch,
|
| 964 |
-
proposal_pitch_threshold,
|
| 965 |
-
audio_processing,
|
| 966 |
-
alpha,
|
| 967 |
-
sids,
|
| 968 |
-
embedders_mix,
|
| 969 |
-
embedders_mix_layers,
|
| 970 |
-
embedders_mix_ratio,
|
| 971 |
-
noise_scale,
|
| 972 |
-
nprobe,
|
| 973 |
-
audio_upscaler
|
| 974 |
-
],
|
| 975 |
-
outputs=[
|
| 976 |
-
tts_voice_convert
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/inference/child/convert_with_vad.py
DELETED
|
@@ -1,810 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.inference import convert_with_vad
|
| 9 |
-
|
| 10 |
-
from main.app.core.ui import (
|
| 11 |
-
visible,
|
| 12 |
-
get_index,
|
| 13 |
-
unlock_f0,
|
| 14 |
-
shutil_move,
|
| 15 |
-
hoplength_show,
|
| 16 |
-
index_strength_show,
|
| 17 |
-
change_audios_choices,
|
| 18 |
-
change_models_choices,
|
| 19 |
-
change_embedders_mode,
|
| 20 |
-
get_speakers_id_and_architecture
|
| 21 |
-
)
|
| 22 |
-
|
| 23 |
-
from main.app.variables import (
|
| 24 |
-
configs,
|
| 25 |
-
method_f0,
|
| 26 |
-
model_name,
|
| 27 |
-
index_path,
|
| 28 |
-
file_types,
|
| 29 |
-
audio_params,
|
| 30 |
-
translations,
|
| 31 |
-
embedders_mode,
|
| 32 |
-
embedders_model,
|
| 33 |
-
paths_for_files,
|
| 34 |
-
hybrid_f0_method,
|
| 35 |
-
sample_rate_choice,
|
| 36 |
-
export_format_choices,
|
| 37 |
-
)
|
| 38 |
-
|
| 39 |
-
def convert_with_vad_tab():
|
| 40 |
-
with gr.Row():
|
| 41 |
-
gr.Markdown(translations["convert_with_vad_info"])
|
| 42 |
-
with gr.Row():
|
| 43 |
-
with gr.Column():
|
| 44 |
-
with gr.Group():
|
| 45 |
-
with gr.Row():
|
| 46 |
-
cleaner = gr.Checkbox(
|
| 47 |
-
label=translations["clear_audio"],
|
| 48 |
-
value=False,
|
| 49 |
-
interactive=True
|
| 50 |
-
)
|
| 51 |
-
autotune = gr.Checkbox(
|
| 52 |
-
label=translations["autotune"],
|
| 53 |
-
value=False,
|
| 54 |
-
interactive=True
|
| 55 |
-
)
|
| 56 |
-
checkpointing = gr.Checkbox(
|
| 57 |
-
label=translations["memory_efficient_training"],
|
| 58 |
-
value=False,
|
| 59 |
-
interactive=True
|
| 60 |
-
)
|
| 61 |
-
formant_shifting = gr.Checkbox(
|
| 62 |
-
label=translations["formantshift"],
|
| 63 |
-
value=False,
|
| 64 |
-
interactive=True
|
| 65 |
-
)
|
| 66 |
-
proposal_pitch = gr.Checkbox(
|
| 67 |
-
label=translations["proposal_pitch"],
|
| 68 |
-
value=False,
|
| 69 |
-
interactive=True
|
| 70 |
-
)
|
| 71 |
-
audio_processing = gr.Checkbox(
|
| 72 |
-
label=translations["audio_processing"],
|
| 73 |
-
value=False,
|
| 74 |
-
interactive=True
|
| 75 |
-
)
|
| 76 |
-
with gr.Row():
|
| 77 |
-
num_spk = gr.Slider(
|
| 78 |
-
minimum=2,
|
| 79 |
-
maximum=8,
|
| 80 |
-
step=1,
|
| 81 |
-
info=translations["num_spk_info"],
|
| 82 |
-
label=translations["num_spk"],
|
| 83 |
-
value=2,
|
| 84 |
-
interactive=True
|
| 85 |
-
)
|
| 86 |
-
with gr.Row():
|
| 87 |
-
with gr.Column():
|
| 88 |
-
convert_button = gr.Button(
|
| 89 |
-
translations["convert_audio"],
|
| 90 |
-
variant="primary"
|
| 91 |
-
)
|
| 92 |
-
with gr.Row():
|
| 93 |
-
with gr.Column():
|
| 94 |
-
with gr.Accordion(
|
| 95 |
-
translations["model_accordion"] + " 1",
|
| 96 |
-
open=True
|
| 97 |
-
):
|
| 98 |
-
with gr.Row():
|
| 99 |
-
model_pth_1 = gr.Dropdown(
|
| 100 |
-
label=translations["model_name"],
|
| 101 |
-
choices=model_name,
|
| 102 |
-
value=model_name[0] if len(model_name) >= 1 else "",
|
| 103 |
-
interactive=True,
|
| 104 |
-
allow_custom_value=True
|
| 105 |
-
)
|
| 106 |
-
model_index_1 = gr.Dropdown(
|
| 107 |
-
label=translations["index_path"],
|
| 108 |
-
choices=index_path,
|
| 109 |
-
value=index_path[0] if len(index_path) >= 1 else "",
|
| 110 |
-
interactive=True,
|
| 111 |
-
allow_custom_value=True
|
| 112 |
-
)
|
| 113 |
-
with gr.Row():
|
| 114 |
-
refresh_model_1 = gr.Button(
|
| 115 |
-
translations["refresh"]
|
| 116 |
-
)
|
| 117 |
-
with gr.Row():
|
| 118 |
-
pitch_1 = gr.Slider(
|
| 119 |
-
minimum=-24,
|
| 120 |
-
maximum=24,
|
| 121 |
-
step=1,
|
| 122 |
-
info=translations["pitch_info"],
|
| 123 |
-
label=translations["pitch"],
|
| 124 |
-
value=0,
|
| 125 |
-
interactive=True
|
| 126 |
-
)
|
| 127 |
-
index_strength_1 = gr.Slider(
|
| 128 |
-
label=translations["index_strength"],
|
| 129 |
-
info=translations["index_strength_info"],
|
| 130 |
-
minimum=0,
|
| 131 |
-
maximum=1,
|
| 132 |
-
value=0.5,
|
| 133 |
-
step=0.01,
|
| 134 |
-
interactive=True,
|
| 135 |
-
visible=True
|
| 136 |
-
)
|
| 137 |
-
with gr.Row():
|
| 138 |
-
nprobe_1 = gr.Slider(
|
| 139 |
-
label=translations["nprobe"],
|
| 140 |
-
info=translations["nprobe_info"],
|
| 141 |
-
minimum=1,
|
| 142 |
-
maximum=64,
|
| 143 |
-
value=9,
|
| 144 |
-
step=1,
|
| 145 |
-
interactive=True,
|
| 146 |
-
visible=True
|
| 147 |
-
)
|
| 148 |
-
with gr.Row():
|
| 149 |
-
sid_dict_1, architecture_dict_1 = get_speakers_id_and_architecture(model_pth_1.value)
|
| 150 |
-
if sid_dict_1["visible"] == "hidden": sid_dict_1["visible"] = False
|
| 151 |
-
if architecture_dict_1["visible"] == "hidden": architecture_dict_1["visible"] = False
|
| 152 |
-
|
| 153 |
-
sids_1 = gr.Dropdown(
|
| 154 |
-
label=translations["sids_label"],
|
| 155 |
-
info=translations["sids_info"],
|
| 156 |
-
choices=sid_dict_1["choices"],
|
| 157 |
-
value=sid_dict_1["value"],
|
| 158 |
-
visible=sid_dict_1["visible"],
|
| 159 |
-
interactive=True
|
| 160 |
-
)
|
| 161 |
-
with gr.Row():
|
| 162 |
-
noise_scale_1 = gr.Slider(
|
| 163 |
-
minimum=0.1,
|
| 164 |
-
maximum=1.0,
|
| 165 |
-
label=translations["noise_scale"],
|
| 166 |
-
info=translations["noise_scale_info"],
|
| 167 |
-
value=0.4,
|
| 168 |
-
step=0.01,
|
| 169 |
-
interactive=True,
|
| 170 |
-
visible=architecture_dict_1["visible"]
|
| 171 |
-
)
|
| 172 |
-
with gr.Accordion(
|
| 173 |
-
translations["input_output"],
|
| 174 |
-
open=False
|
| 175 |
-
):
|
| 176 |
-
with gr.Column():
|
| 177 |
-
export_format = gr.Radio(
|
| 178 |
-
label=translations["export_format"],
|
| 179 |
-
info=translations["export_info"],
|
| 180 |
-
choices=export_format_choices,
|
| 181 |
-
value="wav",
|
| 182 |
-
interactive=True
|
| 183 |
-
)
|
| 184 |
-
input_audio = gr.Dropdown(
|
| 185 |
-
label=translations["audio_path"],
|
| 186 |
-
value="",
|
| 187 |
-
choices=paths_for_files,
|
| 188 |
-
info=translations["provide_audio"],
|
| 189 |
-
allow_custom_value=True,
|
| 190 |
-
interactive=True
|
| 191 |
-
)
|
| 192 |
-
output_audio = gr.Textbox(
|
| 193 |
-
label=translations["output_path"],
|
| 194 |
-
value="audios/output.wav",
|
| 195 |
-
placeholder="audios/output.wav",
|
| 196 |
-
info=translations["output_path_info"],
|
| 197 |
-
interactive=True
|
| 198 |
-
)
|
| 199 |
-
with gr.Column():
|
| 200 |
-
refresh_audio = gr.Button(
|
| 201 |
-
translations["refresh"]
|
| 202 |
-
)
|
| 203 |
-
with gr.Row():
|
| 204 |
-
drop_audio = gr.Files(
|
| 205 |
-
label=translations["drop_audio"],
|
| 206 |
-
file_types=file_types
|
| 207 |
-
)
|
| 208 |
-
with gr.Column():
|
| 209 |
-
with gr.Accordion(
|
| 210 |
-
translations["model_accordion"] + " 2",
|
| 211 |
-
open=True
|
| 212 |
-
):
|
| 213 |
-
with gr.Row():
|
| 214 |
-
model_pth_2 = gr.Dropdown(
|
| 215 |
-
label=translations["model_name"],
|
| 216 |
-
choices=model_name,
|
| 217 |
-
value=model_name[0] if len(model_name) >= 1 else "",
|
| 218 |
-
interactive=True,
|
| 219 |
-
allow_custom_value=True
|
| 220 |
-
)
|
| 221 |
-
model_index_2 = gr.Dropdown(
|
| 222 |
-
label=translations["index_path"],
|
| 223 |
-
choices=index_path,
|
| 224 |
-
value=index_path[0] if len(index_path) >= 1 else "",
|
| 225 |
-
interactive=True,
|
| 226 |
-
allow_custom_value=True
|
| 227 |
-
)
|
| 228 |
-
with gr.Row():
|
| 229 |
-
refresh_model_2 = gr.Button(
|
| 230 |
-
translations["refresh"]
|
| 231 |
-
)
|
| 232 |
-
with gr.Row():
|
| 233 |
-
pitch_2 = gr.Slider(
|
| 234 |
-
minimum=-24,
|
| 235 |
-
maximum=24,
|
| 236 |
-
step=1,
|
| 237 |
-
info=translations["pitch_info"],
|
| 238 |
-
label=translations["pitch"],
|
| 239 |
-
value=0,
|
| 240 |
-
interactive=True
|
| 241 |
-
)
|
| 242 |
-
index_strength_2 = gr.Slider(
|
| 243 |
-
label=translations["index_strength"],
|
| 244 |
-
info=translations["index_strength_info"],
|
| 245 |
-
minimum=0,
|
| 246 |
-
maximum=1,
|
| 247 |
-
value=0.5,
|
| 248 |
-
step=0.01,
|
| 249 |
-
interactive=True,
|
| 250 |
-
visible=True
|
| 251 |
-
)
|
| 252 |
-
with gr.Row():
|
| 253 |
-
nprobe_2 = gr.Slider(
|
| 254 |
-
label=translations["nprobe"],
|
| 255 |
-
info=translations["nprobe_info"],
|
| 256 |
-
minimum=1,
|
| 257 |
-
maximum=64,
|
| 258 |
-
value=9,
|
| 259 |
-
step=1,
|
| 260 |
-
interactive=True,
|
| 261 |
-
visible=True
|
| 262 |
-
)
|
| 263 |
-
with gr.Row():
|
| 264 |
-
sid_dict_2, architecture_dict_2 = get_speakers_id_and_architecture(model_pth_2.value)
|
| 265 |
-
if sid_dict_2["visible"] == "hidden": sid_dict_2["visible"] = False
|
| 266 |
-
if architecture_dict_2["visible"] == "hidden": architecture_dict_2["visible"] = False
|
| 267 |
-
|
| 268 |
-
sids_2 = gr.Dropdown(
|
| 269 |
-
label=translations["sids_label"],
|
| 270 |
-
info=translations["sids_info"],
|
| 271 |
-
choices=sid_dict_2["choices"],
|
| 272 |
-
value=sid_dict_2["value"],
|
| 273 |
-
visible=sid_dict_2["visible"],
|
| 274 |
-
interactive=True
|
| 275 |
-
)
|
| 276 |
-
with gr.Row():
|
| 277 |
-
noise_scale_2 = gr.Slider(
|
| 278 |
-
minimum=0.1,
|
| 279 |
-
maximum=1.0,
|
| 280 |
-
label=translations["noise_scale"],
|
| 281 |
-
info=translations["noise_scale_info"],
|
| 282 |
-
value=0.4,
|
| 283 |
-
step=0.01,
|
| 284 |
-
interactive=True,
|
| 285 |
-
visible=architecture_dict_2["visible"]
|
| 286 |
-
)
|
| 287 |
-
with gr.Accordion(
|
| 288 |
-
translations["setting"],
|
| 289 |
-
open=False
|
| 290 |
-
):
|
| 291 |
-
with gr.Accordion(
|
| 292 |
-
translations["f0_method"],
|
| 293 |
-
open=False
|
| 294 |
-
):
|
| 295 |
-
with gr.Group():
|
| 296 |
-
with gr.Row():
|
| 297 |
-
predictor_onnx = gr.Checkbox(
|
| 298 |
-
label=translations["predictor_onnx"],
|
| 299 |
-
info=translations["predictor_onnx_info"],
|
| 300 |
-
value=False,
|
| 301 |
-
interactive=True
|
| 302 |
-
)
|
| 303 |
-
unlock_full_method = gr.Checkbox(
|
| 304 |
-
label=translations["f0_unlock"],
|
| 305 |
-
info=translations["f0_unlock_info"],
|
| 306 |
-
value=False,
|
| 307 |
-
interactive=True
|
| 308 |
-
)
|
| 309 |
-
f0_method = gr.Radio(
|
| 310 |
-
label=translations["f0_method"],
|
| 311 |
-
info=translations["f0_method_info"],
|
| 312 |
-
choices=method_f0,
|
| 313 |
-
value="rmvpe",
|
| 314 |
-
interactive=True
|
| 315 |
-
)
|
| 316 |
-
hybrid_f0method = gr.Dropdown(
|
| 317 |
-
label=translations["f0_method_hybrid"],
|
| 318 |
-
info=translations["f0_method_hybrid_info"],
|
| 319 |
-
choices=hybrid_f0_method,
|
| 320 |
-
value=hybrid_f0_method[0],
|
| 321 |
-
interactive=True,
|
| 322 |
-
allow_custom_value=True,
|
| 323 |
-
visible=False
|
| 324 |
-
)
|
| 325 |
-
hop_length = gr.Slider(
|
| 326 |
-
label=translations['hop_length'],
|
| 327 |
-
info=translations["hop_length_info"],
|
| 328 |
-
minimum=64,
|
| 329 |
-
maximum=512,
|
| 330 |
-
value=160,
|
| 331 |
-
step=1,
|
| 332 |
-
interactive=True,
|
| 333 |
-
visible=False
|
| 334 |
-
)
|
| 335 |
-
alpha = gr.Slider(
|
| 336 |
-
label=translations["alpha_label"],
|
| 337 |
-
info=translations["alpha_info"],
|
| 338 |
-
minimum=0.1,
|
| 339 |
-
maximum=1,
|
| 340 |
-
value=0.5,
|
| 341 |
-
step=0.1,
|
| 342 |
-
interactive=True,
|
| 343 |
-
visible=False
|
| 344 |
-
)
|
| 345 |
-
with gr.Accordion(
|
| 346 |
-
translations["hubert_model"],
|
| 347 |
-
open=False
|
| 348 |
-
):
|
| 349 |
-
embedders_mix = gr.Checkbox(
|
| 350 |
-
label=translations["embedders_mix"],
|
| 351 |
-
info=translations["embedders_mix_info"],
|
| 352 |
-
value=False,
|
| 353 |
-
interactive=True
|
| 354 |
-
)
|
| 355 |
-
embedder_mode = gr.Radio(
|
| 356 |
-
label=translations["embed_mode"],
|
| 357 |
-
info=translations["embed_mode_info"],
|
| 358 |
-
value="fairseq",
|
| 359 |
-
choices=embedders_mode,
|
| 360 |
-
interactive=True,
|
| 361 |
-
visible=True
|
| 362 |
-
)
|
| 363 |
-
embedders = gr.Radio(
|
| 364 |
-
label=translations["hubert_model"],
|
| 365 |
-
info=translations["hubert_info"],
|
| 366 |
-
choices=embedders_model,
|
| 367 |
-
value="hubert_base",
|
| 368 |
-
interactive=True
|
| 369 |
-
)
|
| 370 |
-
custom_embedders = gr.Textbox(
|
| 371 |
-
label=translations["modelname"],
|
| 372 |
-
info=translations["modelname_info"],
|
| 373 |
-
value="",
|
| 374 |
-
placeholder="hubert_base",
|
| 375 |
-
interactive=True,
|
| 376 |
-
visible=False
|
| 377 |
-
)
|
| 378 |
-
with gr.Column(visible=False) as embedders_mix_column:
|
| 379 |
-
embedders_mix_layers = gr.Slider(
|
| 380 |
-
label=translations["embedders_mix_layers"],
|
| 381 |
-
info=translations["embedders_mix_layers_info"],
|
| 382 |
-
minimum=1,
|
| 383 |
-
maximum=12,
|
| 384 |
-
value=9,
|
| 385 |
-
step=1,
|
| 386 |
-
interactive=True
|
| 387 |
-
)
|
| 388 |
-
embedders_mix_ratio = gr.Slider(
|
| 389 |
-
label=translations["embedders_mix_ratio"],
|
| 390 |
-
info=translations["embedders_mix_ratio_info"],
|
| 391 |
-
minimum=0.1,
|
| 392 |
-
maximum=1,
|
| 393 |
-
value=0.5,
|
| 394 |
-
step=0.1,
|
| 395 |
-
interactive=True
|
| 396 |
-
)
|
| 397 |
-
with gr.Column():
|
| 398 |
-
resample_sr3 = gr.Radio(
|
| 399 |
-
choices=[0]+sample_rate_choice,
|
| 400 |
-
label=translations["resample"],
|
| 401 |
-
info=translations["resample_info"],
|
| 402 |
-
value=0,
|
| 403 |
-
interactive=True
|
| 404 |
-
)
|
| 405 |
-
proposal_pitch_threshold = gr.Slider(
|
| 406 |
-
minimum=50.0,
|
| 407 |
-
maximum=1200.0,
|
| 408 |
-
label=translations["proposal_pitch_threshold"],
|
| 409 |
-
info=translations["proposal_pitch_threshold_info"],
|
| 410 |
-
value=255.0,
|
| 411 |
-
step=0.1,
|
| 412 |
-
interactive=True,
|
| 413 |
-
visible=False
|
| 414 |
-
)
|
| 415 |
-
clean_strength = gr.Slider(
|
| 416 |
-
label=translations["clean_strength"],
|
| 417 |
-
info=translations["clean_strength_info"],
|
| 418 |
-
minimum=0,
|
| 419 |
-
maximum=1,
|
| 420 |
-
value=0.5,
|
| 421 |
-
step=0.1,
|
| 422 |
-
interactive=True,
|
| 423 |
-
visible=False
|
| 424 |
-
)
|
| 425 |
-
f0_autotune_strength = gr.Slider(
|
| 426 |
-
minimum=0,
|
| 427 |
-
maximum=1,
|
| 428 |
-
label=translations["autotune_rate"],
|
| 429 |
-
info=translations["autotune_rate_info"],
|
| 430 |
-
value=1,
|
| 431 |
-
step=0.1,
|
| 432 |
-
interactive=True,
|
| 433 |
-
visible=False
|
| 434 |
-
)
|
| 435 |
-
filter_radius = gr.Slider(
|
| 436 |
-
minimum=0,
|
| 437 |
-
maximum=7,
|
| 438 |
-
label=translations["filter_radius"],
|
| 439 |
-
info=translations["filter_radius_info"],
|
| 440 |
-
value=3,
|
| 441 |
-
step=1,
|
| 442 |
-
interactive=True
|
| 443 |
-
)
|
| 444 |
-
rms_mix_rate = gr.Slider(
|
| 445 |
-
minimum=0,
|
| 446 |
-
maximum=1,
|
| 447 |
-
label=translations["rms_mix_rate"],
|
| 448 |
-
info=translations["rms_mix_rate_info"],
|
| 449 |
-
value=1,
|
| 450 |
-
step=0.1,
|
| 451 |
-
interactive=True
|
| 452 |
-
)
|
| 453 |
-
protect = gr.Slider(
|
| 454 |
-
minimum=0,
|
| 455 |
-
maximum=1,
|
| 456 |
-
label=translations["protect"],
|
| 457 |
-
info=translations["protect_info"],
|
| 458 |
-
value=0.5,
|
| 459 |
-
step=0.01,
|
| 460 |
-
interactive=True
|
| 461 |
-
)
|
| 462 |
-
with gr.Row():
|
| 463 |
-
vad_sensitivity = gr.Slider(
|
| 464 |
-
minimum=0,
|
| 465 |
-
maximum=3,
|
| 466 |
-
label=translations["vad_sensitivity_label"],
|
| 467 |
-
info=translations["vad_sensitivity_info"],
|
| 468 |
-
value=3,
|
| 469 |
-
step=1,
|
| 470 |
-
interactive=True,
|
| 471 |
-
visible=False
|
| 472 |
-
)
|
| 473 |
-
vad_frame_ms = gr.Slider(
|
| 474 |
-
minimum=10,
|
| 475 |
-
maximum=30,
|
| 476 |
-
label=translations["vad_frame_ms_label"],
|
| 477 |
-
info=translations["vad_frame_ms_info"],
|
| 478 |
-
value=30,
|
| 479 |
-
step=10,
|
| 480 |
-
interactive=True,
|
| 481 |
-
visible=False
|
| 482 |
-
)
|
| 483 |
-
with gr.Row():
|
| 484 |
-
formant_qfrency = gr.Slider(
|
| 485 |
-
value=1.0,
|
| 486 |
-
label=translations["formant_qfrency"] + " 1",
|
| 487 |
-
info=translations["formant_qfrency"],
|
| 488 |
-
minimum=0.0,
|
| 489 |
-
maximum=16.0,
|
| 490 |
-
step=0.1,
|
| 491 |
-
interactive=True,
|
| 492 |
-
visible=False
|
| 493 |
-
)
|
| 494 |
-
formant_timbre = gr.Slider(
|
| 495 |
-
value=1.0,
|
| 496 |
-
label=translations["formant_timbre"] + " 1",
|
| 497 |
-
info=translations["formant_timbre"],
|
| 498 |
-
minimum=0.0,
|
| 499 |
-
maximum=16.0,
|
| 500 |
-
step=0.1,
|
| 501 |
-
interactive=True,
|
| 502 |
-
visible=False
|
| 503 |
-
)
|
| 504 |
-
with gr.Row():
|
| 505 |
-
formant_qfrency = gr.Slider(
|
| 506 |
-
value=1.0,
|
| 507 |
-
label=translations["formant_qfrency"] + " 2",
|
| 508 |
-
info=translations["formant_qfrency"],
|
| 509 |
-
minimum=0.0,
|
| 510 |
-
maximum=16.0,
|
| 511 |
-
step=0.1,
|
| 512 |
-
interactive=True,
|
| 513 |
-
visible=False
|
| 514 |
-
)
|
| 515 |
-
formant_timbre = gr.Slider(
|
| 516 |
-
value=1.0,
|
| 517 |
-
label=translations["formant_timbre"] + " 2",
|
| 518 |
-
info=translations["formant_timbre"],
|
| 519 |
-
minimum=0.0,
|
| 520 |
-
maximum=16.0,
|
| 521 |
-
step=0.1,
|
| 522 |
-
interactive=True,
|
| 523 |
-
visible=False
|
| 524 |
-
)
|
| 525 |
-
with gr.Row():
|
| 526 |
-
gr.Markdown(translations["input_output"])
|
| 527 |
-
with gr.Row():
|
| 528 |
-
play_input_audio = gr.Audio(
|
| 529 |
-
interactive=False,
|
| 530 |
-
label=translations["input_audio"],
|
| 531 |
-
**audio_params
|
| 532 |
-
)
|
| 533 |
-
play_output_audio = gr.Audio(
|
| 534 |
-
interactive=False,
|
| 535 |
-
label=translations["output_file_tts_convert"],
|
| 536 |
-
**audio_params
|
| 537 |
-
)
|
| 538 |
-
with gr.Row():
|
| 539 |
-
autotune.change(
|
| 540 |
-
fn=visible,
|
| 541 |
-
inputs=[
|
| 542 |
-
autotune
|
| 543 |
-
],
|
| 544 |
-
outputs=[
|
| 545 |
-
f0_autotune_strength
|
| 546 |
-
]
|
| 547 |
-
)
|
| 548 |
-
cleaner.change(
|
| 549 |
-
fn=visible,
|
| 550 |
-
inputs=[
|
| 551 |
-
cleaner
|
| 552 |
-
],
|
| 553 |
-
outputs=[
|
| 554 |
-
clean_strength
|
| 555 |
-
]
|
| 556 |
-
)
|
| 557 |
-
f0_method.change(
|
| 558 |
-
fn=lambda method, hybrid: [
|
| 559 |
-
visible(method == "hybrid"),
|
| 560 |
-
visible(method == "hybrid"),
|
| 561 |
-
hoplength_show(method, hybrid)
|
| 562 |
-
],
|
| 563 |
-
inputs=[
|
| 564 |
-
f0_method,
|
| 565 |
-
hybrid_f0method
|
| 566 |
-
],
|
| 567 |
-
outputs=[
|
| 568 |
-
hybrid_f0method,
|
| 569 |
-
alpha,
|
| 570 |
-
hop_length
|
| 571 |
-
]
|
| 572 |
-
)
|
| 573 |
-
with gr.Row():
|
| 574 |
-
hybrid_f0method.change(
|
| 575 |
-
fn=hoplength_show,
|
| 576 |
-
inputs=[
|
| 577 |
-
f0_method,
|
| 578 |
-
hybrid_f0method
|
| 579 |
-
],
|
| 580 |
-
outputs=[
|
| 581 |
-
hop_length
|
| 582 |
-
]
|
| 583 |
-
)
|
| 584 |
-
refresh_model_1.click(
|
| 585 |
-
fn=change_models_choices,
|
| 586 |
-
inputs=[],
|
| 587 |
-
outputs=[
|
| 588 |
-
model_pth_1,
|
| 589 |
-
model_index_1
|
| 590 |
-
]
|
| 591 |
-
)
|
| 592 |
-
model_pth_1.change(
|
| 593 |
-
fn=get_index,
|
| 594 |
-
inputs=[
|
| 595 |
-
model_pth_1
|
| 596 |
-
],
|
| 597 |
-
outputs=[
|
| 598 |
-
model_index_1
|
| 599 |
-
]
|
| 600 |
-
)
|
| 601 |
-
with gr.Row():
|
| 602 |
-
refresh_model_2.click(
|
| 603 |
-
fn=change_models_choices,
|
| 604 |
-
inputs=[],
|
| 605 |
-
outputs=[
|
| 606 |
-
model_pth_2,
|
| 607 |
-
model_index_2
|
| 608 |
-
]
|
| 609 |
-
)
|
| 610 |
-
model_pth_2.change(
|
| 611 |
-
fn=get_index,
|
| 612 |
-
inputs=[
|
| 613 |
-
model_pth_2
|
| 614 |
-
],
|
| 615 |
-
outputs=[
|
| 616 |
-
model_index_2
|
| 617 |
-
]
|
| 618 |
-
)
|
| 619 |
-
drop_audio.upload(
|
| 620 |
-
fn=lambda audio_in: [
|
| 621 |
-
shutil_move(audio.name, configs["audios_path"])
|
| 622 |
-
for audio in audio_in
|
| 623 |
-
][0],
|
| 624 |
-
inputs=[
|
| 625 |
-
drop_audio
|
| 626 |
-
],
|
| 627 |
-
outputs=[
|
| 628 |
-
input_audio
|
| 629 |
-
]
|
| 630 |
-
)
|
| 631 |
-
with gr.Row():
|
| 632 |
-
input_audio.change(
|
| 633 |
-
fn=lambda audio: audio if os.path.isfile(audio) else None,
|
| 634 |
-
inputs=[
|
| 635 |
-
input_audio
|
| 636 |
-
],
|
| 637 |
-
outputs=[
|
| 638 |
-
play_input_audio
|
| 639 |
-
]
|
| 640 |
-
)
|
| 641 |
-
formant_shifting.change(
|
| 642 |
-
fn=lambda a: [
|
| 643 |
-
visible(a)
|
| 644 |
-
for _ in range(4)
|
| 645 |
-
],
|
| 646 |
-
inputs=[
|
| 647 |
-
formant_shifting
|
| 648 |
-
],
|
| 649 |
-
outputs=[
|
| 650 |
-
formant_qfrency,
|
| 651 |
-
formant_timbre,
|
| 652 |
-
formant_qfrency,
|
| 653 |
-
formant_timbre
|
| 654 |
-
]
|
| 655 |
-
)
|
| 656 |
-
embedders.change(
|
| 657 |
-
fn=lambda embedders: visible(embedders == "custom"),
|
| 658 |
-
inputs=[
|
| 659 |
-
embedders
|
| 660 |
-
],
|
| 661 |
-
outputs=[
|
| 662 |
-
custom_embedders
|
| 663 |
-
]
|
| 664 |
-
)
|
| 665 |
-
with gr.Row():
|
| 666 |
-
refresh_audio.click(
|
| 667 |
-
fn=change_audios_choices,
|
| 668 |
-
inputs=[
|
| 669 |
-
input_audio
|
| 670 |
-
],
|
| 671 |
-
outputs=[
|
| 672 |
-
input_audio
|
| 673 |
-
]
|
| 674 |
-
)
|
| 675 |
-
model_index_1.change(
|
| 676 |
-
fn=index_strength_show,
|
| 677 |
-
inputs=[
|
| 678 |
-
model_index_1
|
| 679 |
-
],
|
| 680 |
-
outputs=[
|
| 681 |
-
index_strength_1,
|
| 682 |
-
nprobe_1
|
| 683 |
-
]
|
| 684 |
-
)
|
| 685 |
-
model_index_2.change(
|
| 686 |
-
fn=index_strength_show,
|
| 687 |
-
inputs=[
|
| 688 |
-
model_index_2
|
| 689 |
-
],
|
| 690 |
-
outputs=[
|
| 691 |
-
index_strength_2,
|
| 692 |
-
nprobe_2
|
| 693 |
-
]
|
| 694 |
-
)
|
| 695 |
-
with gr.Row():
|
| 696 |
-
unlock_full_method.change(
|
| 697 |
-
fn=unlock_f0,
|
| 698 |
-
inputs=[
|
| 699 |
-
unlock_full_method
|
| 700 |
-
],
|
| 701 |
-
outputs=[
|
| 702 |
-
f0_method
|
| 703 |
-
]
|
| 704 |
-
)
|
| 705 |
-
embedder_mode.change(
|
| 706 |
-
fn=change_embedders_mode,
|
| 707 |
-
inputs=[
|
| 708 |
-
embedder_mode
|
| 709 |
-
],
|
| 710 |
-
outputs=[
|
| 711 |
-
embedders
|
| 712 |
-
]
|
| 713 |
-
)
|
| 714 |
-
proposal_pitch.change(
|
| 715 |
-
fn=visible,
|
| 716 |
-
inputs=[
|
| 717 |
-
proposal_pitch
|
| 718 |
-
],
|
| 719 |
-
outputs=[
|
| 720 |
-
proposal_pitch_threshold
|
| 721 |
-
]
|
| 722 |
-
)
|
| 723 |
-
with gr.Row():
|
| 724 |
-
model_pth_1.change(
|
| 725 |
-
fn=get_speakers_id_and_architecture,
|
| 726 |
-
inputs=[
|
| 727 |
-
model_pth_1
|
| 728 |
-
],
|
| 729 |
-
outputs=[
|
| 730 |
-
sids_1,
|
| 731 |
-
noise_scale_1
|
| 732 |
-
]
|
| 733 |
-
)
|
| 734 |
-
model_pth_2.change(
|
| 735 |
-
fn=get_speakers_id_and_architecture,
|
| 736 |
-
inputs=[
|
| 737 |
-
model_pth_2
|
| 738 |
-
],
|
| 739 |
-
outputs=[
|
| 740 |
-
sids_2,
|
| 741 |
-
noise_scale_2
|
| 742 |
-
]
|
| 743 |
-
)
|
| 744 |
-
embedders_mix.change(
|
| 745 |
-
fn=visible,
|
| 746 |
-
inputs=[
|
| 747 |
-
embedders_mix
|
| 748 |
-
],
|
| 749 |
-
outputs=[
|
| 750 |
-
embedders_mix_column
|
| 751 |
-
]
|
| 752 |
-
)
|
| 753 |
-
with gr.Row():
|
| 754 |
-
convert_button.click(
|
| 755 |
-
fn=convert_with_vad,
|
| 756 |
-
inputs=[
|
| 757 |
-
num_spk,
|
| 758 |
-
cleaner,
|
| 759 |
-
clean_strength,
|
| 760 |
-
autotune,
|
| 761 |
-
f0_autotune_strength,
|
| 762 |
-
checkpointing,
|
| 763 |
-
model_pth_1,
|
| 764 |
-
model_pth_2,
|
| 765 |
-
model_index_1,
|
| 766 |
-
model_index_2,
|
| 767 |
-
pitch_1,
|
| 768 |
-
pitch_2,
|
| 769 |
-
index_strength_1,
|
| 770 |
-
index_strength_2,
|
| 771 |
-
export_format,
|
| 772 |
-
input_audio,
|
| 773 |
-
output_audio,
|
| 774 |
-
predictor_onnx,
|
| 775 |
-
f0_method,
|
| 776 |
-
hybrid_f0method,
|
| 777 |
-
hop_length,
|
| 778 |
-
embedder_mode,
|
| 779 |
-
embedders,
|
| 780 |
-
custom_embedders,
|
| 781 |
-
resample_sr3,
|
| 782 |
-
filter_radius,
|
| 783 |
-
rms_mix_rate,
|
| 784 |
-
protect,
|
| 785 |
-
formant_shifting,
|
| 786 |
-
formant_qfrency,
|
| 787 |
-
formant_timbre,
|
| 788 |
-
formant_qfrency,
|
| 789 |
-
formant_timbre,
|
| 790 |
-
proposal_pitch,
|
| 791 |
-
proposal_pitch_threshold,
|
| 792 |
-
audio_processing,
|
| 793 |
-
alpha,
|
| 794 |
-
sids_1,
|
| 795 |
-
sids_2,
|
| 796 |
-
embedders_mix,
|
| 797 |
-
embedders_mix_layers,
|
| 798 |
-
embedders_mix_ratio,
|
| 799 |
-
noise_scale_1,
|
| 800 |
-
noise_scale_2,
|
| 801 |
-
vad_sensitivity,
|
| 802 |
-
vad_frame_ms,
|
| 803 |
-
nprobe_1,
|
| 804 |
-
nprobe_2
|
| 805 |
-
],
|
| 806 |
-
outputs=[
|
| 807 |
-
play_output_audio
|
| 808 |
-
],
|
| 809 |
-
api_name="convert_with_vad"
|
| 810 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/inference/child/separate.py
DELETED
|
@@ -1,600 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.downloads import download_url
|
| 9 |
-
from main.app.core.separate import separate_music
|
| 10 |
-
|
| 11 |
-
from main.app.core.ui import (
|
| 12 |
-
visible,
|
| 13 |
-
shutil_move,
|
| 14 |
-
separate_change,
|
| 15 |
-
change_audios_choices,
|
| 16 |
-
valueFalse_interactive
|
| 17 |
-
)
|
| 18 |
-
|
| 19 |
-
from main.app.variables import (
|
| 20 |
-
configs,
|
| 21 |
-
uvr_model,
|
| 22 |
-
vr_models,
|
| 23 |
-
mdx_models,
|
| 24 |
-
file_types,
|
| 25 |
-
audio_params,
|
| 26 |
-
translations,
|
| 27 |
-
reverb_models,
|
| 28 |
-
karaoke_models,
|
| 29 |
-
denoise_models,
|
| 30 |
-
paths_for_files,
|
| 31 |
-
sample_rate_choice,
|
| 32 |
-
export_format_choices
|
| 33 |
-
)
|
| 34 |
-
|
| 35 |
-
def separate_tab():
|
| 36 |
-
with gr.Row():
|
| 37 |
-
gr.Markdown(translations["4_part"])
|
| 38 |
-
with gr.Row():
|
| 39 |
-
with gr.Column():
|
| 40 |
-
with gr.Group():
|
| 41 |
-
with gr.Row():
|
| 42 |
-
enable_denoise = gr.Checkbox(
|
| 43 |
-
label=translations["denoise_mdx"],
|
| 44 |
-
value=False,
|
| 45 |
-
interactive=False
|
| 46 |
-
)
|
| 47 |
-
separate_backing = gr.Checkbox(
|
| 48 |
-
label=translations["separator_backing"],
|
| 49 |
-
value=False,
|
| 50 |
-
interactive=True
|
| 51 |
-
)
|
| 52 |
-
separate_reverb = gr.Checkbox(
|
| 53 |
-
label=translations["dereveb_audio"],
|
| 54 |
-
value=False,
|
| 55 |
-
interactive=True
|
| 56 |
-
)
|
| 57 |
-
enable_tta = gr.Checkbox(
|
| 58 |
-
label=translations["enable_tta"],
|
| 59 |
-
value=False,
|
| 60 |
-
interactive=False
|
| 61 |
-
)
|
| 62 |
-
high_end_process = gr.Checkbox(
|
| 63 |
-
label=translations["high_end_process"],
|
| 64 |
-
value=False,
|
| 65 |
-
interactive=False
|
| 66 |
-
)
|
| 67 |
-
enable_post_process = gr.Checkbox(
|
| 68 |
-
label=translations["enable_post_process"],
|
| 69 |
-
value=False,
|
| 70 |
-
interactive=False
|
| 71 |
-
)
|
| 72 |
-
with gr.Row():
|
| 73 |
-
model_name = gr.Dropdown(
|
| 74 |
-
label=translations["separator_model"],
|
| 75 |
-
value=uvr_model[0],
|
| 76 |
-
choices=uvr_model,
|
| 77 |
-
interactive=True
|
| 78 |
-
)
|
| 79 |
-
karaoke_model = gr.Dropdown(
|
| 80 |
-
label=translations["separator_backing_model"],
|
| 81 |
-
value=list(karaoke_models.keys())[0],
|
| 82 |
-
choices=list(karaoke_models.keys()),
|
| 83 |
-
interactive=True,
|
| 84 |
-
visible=False
|
| 85 |
-
)
|
| 86 |
-
reverb_model = gr.Dropdown(
|
| 87 |
-
label=translations["dereveb_model"],
|
| 88 |
-
value=list(reverb_models.keys())[0],
|
| 89 |
-
choices=list(reverb_models.keys()),
|
| 90 |
-
interactive=True,
|
| 91 |
-
visible=False
|
| 92 |
-
)
|
| 93 |
-
denoise_model = gr.Dropdown(
|
| 94 |
-
label=translations["denoise_model"],
|
| 95 |
-
value=list(denoise_models.keys())[0],
|
| 96 |
-
choices=list(denoise_models.keys()),
|
| 97 |
-
interactive=True,
|
| 98 |
-
visible=False
|
| 99 |
-
)
|
| 100 |
-
with gr.Row():
|
| 101 |
-
with gr.Column():
|
| 102 |
-
separate_button = gr.Button(
|
| 103 |
-
translations["separator_tab"],
|
| 104 |
-
variant="primary"
|
| 105 |
-
)
|
| 106 |
-
with gr.Row():
|
| 107 |
-
with gr.Column():
|
| 108 |
-
with gr.Group():
|
| 109 |
-
with gr.Row():
|
| 110 |
-
shifts = gr.Slider(
|
| 111 |
-
label=translations["shift"],
|
| 112 |
-
info=translations["shift_info"],
|
| 113 |
-
minimum=1,
|
| 114 |
-
maximum=20,
|
| 115 |
-
value=2,
|
| 116 |
-
step=1,
|
| 117 |
-
interactive=True
|
| 118 |
-
)
|
| 119 |
-
batch_size = gr.Slider(
|
| 120 |
-
label=translations["batch_size"],
|
| 121 |
-
info=translations["mdx_batch_size_info"],
|
| 122 |
-
minimum=1,
|
| 123 |
-
maximum=64,
|
| 124 |
-
value=1,
|
| 125 |
-
step=1,
|
| 126 |
-
interactive=True,
|
| 127 |
-
visible=False
|
| 128 |
-
)
|
| 129 |
-
with gr.Row():
|
| 130 |
-
segments_size = gr.Slider(
|
| 131 |
-
label=translations["segments_size"],
|
| 132 |
-
info=translations["segments_size_info"],
|
| 133 |
-
minimum=32,
|
| 134 |
-
maximum=3072,
|
| 135 |
-
value=256,
|
| 136 |
-
step=32,
|
| 137 |
-
interactive=True
|
| 138 |
-
)
|
| 139 |
-
aggression = gr.Slider(
|
| 140 |
-
label=translations['aggression'],
|
| 141 |
-
info=translations["aggression_info"],
|
| 142 |
-
minimum=1,
|
| 143 |
-
maximum=50,
|
| 144 |
-
value=5,
|
| 145 |
-
step=1,
|
| 146 |
-
interactive=True,
|
| 147 |
-
visible=False
|
| 148 |
-
)
|
| 149 |
-
drop_audio = gr.Files(
|
| 150 |
-
label=translations["drop_audio"],
|
| 151 |
-
file_types=file_types
|
| 152 |
-
)
|
| 153 |
-
with gr.Accordion(
|
| 154 |
-
translations["use_url"],
|
| 155 |
-
open=False
|
| 156 |
-
):
|
| 157 |
-
url = gr.Textbox(
|
| 158 |
-
label=translations["url_audio"],
|
| 159 |
-
value="",
|
| 160 |
-
placeholder="https://www.youtube.com/...",
|
| 161 |
-
scale=6
|
| 162 |
-
)
|
| 163 |
-
download_button = gr.Button(
|
| 164 |
-
translations["downloads"]
|
| 165 |
-
)
|
| 166 |
-
with gr.Column():
|
| 167 |
-
with gr.Group():
|
| 168 |
-
with gr.Row():
|
| 169 |
-
overlap = gr.Radio(
|
| 170 |
-
label=translations["overlap"],
|
| 171 |
-
info=translations["overlap_info"],
|
| 172 |
-
choices=[
|
| 173 |
-
"0.25",
|
| 174 |
-
"0.5",
|
| 175 |
-
"0.75",
|
| 176 |
-
"0.99"
|
| 177 |
-
],
|
| 178 |
-
value="0.25",
|
| 179 |
-
interactive=True
|
| 180 |
-
)
|
| 181 |
-
with gr.Row():
|
| 182 |
-
window_size = gr.Slider(
|
| 183 |
-
label=translations["window_size"],
|
| 184 |
-
info=translations["window_size_info"],
|
| 185 |
-
minimum=320,
|
| 186 |
-
maximum=1024,
|
| 187 |
-
value=512,
|
| 188 |
-
step=32,
|
| 189 |
-
interactive=True,
|
| 190 |
-
visible=False
|
| 191 |
-
)
|
| 192 |
-
hop_length = gr.Slider(
|
| 193 |
-
label=translations['hop_length'],
|
| 194 |
-
info=translations["hop_length_info"],
|
| 195 |
-
minimum=64,
|
| 196 |
-
maximum=8192,
|
| 197 |
-
value=1024,
|
| 198 |
-
step=1,
|
| 199 |
-
interactive=True,
|
| 200 |
-
visible=False
|
| 201 |
-
)
|
| 202 |
-
post_process_threshold = gr.Slider(
|
| 203 |
-
label=translations['post_process_threshold'],
|
| 204 |
-
info=translations["post_process_threshold_info"],
|
| 205 |
-
minimum=0.1,
|
| 206 |
-
maximum=0.3,
|
| 207 |
-
value=0.2,
|
| 208 |
-
step=0.1,
|
| 209 |
-
interactive=True,
|
| 210 |
-
visible=False
|
| 211 |
-
)
|
| 212 |
-
sample_rate = gr.Radio(
|
| 213 |
-
choices=sample_rate_choice,
|
| 214 |
-
value=44100,
|
| 215 |
-
label=translations["sr"],
|
| 216 |
-
info=translations["sr_info"],
|
| 217 |
-
interactive=True
|
| 218 |
-
)
|
| 219 |
-
with gr.Accordion(
|
| 220 |
-
translations["input_output"],
|
| 221 |
-
open=False
|
| 222 |
-
):
|
| 223 |
-
export_format = gr.Radio(
|
| 224 |
-
label=translations["export_format"],
|
| 225 |
-
info=translations["export_info"],
|
| 226 |
-
choices=export_format_choices,
|
| 227 |
-
value="wav",
|
| 228 |
-
interactive=True
|
| 229 |
-
)
|
| 230 |
-
input_audio = gr.Dropdown(
|
| 231 |
-
label=translations["audio_path"],
|
| 232 |
-
value="",
|
| 233 |
-
choices=paths_for_files,
|
| 234 |
-
allow_custom_value=True,
|
| 235 |
-
interactive=True
|
| 236 |
-
)
|
| 237 |
-
refresh_audio = gr.Button(
|
| 238 |
-
translations["refresh"]
|
| 239 |
-
)
|
| 240 |
-
output_dirs = gr.Textbox(
|
| 241 |
-
label=translations["output_folder"],
|
| 242 |
-
value="audios",
|
| 243 |
-
placeholder="audios",
|
| 244 |
-
info=translations["output_folder_info"],
|
| 245 |
-
interactive=True
|
| 246 |
-
)
|
| 247 |
-
audio_input = gr.Audio(
|
| 248 |
-
interactive=False,
|
| 249 |
-
label=translations["input_audio"],
|
| 250 |
-
**audio_params
|
| 251 |
-
)
|
| 252 |
-
with gr.Row():
|
| 253 |
-
gr.Markdown(translations["output_separator"])
|
| 254 |
-
with gr.Row():
|
| 255 |
-
instruments_audio = gr.Audio(
|
| 256 |
-
interactive=False,
|
| 257 |
-
label=translations["instruments"],
|
| 258 |
-
visible=True,
|
| 259 |
-
**audio_params
|
| 260 |
-
)
|
| 261 |
-
original_vocals = gr.Audio(
|
| 262 |
-
interactive=False,
|
| 263 |
-
label=translations["original_vocal"],
|
| 264 |
-
visible=True,
|
| 265 |
-
**audio_params
|
| 266 |
-
)
|
| 267 |
-
main_vocals = gr.Audio(
|
| 268 |
-
interactive=False,
|
| 269 |
-
label=translations["main_vocal"],
|
| 270 |
-
visible=False,
|
| 271 |
-
**audio_params
|
| 272 |
-
)
|
| 273 |
-
backing_vocals = gr.Audio(
|
| 274 |
-
interactive=False,
|
| 275 |
-
label=translations["backing_vocal"],
|
| 276 |
-
visible=False,
|
| 277 |
-
**audio_params
|
| 278 |
-
)
|
| 279 |
-
with gr.Row():
|
| 280 |
-
model_name.change(
|
| 281 |
-
fn=lambda a: valueFalse_interactive(a in list(mdx_models.keys()) + list(vr_models.keys())),
|
| 282 |
-
inputs=[
|
| 283 |
-
model_name
|
| 284 |
-
],
|
| 285 |
-
outputs=[
|
| 286 |
-
enable_denoise
|
| 287 |
-
]
|
| 288 |
-
)
|
| 289 |
-
separate_backing.change(
|
| 290 |
-
fn=lambda a, b: valueFalse_interactive(a or b),
|
| 291 |
-
inputs=[
|
| 292 |
-
separate_backing,
|
| 293 |
-
separate_reverb
|
| 294 |
-
],
|
| 295 |
-
outputs=[
|
| 296 |
-
enable_denoise
|
| 297 |
-
]
|
| 298 |
-
)
|
| 299 |
-
separate_reverb.change(
|
| 300 |
-
fn=lambda a, b: valueFalse_interactive(a or b),
|
| 301 |
-
inputs=[
|
| 302 |
-
separate_backing,
|
| 303 |
-
separate_reverb
|
| 304 |
-
],
|
| 305 |
-
outputs=[
|
| 306 |
-
enable_denoise
|
| 307 |
-
]
|
| 308 |
-
)
|
| 309 |
-
with gr.Row():
|
| 310 |
-
input_audio.change(
|
| 311 |
-
fn=lambda audio: audio if os.path.isfile(audio) else None,
|
| 312 |
-
inputs=[
|
| 313 |
-
input_audio
|
| 314 |
-
],
|
| 315 |
-
outputs=[
|
| 316 |
-
audio_input
|
| 317 |
-
]
|
| 318 |
-
)
|
| 319 |
-
drop_audio.upload(
|
| 320 |
-
fn=lambda audio_in: [
|
| 321 |
-
shutil_move(audio.name, configs["audios_path"])
|
| 322 |
-
for audio in audio_in
|
| 323 |
-
][0],
|
| 324 |
-
inputs=[
|
| 325 |
-
drop_audio
|
| 326 |
-
],
|
| 327 |
-
outputs=[
|
| 328 |
-
input_audio
|
| 329 |
-
]
|
| 330 |
-
)
|
| 331 |
-
refresh_audio.click(
|
| 332 |
-
fn=change_audios_choices,
|
| 333 |
-
inputs=[
|
| 334 |
-
input_audio
|
| 335 |
-
],
|
| 336 |
-
outputs=[
|
| 337 |
-
input_audio
|
| 338 |
-
]
|
| 339 |
-
)
|
| 340 |
-
with gr.Row():
|
| 341 |
-
separate_backing.change(
|
| 342 |
-
fn=lambda a: [
|
| 343 |
-
visible(a)
|
| 344 |
-
for _ in range(2)
|
| 345 |
-
],
|
| 346 |
-
inputs=[
|
| 347 |
-
separate_backing
|
| 348 |
-
],
|
| 349 |
-
outputs=[
|
| 350 |
-
main_vocals,
|
| 351 |
-
backing_vocals
|
| 352 |
-
]
|
| 353 |
-
)
|
| 354 |
-
download_button.click(
|
| 355 |
-
fn=download_url,
|
| 356 |
-
inputs=[
|
| 357 |
-
url
|
| 358 |
-
],
|
| 359 |
-
outputs=[
|
| 360 |
-
input_audio,
|
| 361 |
-
audio_input,
|
| 362 |
-
url
|
| 363 |
-
],
|
| 364 |
-
api_name='download_url'
|
| 365 |
-
)
|
| 366 |
-
with gr.Row():
|
| 367 |
-
model_name.change(
|
| 368 |
-
fn=separate_change,
|
| 369 |
-
inputs=[
|
| 370 |
-
model_name,
|
| 371 |
-
karaoke_model,
|
| 372 |
-
reverb_model,
|
| 373 |
-
enable_post_process,
|
| 374 |
-
separate_backing,
|
| 375 |
-
separate_reverb,
|
| 376 |
-
enable_denoise
|
| 377 |
-
],
|
| 378 |
-
outputs=[
|
| 379 |
-
karaoke_model,
|
| 380 |
-
reverb_model,
|
| 381 |
-
overlap,
|
| 382 |
-
segments_size,
|
| 383 |
-
hop_length,
|
| 384 |
-
batch_size,
|
| 385 |
-
shifts,
|
| 386 |
-
window_size,
|
| 387 |
-
aggression,
|
| 388 |
-
post_process_threshold,
|
| 389 |
-
denoise_model,
|
| 390 |
-
enable_tta,
|
| 391 |
-
high_end_process,
|
| 392 |
-
enable_post_process,
|
| 393 |
-
]
|
| 394 |
-
)
|
| 395 |
-
with gr.Row():
|
| 396 |
-
karaoke_model.change(
|
| 397 |
-
fn=separate_change,
|
| 398 |
-
inputs=[
|
| 399 |
-
model_name,
|
| 400 |
-
karaoke_model,
|
| 401 |
-
reverb_model,
|
| 402 |
-
enable_post_process,
|
| 403 |
-
separate_backing,
|
| 404 |
-
separate_reverb,
|
| 405 |
-
enable_denoise
|
| 406 |
-
],
|
| 407 |
-
outputs=[
|
| 408 |
-
karaoke_model,
|
| 409 |
-
reverb_model,
|
| 410 |
-
overlap,
|
| 411 |
-
segments_size,
|
| 412 |
-
hop_length,
|
| 413 |
-
batch_size,
|
| 414 |
-
shifts,
|
| 415 |
-
window_size,
|
| 416 |
-
aggression,
|
| 417 |
-
post_process_threshold,
|
| 418 |
-
denoise_model,
|
| 419 |
-
enable_tta,
|
| 420 |
-
high_end_process,
|
| 421 |
-
enable_post_process,
|
| 422 |
-
]
|
| 423 |
-
)
|
| 424 |
-
separate_backing.change(
|
| 425 |
-
fn=separate_change,
|
| 426 |
-
inputs=[
|
| 427 |
-
model_name,
|
| 428 |
-
karaoke_model,
|
| 429 |
-
reverb_model,
|
| 430 |
-
enable_post_process,
|
| 431 |
-
separate_backing,
|
| 432 |
-
separate_reverb,
|
| 433 |
-
enable_denoise
|
| 434 |
-
],
|
| 435 |
-
outputs=[
|
| 436 |
-
karaoke_model,
|
| 437 |
-
reverb_model,
|
| 438 |
-
overlap,
|
| 439 |
-
segments_size,
|
| 440 |
-
hop_length,
|
| 441 |
-
batch_size,
|
| 442 |
-
shifts,
|
| 443 |
-
window_size,
|
| 444 |
-
aggression,
|
| 445 |
-
post_process_threshold,
|
| 446 |
-
denoise_model,
|
| 447 |
-
enable_tta,
|
| 448 |
-
high_end_process,
|
| 449 |
-
enable_post_process,
|
| 450 |
-
]
|
| 451 |
-
)
|
| 452 |
-
with gr.Row():
|
| 453 |
-
reverb_model.change(
|
| 454 |
-
fn=separate_change,
|
| 455 |
-
inputs=[
|
| 456 |
-
model_name,
|
| 457 |
-
karaoke_model,
|
| 458 |
-
reverb_model,
|
| 459 |
-
enable_post_process,
|
| 460 |
-
separate_backing,
|
| 461 |
-
separate_reverb,
|
| 462 |
-
enable_denoise
|
| 463 |
-
],
|
| 464 |
-
outputs=[
|
| 465 |
-
karaoke_model,
|
| 466 |
-
reverb_model,
|
| 467 |
-
overlap,
|
| 468 |
-
segments_size,
|
| 469 |
-
hop_length,
|
| 470 |
-
batch_size,
|
| 471 |
-
shifts,
|
| 472 |
-
window_size,
|
| 473 |
-
aggression,
|
| 474 |
-
post_process_threshold,
|
| 475 |
-
denoise_model,
|
| 476 |
-
enable_tta,
|
| 477 |
-
high_end_process,
|
| 478 |
-
enable_post_process,
|
| 479 |
-
]
|
| 480 |
-
)
|
| 481 |
-
separate_reverb.change(
|
| 482 |
-
fn=separate_change,
|
| 483 |
-
inputs=[
|
| 484 |
-
model_name,
|
| 485 |
-
karaoke_model,
|
| 486 |
-
reverb_model,
|
| 487 |
-
enable_post_process,
|
| 488 |
-
separate_backing,
|
| 489 |
-
separate_reverb,
|
| 490 |
-
enable_denoise
|
| 491 |
-
],
|
| 492 |
-
outputs=[
|
| 493 |
-
karaoke_model,
|
| 494 |
-
reverb_model,
|
| 495 |
-
overlap,
|
| 496 |
-
segments_size,
|
| 497 |
-
hop_length,
|
| 498 |
-
batch_size,
|
| 499 |
-
shifts,
|
| 500 |
-
window_size,
|
| 501 |
-
aggression,
|
| 502 |
-
post_process_threshold,
|
| 503 |
-
denoise_model,
|
| 504 |
-
enable_tta,
|
| 505 |
-
high_end_process,
|
| 506 |
-
enable_post_process,
|
| 507 |
-
]
|
| 508 |
-
)
|
| 509 |
-
with gr.Row():
|
| 510 |
-
enable_denoise.change(
|
| 511 |
-
fn=separate_change,
|
| 512 |
-
inputs=[
|
| 513 |
-
model_name,
|
| 514 |
-
karaoke_model,
|
| 515 |
-
reverb_model,
|
| 516 |
-
enable_post_process,
|
| 517 |
-
separate_backing,
|
| 518 |
-
separate_reverb,
|
| 519 |
-
enable_denoise
|
| 520 |
-
],
|
| 521 |
-
outputs=[
|
| 522 |
-
karaoke_model,
|
| 523 |
-
reverb_model,
|
| 524 |
-
overlap,
|
| 525 |
-
segments_size,
|
| 526 |
-
hop_length,
|
| 527 |
-
batch_size,
|
| 528 |
-
shifts,
|
| 529 |
-
window_size,
|
| 530 |
-
aggression,
|
| 531 |
-
post_process_threshold,
|
| 532 |
-
denoise_model,
|
| 533 |
-
enable_tta,
|
| 534 |
-
high_end_process,
|
| 535 |
-
enable_post_process,
|
| 536 |
-
]
|
| 537 |
-
)
|
| 538 |
-
enable_post_process.change(
|
| 539 |
-
fn=separate_change,
|
| 540 |
-
inputs=[
|
| 541 |
-
model_name,
|
| 542 |
-
karaoke_model,
|
| 543 |
-
reverb_model,
|
| 544 |
-
enable_post_process,
|
| 545 |
-
separate_backing,
|
| 546 |
-
separate_reverb,
|
| 547 |
-
enable_denoise
|
| 548 |
-
],
|
| 549 |
-
outputs=[
|
| 550 |
-
karaoke_model,
|
| 551 |
-
reverb_model,
|
| 552 |
-
overlap,
|
| 553 |
-
segments_size,
|
| 554 |
-
hop_length,
|
| 555 |
-
batch_size,
|
| 556 |
-
shifts,
|
| 557 |
-
window_size,
|
| 558 |
-
aggression,
|
| 559 |
-
post_process_threshold,
|
| 560 |
-
denoise_model,
|
| 561 |
-
enable_tta,
|
| 562 |
-
high_end_process,
|
| 563 |
-
enable_post_process,
|
| 564 |
-
]
|
| 565 |
-
)
|
| 566 |
-
with gr.Row():
|
| 567 |
-
separate_button.click(
|
| 568 |
-
fn=separate_music,
|
| 569 |
-
inputs=[
|
| 570 |
-
input_audio,
|
| 571 |
-
output_dirs,
|
| 572 |
-
export_format,
|
| 573 |
-
model_name,
|
| 574 |
-
karaoke_model,
|
| 575 |
-
reverb_model,
|
| 576 |
-
denoise_model,
|
| 577 |
-
sample_rate,
|
| 578 |
-
shifts,
|
| 579 |
-
batch_size,
|
| 580 |
-
overlap,
|
| 581 |
-
aggression,
|
| 582 |
-
hop_length,
|
| 583 |
-
window_size,
|
| 584 |
-
segments_size,
|
| 585 |
-
post_process_threshold,
|
| 586 |
-
enable_tta,
|
| 587 |
-
enable_denoise,
|
| 588 |
-
high_end_process,
|
| 589 |
-
enable_post_process,
|
| 590 |
-
separate_backing,
|
| 591 |
-
separate_reverb
|
| 592 |
-
],
|
| 593 |
-
outputs=[
|
| 594 |
-
original_vocals,
|
| 595 |
-
instruments_audio,
|
| 596 |
-
main_vocals,
|
| 597 |
-
backing_vocals
|
| 598 |
-
],
|
| 599 |
-
api_name="separate_music"
|
| 600 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/inference/inference.py
DELETED
|
@@ -1,41 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.variables import (
|
| 9 |
-
configs,
|
| 10 |
-
translations
|
| 11 |
-
)
|
| 12 |
-
|
| 13 |
-
def inference_tab():
|
| 14 |
-
with gr.TabItem(translations["inference"]):
|
| 15 |
-
if configs.get("separator_tab", True):
|
| 16 |
-
from main.app.tabs.inference.child.separate import separate_tab
|
| 17 |
-
|
| 18 |
-
with gr.TabItem(translations["separator_tab"]):
|
| 19 |
-
gr.Markdown(f"## {translations['separator_tab']}")
|
| 20 |
-
separate_tab()
|
| 21 |
-
|
| 22 |
-
if configs.get("convert_tab", True):
|
| 23 |
-
from main.app.tabs.inference.child.convert import convert_tab
|
| 24 |
-
|
| 25 |
-
with gr.TabItem(translations["convert_audio"]):
|
| 26 |
-
gr.Markdown(f"## {translations['convert_audio']}")
|
| 27 |
-
convert_tab()
|
| 28 |
-
|
| 29 |
-
if configs.get("convert_with_vad_tab", True):
|
| 30 |
-
from main.app.tabs.inference.child.convert_with_vad import convert_with_vad_tab
|
| 31 |
-
|
| 32 |
-
with gr.TabItem(translations["convert_with_vad"]):
|
| 33 |
-
gr.Markdown(f"## {translations['convert_with_vad']}")
|
| 34 |
-
convert_with_vad_tab()
|
| 35 |
-
|
| 36 |
-
if configs.get("tts_tab", True):
|
| 37 |
-
from main.app.tabs.inference.child.convert_tts import convert_tts_tab
|
| 38 |
-
|
| 39 |
-
with gr.TabItem(translations["convert_text"]):
|
| 40 |
-
gr.Markdown(translations["convert_text_markdown"])
|
| 41 |
-
convert_tts_tab()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/realtime/realtime.py
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
main/app/tabs/training/child/create_dataset.py
DELETED
|
@@ -1,519 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.training import create_dataset
|
| 9 |
-
|
| 10 |
-
from main.app.core.ui import (
|
| 11 |
-
visible,
|
| 12 |
-
create_dataset_change,
|
| 13 |
-
valueFalse_interactive
|
| 14 |
-
)
|
| 15 |
-
from main.app.variables import (
|
| 16 |
-
vr_models,
|
| 17 |
-
uvr_model,
|
| 18 |
-
mdx_models,
|
| 19 |
-
translations,
|
| 20 |
-
reverb_models,
|
| 21 |
-
denoise_models,
|
| 22 |
-
sample_rate_choice
|
| 23 |
-
)
|
| 24 |
-
|
| 25 |
-
def create_dataset_tab():
|
| 26 |
-
with gr.Row():
|
| 27 |
-
gr.Markdown(translations["create_dataset_markdown_2"])
|
| 28 |
-
with gr.Group():
|
| 29 |
-
with gr.Row():
|
| 30 |
-
separate = gr.Checkbox(
|
| 31 |
-
label=translations["separator_tab"],
|
| 32 |
-
value=False,
|
| 33 |
-
interactive=True
|
| 34 |
-
)
|
| 35 |
-
clean_dataset = gr.Checkbox(
|
| 36 |
-
label=translations["clear_audio"],
|
| 37 |
-
value=False,
|
| 38 |
-
interactive=True
|
| 39 |
-
)
|
| 40 |
-
skip_seconds = gr.Checkbox(
|
| 41 |
-
label=translations["skip"],
|
| 42 |
-
value=False,
|
| 43 |
-
interactive=True
|
| 44 |
-
)
|
| 45 |
-
separate_reverb = gr.Checkbox(
|
| 46 |
-
label=translations["dereveb_audio"],
|
| 47 |
-
value=False,
|
| 48 |
-
interactive=False
|
| 49 |
-
)
|
| 50 |
-
with gr.Row(visible=False) as row:
|
| 51 |
-
enable_tta = gr.Checkbox(
|
| 52 |
-
label=translations["enable_tta"],
|
| 53 |
-
value=False,
|
| 54 |
-
interactive=False
|
| 55 |
-
)
|
| 56 |
-
high_end_process = gr.Checkbox(
|
| 57 |
-
label=translations["high_end_process"],
|
| 58 |
-
value=False,
|
| 59 |
-
interactive=False
|
| 60 |
-
)
|
| 61 |
-
enable_post_process = gr.Checkbox(
|
| 62 |
-
label=translations["enable_post_process"],
|
| 63 |
-
value=False,
|
| 64 |
-
interactive=False
|
| 65 |
-
)
|
| 66 |
-
enable_denoise = gr.Checkbox(
|
| 67 |
-
label=translations["denoise_mdx"],
|
| 68 |
-
value=False,
|
| 69 |
-
interactive=False
|
| 70 |
-
)
|
| 71 |
-
with gr.Row():
|
| 72 |
-
dataset_url = gr.Textbox(
|
| 73 |
-
label=translations["url_audio"],
|
| 74 |
-
info=translations["create_dataset_url"],
|
| 75 |
-
value="",
|
| 76 |
-
placeholder="https://www.youtube.com/...",
|
| 77 |
-
interactive=True,
|
| 78 |
-
scale=5
|
| 79 |
-
)
|
| 80 |
-
output_dataset = gr.Textbox(
|
| 81 |
-
label=translations["output_data"],
|
| 82 |
-
info=translations["output_data_info"],
|
| 83 |
-
value="dataset",
|
| 84 |
-
placeholder="dataset",
|
| 85 |
-
interactive=True
|
| 86 |
-
)
|
| 87 |
-
with gr.Row():
|
| 88 |
-
create_dataset_button = gr.Button(
|
| 89 |
-
translations["createdataset"],
|
| 90 |
-
variant="primary",
|
| 91 |
-
scale=2,
|
| 92 |
-
min_width=4000
|
| 93 |
-
)
|
| 94 |
-
with gr.Row(visible=False) as row_2:
|
| 95 |
-
model_name = gr.Dropdown(
|
| 96 |
-
label=translations["separator_model"],
|
| 97 |
-
value=uvr_model[0],
|
| 98 |
-
choices=uvr_model,
|
| 99 |
-
interactive=True
|
| 100 |
-
)
|
| 101 |
-
reverb_model = gr.Dropdown(
|
| 102 |
-
label=translations["dereveb_model"],
|
| 103 |
-
value=list(reverb_models.keys())[0],
|
| 104 |
-
choices=list(reverb_models.keys()),
|
| 105 |
-
interactive=True
|
| 106 |
-
)
|
| 107 |
-
denoise_model = gr.Dropdown(
|
| 108 |
-
label=translations["denoise_model"],
|
| 109 |
-
value=list(denoise_models.keys())[0],
|
| 110 |
-
choices=list(denoise_models.keys()),
|
| 111 |
-
interactive=True,
|
| 112 |
-
visible=False
|
| 113 |
-
)
|
| 114 |
-
with gr.Row():
|
| 115 |
-
with gr.Column(visible=False) as row_3:
|
| 116 |
-
with gr.Group():
|
| 117 |
-
with gr.Row():
|
| 118 |
-
overlap = gr.Radio(
|
| 119 |
-
label=translations["overlap"],
|
| 120 |
-
info=translations["overlap_info"],
|
| 121 |
-
choices=[
|
| 122 |
-
"0.25",
|
| 123 |
-
"0.5",
|
| 124 |
-
"0.75",
|
| 125 |
-
"0.99"
|
| 126 |
-
],
|
| 127 |
-
value="0.25",
|
| 128 |
-
interactive=True)
|
| 129 |
-
with gr.Row():
|
| 130 |
-
window_size = gr.Slider(
|
| 131 |
-
label=translations["window_size"],
|
| 132 |
-
info=translations["window_size_info"],
|
| 133 |
-
minimum=320,
|
| 134 |
-
maximum=1024,
|
| 135 |
-
value=512,
|
| 136 |
-
step=32,
|
| 137 |
-
interactive=True,
|
| 138 |
-
visible=False
|
| 139 |
-
)
|
| 140 |
-
with gr.Row():
|
| 141 |
-
shifts = gr.Slider(
|
| 142 |
-
label=translations["shift"],
|
| 143 |
-
info=translations["shift_info"],
|
| 144 |
-
minimum=1,
|
| 145 |
-
maximum=20,
|
| 146 |
-
value=2,
|
| 147 |
-
step=1,
|
| 148 |
-
interactive=True
|
| 149 |
-
)
|
| 150 |
-
segments_size = gr.Slider(
|
| 151 |
-
label=translations["segments_size"],
|
| 152 |
-
info=translations["segments_size_info"],
|
| 153 |
-
minimum=32,
|
| 154 |
-
maximum=3072,
|
| 155 |
-
value=256,
|
| 156 |
-
step=32,
|
| 157 |
-
interactive=True
|
| 158 |
-
)
|
| 159 |
-
with gr.Row():
|
| 160 |
-
batch_size = gr.Slider(
|
| 161 |
-
label=translations["batch_size"],
|
| 162 |
-
info=translations["mdx_batch_size_info"],
|
| 163 |
-
minimum=1,
|
| 164 |
-
maximum=64,
|
| 165 |
-
value=1,
|
| 166 |
-
step=1,
|
| 167 |
-
interactive=True,
|
| 168 |
-
visible=False
|
| 169 |
-
)
|
| 170 |
-
hop_length = gr.Slider(
|
| 171 |
-
label=translations['hop_length'],
|
| 172 |
-
info=translations["hop_length_info"],
|
| 173 |
-
minimum=64,
|
| 174 |
-
maximum=8192,
|
| 175 |
-
value=1024,
|
| 176 |
-
step=1,
|
| 177 |
-
interactive=True,
|
| 178 |
-
visible=False
|
| 179 |
-
)
|
| 180 |
-
with gr.Row():
|
| 181 |
-
post_process_threshold = gr.Slider(
|
| 182 |
-
label=translations['post_process_threshold'],
|
| 183 |
-
info=translations["post_process_threshold_info"],
|
| 184 |
-
minimum=0.1,
|
| 185 |
-
maximum=0.3,
|
| 186 |
-
value=0.2,
|
| 187 |
-
step=0.1,
|
| 188 |
-
interactive=True,
|
| 189 |
-
visible=False
|
| 190 |
-
)
|
| 191 |
-
aggression = gr.Slider(
|
| 192 |
-
label=translations['aggression'],
|
| 193 |
-
info=translations["aggression_info"],
|
| 194 |
-
minimum=1,
|
| 195 |
-
maximum=50,
|
| 196 |
-
value=5,
|
| 197 |
-
step=1,
|
| 198 |
-
interactive=True,
|
| 199 |
-
visible=False
|
| 200 |
-
)
|
| 201 |
-
with gr.Column():
|
| 202 |
-
sample_rate = gr.Radio(
|
| 203 |
-
choices=sample_rate_choice,
|
| 204 |
-
value=48000,
|
| 205 |
-
label=translations["sr"],
|
| 206 |
-
info=translations["sr_info"],
|
| 207 |
-
interactive=True
|
| 208 |
-
)
|
| 209 |
-
clean_strength = gr.Slider(
|
| 210 |
-
minimum=0,
|
| 211 |
-
maximum=1,
|
| 212 |
-
step=0.1,
|
| 213 |
-
value=0.5,
|
| 214 |
-
label=translations["clean_strength"],
|
| 215 |
-
info=translations["clean_strength_info"],
|
| 216 |
-
interactive=True,
|
| 217 |
-
visible=False
|
| 218 |
-
)
|
| 219 |
-
with gr.Row():
|
| 220 |
-
skip_start = gr.Textbox(
|
| 221 |
-
label=translations["skip_start"],
|
| 222 |
-
info=translations["skip_start_info"],
|
| 223 |
-
value="",
|
| 224 |
-
placeholder="0,...",
|
| 225 |
-
interactive=True,
|
| 226 |
-
visible=False
|
| 227 |
-
)
|
| 228 |
-
skip_end = gr.Textbox(
|
| 229 |
-
label=translations["skip_end"],
|
| 230 |
-
info=translations["skip_end_info"],
|
| 231 |
-
value="",
|
| 232 |
-
placeholder="0,...",
|
| 233 |
-
interactive=True,
|
| 234 |
-
visible=False
|
| 235 |
-
)
|
| 236 |
-
create_dataset_info = gr.Textbox(
|
| 237 |
-
label=translations["create_dataset_info"],
|
| 238 |
-
value="",
|
| 239 |
-
interactive=False,
|
| 240 |
-
lines=2
|
| 241 |
-
)
|
| 242 |
-
with gr.Row():
|
| 243 |
-
separate.change(
|
| 244 |
-
fn=lambda a: [
|
| 245 |
-
visible(a)
|
| 246 |
-
for _ in range(3)
|
| 247 |
-
],
|
| 248 |
-
inputs=[
|
| 249 |
-
separate
|
| 250 |
-
],
|
| 251 |
-
outputs=[
|
| 252 |
-
row,
|
| 253 |
-
row_2,
|
| 254 |
-
row_3
|
| 255 |
-
]
|
| 256 |
-
)
|
| 257 |
-
separate.change(
|
| 258 |
-
fn=valueFalse_interactive,
|
| 259 |
-
inputs=[
|
| 260 |
-
separate
|
| 261 |
-
],
|
| 262 |
-
outputs=[
|
| 263 |
-
separate_reverb
|
| 264 |
-
]
|
| 265 |
-
)
|
| 266 |
-
separate.change(
|
| 267 |
-
fn=create_dataset_change,
|
| 268 |
-
inputs=[
|
| 269 |
-
model_name,
|
| 270 |
-
reverb_model,
|
| 271 |
-
enable_post_process,
|
| 272 |
-
separate_reverb,
|
| 273 |
-
enable_denoise
|
| 274 |
-
],
|
| 275 |
-
outputs=[
|
| 276 |
-
reverb_model,
|
| 277 |
-
overlap,
|
| 278 |
-
segments_size,
|
| 279 |
-
hop_length,
|
| 280 |
-
batch_size,
|
| 281 |
-
shifts,
|
| 282 |
-
window_size,
|
| 283 |
-
aggression,
|
| 284 |
-
post_process_threshold,
|
| 285 |
-
denoise_model,
|
| 286 |
-
enable_tta,
|
| 287 |
-
high_end_process,
|
| 288 |
-
enable_post_process,
|
| 289 |
-
]
|
| 290 |
-
)
|
| 291 |
-
with gr.Row():
|
| 292 |
-
model_name.change(
|
| 293 |
-
fn=create_dataset_change,
|
| 294 |
-
inputs=[
|
| 295 |
-
model_name,
|
| 296 |
-
reverb_model,
|
| 297 |
-
enable_post_process,
|
| 298 |
-
separate_reverb,
|
| 299 |
-
enable_denoise
|
| 300 |
-
],
|
| 301 |
-
outputs=[
|
| 302 |
-
reverb_model,
|
| 303 |
-
overlap,
|
| 304 |
-
segments_size,
|
| 305 |
-
hop_length,
|
| 306 |
-
batch_size,
|
| 307 |
-
shifts,
|
| 308 |
-
window_size,
|
| 309 |
-
aggression,
|
| 310 |
-
post_process_threshold,
|
| 311 |
-
denoise_model,
|
| 312 |
-
enable_tta,
|
| 313 |
-
high_end_process,
|
| 314 |
-
enable_post_process,
|
| 315 |
-
]
|
| 316 |
-
)
|
| 317 |
-
reverb_model.change(
|
| 318 |
-
fn=create_dataset_change,
|
| 319 |
-
inputs=[
|
| 320 |
-
model_name,
|
| 321 |
-
reverb_model,
|
| 322 |
-
enable_post_process,
|
| 323 |
-
separate_reverb,
|
| 324 |
-
enable_denoise
|
| 325 |
-
],
|
| 326 |
-
outputs=[
|
| 327 |
-
reverb_model,
|
| 328 |
-
overlap,
|
| 329 |
-
segments_size,
|
| 330 |
-
hop_length,
|
| 331 |
-
batch_size,
|
| 332 |
-
shifts,
|
| 333 |
-
window_size,
|
| 334 |
-
aggression,
|
| 335 |
-
post_process_threshold,
|
| 336 |
-
denoise_model,
|
| 337 |
-
enable_tta,
|
| 338 |
-
high_end_process,
|
| 339 |
-
enable_post_process,
|
| 340 |
-
]
|
| 341 |
-
)
|
| 342 |
-
denoise_model.change(
|
| 343 |
-
fn=create_dataset_change,
|
| 344 |
-
inputs=[
|
| 345 |
-
model_name,
|
| 346 |
-
reverb_model,
|
| 347 |
-
enable_post_process,
|
| 348 |
-
separate_reverb,
|
| 349 |
-
enable_denoise
|
| 350 |
-
],
|
| 351 |
-
outputs=[
|
| 352 |
-
reverb_model,
|
| 353 |
-
overlap,
|
| 354 |
-
segments_size,
|
| 355 |
-
hop_length,
|
| 356 |
-
batch_size,
|
| 357 |
-
shifts,
|
| 358 |
-
window_size,
|
| 359 |
-
aggression,
|
| 360 |
-
post_process_threshold,
|
| 361 |
-
denoise_model,
|
| 362 |
-
enable_tta,
|
| 363 |
-
high_end_process,
|
| 364 |
-
enable_post_process,
|
| 365 |
-
]
|
| 366 |
-
)
|
| 367 |
-
with gr.Row():
|
| 368 |
-
separate_reverb.change(
|
| 369 |
-
fn=create_dataset_change,
|
| 370 |
-
inputs=[
|
| 371 |
-
model_name,
|
| 372 |
-
reverb_model,
|
| 373 |
-
enable_post_process,
|
| 374 |
-
separate_reverb,
|
| 375 |
-
enable_denoise
|
| 376 |
-
],
|
| 377 |
-
outputs=[
|
| 378 |
-
reverb_model,
|
| 379 |
-
overlap,
|
| 380 |
-
segments_size,
|
| 381 |
-
hop_length,
|
| 382 |
-
batch_size,
|
| 383 |
-
shifts,
|
| 384 |
-
window_size,
|
| 385 |
-
aggression,
|
| 386 |
-
post_process_threshold,
|
| 387 |
-
denoise_model,
|
| 388 |
-
enable_tta,
|
| 389 |
-
high_end_process,
|
| 390 |
-
enable_post_process,
|
| 391 |
-
]
|
| 392 |
-
)
|
| 393 |
-
enable_denoise.change(
|
| 394 |
-
fn=create_dataset_change,
|
| 395 |
-
inputs=[
|
| 396 |
-
model_name,
|
| 397 |
-
reverb_model,
|
| 398 |
-
enable_post_process,
|
| 399 |
-
separate_reverb,
|
| 400 |
-
enable_denoise
|
| 401 |
-
],
|
| 402 |
-
outputs=[
|
| 403 |
-
reverb_model,
|
| 404 |
-
overlap,
|
| 405 |
-
segments_size,
|
| 406 |
-
hop_length,
|
| 407 |
-
batch_size,
|
| 408 |
-
shifts,
|
| 409 |
-
window_size,
|
| 410 |
-
aggression,
|
| 411 |
-
post_process_threshold,
|
| 412 |
-
denoise_model,
|
| 413 |
-
enable_tta,
|
| 414 |
-
high_end_process,
|
| 415 |
-
enable_post_process,
|
| 416 |
-
]
|
| 417 |
-
)
|
| 418 |
-
enable_post_process.change(
|
| 419 |
-
fn=create_dataset_change,
|
| 420 |
-
inputs=[
|
| 421 |
-
model_name,
|
| 422 |
-
reverb_model,
|
| 423 |
-
enable_post_process,
|
| 424 |
-
separate_reverb,
|
| 425 |
-
enable_denoise
|
| 426 |
-
],
|
| 427 |
-
outputs=[
|
| 428 |
-
reverb_model,
|
| 429 |
-
overlap,
|
| 430 |
-
segments_size,
|
| 431 |
-
hop_length,
|
| 432 |
-
batch_size,
|
| 433 |
-
shifts,
|
| 434 |
-
window_size,
|
| 435 |
-
aggression,
|
| 436 |
-
post_process_threshold,
|
| 437 |
-
denoise_model,
|
| 438 |
-
enable_tta,
|
| 439 |
-
high_end_process,
|
| 440 |
-
enable_post_process,
|
| 441 |
-
]
|
| 442 |
-
)
|
| 443 |
-
with gr.Row():
|
| 444 |
-
skip_seconds.change(
|
| 445 |
-
fn=lambda a: [
|
| 446 |
-
visible(a)
|
| 447 |
-
for _ in range(2)
|
| 448 |
-
],
|
| 449 |
-
inputs=[
|
| 450 |
-
skip_seconds
|
| 451 |
-
],
|
| 452 |
-
outputs=[
|
| 453 |
-
skip_start,
|
| 454 |
-
skip_end
|
| 455 |
-
]
|
| 456 |
-
)
|
| 457 |
-
clean_dataset.change(
|
| 458 |
-
fn=visible,
|
| 459 |
-
inputs=[
|
| 460 |
-
clean_dataset
|
| 461 |
-
],
|
| 462 |
-
outputs=[
|
| 463 |
-
clean_strength
|
| 464 |
-
]
|
| 465 |
-
)
|
| 466 |
-
with gr.Row():
|
| 467 |
-
model_name.change(
|
| 468 |
-
fn=lambda a: valueFalse_interactive(a in list(mdx_models.keys()) + list(vr_models.keys())),
|
| 469 |
-
inputs=[
|
| 470 |
-
model_name
|
| 471 |
-
],
|
| 472 |
-
outputs=[
|
| 473 |
-
enable_denoise
|
| 474 |
-
]
|
| 475 |
-
)
|
| 476 |
-
separate_reverb.change(
|
| 477 |
-
fn=valueFalse_interactive,
|
| 478 |
-
inputs=[
|
| 479 |
-
separate_reverb
|
| 480 |
-
],
|
| 481 |
-
outputs=[
|
| 482 |
-
enable_denoise
|
| 483 |
-
]
|
| 484 |
-
)
|
| 485 |
-
with gr.Row():
|
| 486 |
-
create_dataset_button.click(
|
| 487 |
-
fn=create_dataset,
|
| 488 |
-
inputs=[
|
| 489 |
-
dataset_url,
|
| 490 |
-
output_dataset,
|
| 491 |
-
skip_seconds,
|
| 492 |
-
skip_start,
|
| 493 |
-
skip_end,
|
| 494 |
-
separate,
|
| 495 |
-
model_name,
|
| 496 |
-
reverb_model,
|
| 497 |
-
denoise_model,
|
| 498 |
-
sample_rate,
|
| 499 |
-
shifts,
|
| 500 |
-
batch_size,
|
| 501 |
-
overlap,
|
| 502 |
-
aggression,
|
| 503 |
-
hop_length,
|
| 504 |
-
window_size,
|
| 505 |
-
segments_size,
|
| 506 |
-
post_process_threshold,
|
| 507 |
-
enable_tta,
|
| 508 |
-
enable_denoise,
|
| 509 |
-
high_end_process,
|
| 510 |
-
enable_post_process,
|
| 511 |
-
separate_reverb,
|
| 512 |
-
clean_dataset,
|
| 513 |
-
clean_strength
|
| 514 |
-
],
|
| 515 |
-
outputs=[
|
| 516 |
-
create_dataset_info
|
| 517 |
-
],
|
| 518 |
-
api_name="create_dataset"
|
| 519 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/tabs/training/child/create_reference.py
DELETED
|
@@ -1,390 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
|
| 4 |
-
import gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.training import create_reference
|
| 9 |
-
|
| 10 |
-
from main.app.core.ui import (
|
| 11 |
-
visible,
|
| 12 |
-
unlock_f0,
|
| 13 |
-
shutil_move,
|
| 14 |
-
change_audios_choices,
|
| 15 |
-
change_embedders_mode
|
| 16 |
-
)
|
| 17 |
-
|
| 18 |
-
from main.app.variables import (
|
| 19 |
-
configs,
|
| 20 |
-
method_f0,
|
| 21 |
-
file_types,
|
| 22 |
-
audio_params,
|
| 23 |
-
translations,
|
| 24 |
-
embedders_mode,
|
| 25 |
-
paths_for_files,
|
| 26 |
-
embedders_model,
|
| 27 |
-
hybrid_f0_method,
|
| 28 |
-
)
|
| 29 |
-
|
| 30 |
-
def create_reference_tab():
|
| 31 |
-
with gr.Row():
|
| 32 |
-
gr.Markdown(translations["create_reference_markdown_2"])
|
| 33 |
-
with gr.Row():
|
| 34 |
-
pitch_guidance = gr.Checkbox(
|
| 35 |
-
label=translations["training_pitch"],
|
| 36 |
-
value=True,
|
| 37 |
-
interactive=True
|
| 38 |
-
)
|
| 39 |
-
use_energy = gr.Checkbox(
|
| 40 |
-
label=translations["train&energy"],
|
| 41 |
-
value=False,
|
| 42 |
-
interactive=True
|
| 43 |
-
)
|
| 44 |
-
f0_autotune = gr.Checkbox(
|
| 45 |
-
label=translations["autotune"],
|
| 46 |
-
value=False,
|
| 47 |
-
interactive=True
|
| 48 |
-
)
|
| 49 |
-
proposal_pitch = gr.Checkbox(
|
| 50 |
-
label=translations["proposal_pitch"],
|
| 51 |
-
value=False,
|
| 52 |
-
interactive=True
|
| 53 |
-
)
|
| 54 |
-
with gr.Row():
|
| 55 |
-
create_reference_button = gr.Button(
|
| 56 |
-
translations["create_reference"],
|
| 57 |
-
variant="primary"
|
| 58 |
-
)
|
| 59 |
-
with gr.Row():
|
| 60 |
-
f0_up_key = gr.Slider(
|
| 61 |
-
minimum=-24,
|
| 62 |
-
maximum=24,
|
| 63 |
-
step=1,
|
| 64 |
-
info=translations["pitch_info"],
|
| 65 |
-
label=translations["pitch"],
|
| 66 |
-
value=0,
|
| 67 |
-
interactive=True
|
| 68 |
-
)
|
| 69 |
-
proposal_pitch_threshold = gr.Slider(
|
| 70 |
-
minimum=50.0,
|
| 71 |
-
maximum=1200.0,
|
| 72 |
-
label=translations["proposal_pitch_threshold"],
|
| 73 |
-
info=translations["proposal_pitch_threshold_info"],
|
| 74 |
-
value=255.0,
|
| 75 |
-
step=0.1,
|
| 76 |
-
interactive=True,
|
| 77 |
-
visible=False
|
| 78 |
-
)
|
| 79 |
-
with gr.Row():
|
| 80 |
-
filter_radius = gr.Slider(
|
| 81 |
-
minimum=0,
|
| 82 |
-
maximum=7,
|
| 83 |
-
label=translations["filter_radius"],
|
| 84 |
-
info=translations["filter_radius_info"],
|
| 85 |
-
value=3,
|
| 86 |
-
step=1,
|
| 87 |
-
interactive=True
|
| 88 |
-
)
|
| 89 |
-
f0_autotune_strength = gr.Slider(
|
| 90 |
-
minimum=0,
|
| 91 |
-
maximum=1,
|
| 92 |
-
label=translations["autotune_rate"],
|
| 93 |
-
info=translations["autotune_rate_info"],
|
| 94 |
-
value=1,
|
| 95 |
-
step=0.1,
|
| 96 |
-
interactive=True,
|
| 97 |
-
visible=False
|
| 98 |
-
)
|
| 99 |
-
with gr.Row():
|
| 100 |
-
with gr.Column():
|
| 101 |
-
with gr.Accordion(
|
| 102 |
-
translations["input_output"],
|
| 103 |
-
open=False
|
| 104 |
-
):
|
| 105 |
-
with gr.Column():
|
| 106 |
-
input_audio = gr.Dropdown(
|
| 107 |
-
label=translations["audio_path"],
|
| 108 |
-
value="",
|
| 109 |
-
choices=paths_for_files,
|
| 110 |
-
info=translations["provide_audio"],
|
| 111 |
-
allow_custom_value=True,
|
| 112 |
-
interactive=True
|
| 113 |
-
)
|
| 114 |
-
reference_name = gr.Textbox(
|
| 115 |
-
label=translations["reference_name"],
|
| 116 |
-
value="reference",
|
| 117 |
-
placeholder="reference",
|
| 118 |
-
info=translations["reference_name_info"],
|
| 119 |
-
interactive=True
|
| 120 |
-
)
|
| 121 |
-
with gr.Column():
|
| 122 |
-
refresh_audio = gr.Button(
|
| 123 |
-
translations["refresh"]
|
| 124 |
-
)
|
| 125 |
-
with gr.Column():
|
| 126 |
-
upload_audio = gr.Files(
|
| 127 |
-
label=translations["drop_audio"],
|
| 128 |
-
file_types=file_types
|
| 129 |
-
)
|
| 130 |
-
with gr.Column():
|
| 131 |
-
play_audio = gr.Audio(
|
| 132 |
-
interactive=False,
|
| 133 |
-
label=translations["input_audio"],
|
| 134 |
-
**audio_params
|
| 135 |
-
)
|
| 136 |
-
with gr.Column() as f0_method_column:
|
| 137 |
-
with gr.Accordion(
|
| 138 |
-
label=translations["f0_method"],
|
| 139 |
-
open=False
|
| 140 |
-
):
|
| 141 |
-
with gr.Group():
|
| 142 |
-
with gr.Row():
|
| 143 |
-
predictor_onnx = gr.Checkbox(
|
| 144 |
-
label=translations["predictor_onnx"],
|
| 145 |
-
value=False,
|
| 146 |
-
interactive=True
|
| 147 |
-
)
|
| 148 |
-
unlock_full_method = gr.Checkbox(
|
| 149 |
-
label=translations["f0_unlock"],
|
| 150 |
-
value=False,
|
| 151 |
-
interactive=True
|
| 152 |
-
)
|
| 153 |
-
f0_method = gr.Radio(
|
| 154 |
-
label=translations["f0_method"],
|
| 155 |
-
info=translations["f0_method_info"],
|
| 156 |
-
choices=method_f0,
|
| 157 |
-
value="rmvpe",
|
| 158 |
-
interactive=True
|
| 159 |
-
)
|
| 160 |
-
f0_hybrid_method = gr.Dropdown(
|
| 161 |
-
label=translations["f0_method_hybrid"],
|
| 162 |
-
info=translations["f0_method_hybrid_info"],
|
| 163 |
-
choices=hybrid_f0_method,
|
| 164 |
-
value=hybrid_f0_method[0],
|
| 165 |
-
interactive=True,
|
| 166 |
-
allow_custom_value=True,
|
| 167 |
-
visible=False
|
| 168 |
-
)
|
| 169 |
-
with gr.Row():
|
| 170 |
-
alpha = gr.Slider(
|
| 171 |
-
label=translations["alpha_label"],
|
| 172 |
-
info=translations["alpha_info"],
|
| 173 |
-
minimum=0.1,
|
| 174 |
-
maximum=1,
|
| 175 |
-
value=0.5,
|
| 176 |
-
step=0.1,
|
| 177 |
-
interactive=True,
|
| 178 |
-
visible=False
|
| 179 |
-
)
|
| 180 |
-
with gr.Column():
|
| 181 |
-
with gr.Accordion(
|
| 182 |
-
label=translations["hubert_model"],
|
| 183 |
-
open=False
|
| 184 |
-
):
|
| 185 |
-
embedders_mix = gr.Checkbox(
|
| 186 |
-
label=translations["embedders_mix"],
|
| 187 |
-
info=translations["embedders_mix_info"],
|
| 188 |
-
value=False,
|
| 189 |
-
interactive=True
|
| 190 |
-
)
|
| 191 |
-
with gr.Row():
|
| 192 |
-
version = gr.Radio(
|
| 193 |
-
label=translations["training_version"],
|
| 194 |
-
info=translations["training_version_info"],
|
| 195 |
-
choices=[
|
| 196 |
-
"v1",
|
| 197 |
-
"v2"
|
| 198 |
-
],
|
| 199 |
-
value="v2",
|
| 200 |
-
interactive=True
|
| 201 |
-
)
|
| 202 |
-
with gr.Group():
|
| 203 |
-
embedder_mode = gr.Radio(
|
| 204 |
-
label=translations["embed_mode"],
|
| 205 |
-
info=translations["embed_mode_info"],
|
| 206 |
-
value="fairseq",
|
| 207 |
-
choices=embedders_mode,
|
| 208 |
-
interactive=True,
|
| 209 |
-
visible=True
|
| 210 |
-
)
|
| 211 |
-
embedders = gr.Radio(
|
| 212 |
-
label=translations["hubert_model"],
|
| 213 |
-
info=translations["hubert_info"],
|
| 214 |
-
choices=embedders_model,
|
| 215 |
-
value="hubert_base",
|
| 216 |
-
interactive=True
|
| 217 |
-
)
|
| 218 |
-
with gr.Row():
|
| 219 |
-
embedders_custom = gr.Textbox(
|
| 220 |
-
label=translations["modelname"],
|
| 221 |
-
info=translations["modelname_info"],
|
| 222 |
-
value="",
|
| 223 |
-
placeholder="hubert_base",
|
| 224 |
-
interactive=True,
|
| 225 |
-
visible=False
|
| 226 |
-
)
|
| 227 |
-
with gr.Column(visible=False) as embedders_mix_column:
|
| 228 |
-
embedders_mix_layers = gr.Slider(
|
| 229 |
-
label=translations["embedders_mix_layers"],
|
| 230 |
-
info=translations["embedders_mix_layers_info"],
|
| 231 |
-
minimum=1,
|
| 232 |
-
maximum=12,
|
| 233 |
-
value=9,
|
| 234 |
-
step=1,
|
| 235 |
-
interactive=True
|
| 236 |
-
)
|
| 237 |
-
embedders_mix_ratio = gr.Slider(
|
| 238 |
-
label=translations["embedders_mix_ratio"],
|
| 239 |
-
info=translations["embedders_mix_ratio_info"],
|
| 240 |
-
minimum=0.1,
|
| 241 |
-
maximum=1,
|
| 242 |
-
value=0.5,
|
| 243 |
-
step=0.1,
|
| 244 |
-
interactive=True
|
| 245 |
-
)
|
| 246 |
-
with gr.Row():
|
| 247 |
-
create_reference_info = gr.Textbox(
|
| 248 |
-
label=translations["reference_info"],
|
| 249 |
-
value="",
|
| 250 |
-
interactive=False,
|
| 251 |
-
lines=2
|
| 252 |
-
)
|
| 253 |
-
with gr.Row():
|
| 254 |
-
f0_autotune.change(
|
| 255 |
-
fn=visible,
|
| 256 |
-
inputs=[
|
| 257 |
-
f0_autotune
|
| 258 |
-
],
|
| 259 |
-
outputs=[
|
| 260 |
-
f0_autotune_strength
|
| 261 |
-
]
|
| 262 |
-
)
|
| 263 |
-
proposal_pitch.change(
|
| 264 |
-
fn=visible,
|
| 265 |
-
inputs=[
|
| 266 |
-
proposal_pitch
|
| 267 |
-
],
|
| 268 |
-
outputs=[
|
| 269 |
-
proposal_pitch_threshold
|
| 270 |
-
]
|
| 271 |
-
)
|
| 272 |
-
unlock_full_method.change(
|
| 273 |
-
fn=unlock_f0,
|
| 274 |
-
inputs=[
|
| 275 |
-
unlock_full_method
|
| 276 |
-
],
|
| 277 |
-
outputs=[
|
| 278 |
-
f0_method
|
| 279 |
-
]
|
| 280 |
-
)
|
| 281 |
-
with gr.Row():
|
| 282 |
-
input_audio.change(
|
| 283 |
-
fn=lambda audio: audio,
|
| 284 |
-
inputs=[
|
| 285 |
-
input_audio
|
| 286 |
-
],
|
| 287 |
-
outputs=[
|
| 288 |
-
play_audio
|
| 289 |
-
]
|
| 290 |
-
)
|
| 291 |
-
refresh_audio.click(
|
| 292 |
-
fn=change_audios_choices,
|
| 293 |
-
inputs=[
|
| 294 |
-
input_audio
|
| 295 |
-
],
|
| 296 |
-
outputs=[
|
| 297 |
-
input_audio
|
| 298 |
-
]
|
| 299 |
-
)
|
| 300 |
-
f0_method.change(
|
| 301 |
-
fn=lambda method: [
|
| 302 |
-
visible(method == "hybrid")
|
| 303 |
-
for _ in range(2)
|
| 304 |
-
],
|
| 305 |
-
inputs=[
|
| 306 |
-
f0_method
|
| 307 |
-
],
|
| 308 |
-
outputs=[
|
| 309 |
-
f0_hybrid_method,
|
| 310 |
-
alpha
|
| 311 |
-
]
|
| 312 |
-
)
|
| 313 |
-
with gr.Row():
|
| 314 |
-
upload_audio.upload(
|
| 315 |
-
fn=lambda audio_in: [
|
| 316 |
-
shutil_move(audio.name, configs["audios_path"])
|
| 317 |
-
for audio in audio_in
|
| 318 |
-
][0],
|
| 319 |
-
inputs=[
|
| 320 |
-
upload_audio
|
| 321 |
-
],
|
| 322 |
-
outputs=[
|
| 323 |
-
input_audio
|
| 324 |
-
]
|
| 325 |
-
)
|
| 326 |
-
embedder_mode.change(
|
| 327 |
-
fn=change_embedders_mode,
|
| 328 |
-
inputs=[
|
| 329 |
-
embedder_mode
|
| 330 |
-
],
|
| 331 |
-
outputs=[
|
| 332 |
-
embedders
|
| 333 |
-
]
|
| 334 |
-
)
|
| 335 |
-
embedders.change(
|
| 336 |
-
fn=lambda embedders: visible(embedders == "custom"),
|
| 337 |
-
inputs=[
|
| 338 |
-
embedders
|
| 339 |
-
],
|
| 340 |
-
outputs=[
|
| 341 |
-
embedders_custom
|
| 342 |
-
]
|
| 343 |
-
)
|
| 344 |
-
with gr.Row():
|
| 345 |
-
pitch_guidance.change(
|
| 346 |
-
fn=visible,
|
| 347 |
-
inputs=[
|
| 348 |
-
pitch_guidance
|
| 349 |
-
],
|
| 350 |
-
outputs=[
|
| 351 |
-
f0_method_column
|
| 352 |
-
]
|
| 353 |
-
)
|
| 354 |
-
embedders_mix.change(
|
| 355 |
-
fn=visible,
|
| 356 |
-
inputs=[
|
| 357 |
-
embedders_mix
|
| 358 |
-
],
|
| 359 |
-
outputs=[
|
| 360 |
-
embedders_mix_column
|
| 361 |
-
]
|
| 362 |
-
)
|
| 363 |
-
create_reference_button.click(
|
| 364 |
-
fn=create_reference,
|
| 365 |
-
inputs=[
|
| 366 |
-
input_audio,
|
| 367 |
-
reference_name,
|
| 368 |
-
pitch_guidance,
|
| 369 |
-
use_energy,
|
| 370 |
-
version,
|
| 371 |
-
embedders,
|
| 372 |
-
embedder_mode,
|
| 373 |
-
f0_method,
|
| 374 |
-
predictor_onnx,
|
| 375 |
-
f0_up_key,
|
| 376 |
-
filter_radius,
|
| 377 |
-
f0_autotune,
|
| 378 |
-
f0_autotune_strength,
|
| 379 |
-
proposal_pitch,
|
| 380 |
-
proposal_pitch_threshold,
|
| 381 |
-
alpha,
|
| 382 |
-
embedders_mix,
|
| 383 |
-
embedders_mix_layers,
|
| 384 |
-
embedders_mix_ratio
|
| 385 |
-
],
|
| 386 |
-
outputs=[
|
| 387 |
-
create_reference_info
|
| 388 |
-
],
|
| 389 |
-
api_name="create_reference"
|
| 390 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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radio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.core.process import zip_file
|
| 9 |
-
|
| 10 |
-
from main.app.core.training import (
|
| 11 |
-
extract,
|
| 12 |
-
training,
|
| 13 |
-
preprocess,
|
| 14 |
-
create_index
|
| 15 |
-
)
|
| 16 |
-
|
| 17 |
-
from main.app.variables import (
|
| 18 |
-
config,
|
| 19 |
-
method_f0,
|
| 20 |
-
file_types,
|
| 21 |
-
model_name,
|
| 22 |
-
index_path,
|
| 23 |
-
pretrainedG,
|
| 24 |
-
pretrainedD,
|
| 25 |
-
translations,
|
| 26 |
-
reference_list,
|
| 27 |
-
embedders_mode,
|
| 28 |
-
embedders_model,
|
| 29 |
-
hybrid_f0_method
|
| 30 |
-
)
|
| 31 |
-
|
| 32 |
-
from main.app.core.ui import (
|
| 33 |
-
visible,
|
| 34 |
-
unlock_f0,
|
| 35 |
-
gr_warning,
|
| 36 |
-
shutil_move,
|
| 37 |
-
get_gpu_info,
|
| 38 |
-
vocoders_lock,
|
| 39 |
-
unlock_version,
|
| 40 |
-
unlock_vocoder,
|
| 41 |
-
hoplength_show,
|
| 42 |
-
gpu_number_str,
|
| 43 |
-
pitch_guidance_lock,
|
| 44 |
-
change_models_choices,
|
| 45 |
-
change_embedders_mode,
|
| 46 |
-
change_reference_choices,
|
| 47 |
-
change_pretrained_choices
|
| 48 |
-
)
|
| 49 |
-
|
| 50 |
-
def training_model_tab():
|
| 51 |
-
with gr.Row():
|
| 52 |
-
gr.Markdown(translations["training_markdown"])
|
| 53 |
-
with gr.Row():
|
| 54 |
-
with gr.Column():
|
| 55 |
-
with gr.Row():
|
| 56 |
-
with gr.Column():
|
| 57 |
-
modelname = gr.Textbox(
|
| 58 |
-
label=translations["modelname"],
|
| 59 |
-
info=translations["training_model_name"],
|
| 60 |
-
value="",
|
| 61 |
-
placeholder=translations["modelname"],
|
| 62 |
-
interactive=True
|
| 63 |
-
)
|
| 64 |
-
sample_rate = gr.Radio(
|
| 65 |
-
label=translations["sample_rate"],
|
| 66 |
-
info=translations["sample_rate_info"],
|
| 67 |
-
choices=[
|
| 68 |
-
"24k",
|
| 69 |
-
"32k",
|
| 70 |
-
"40k",
|
| 71 |
-
"44.1k",
|
| 72 |
-
"48k"
|
| 73 |
-
],
|
| 74 |
-
value="48k",
|
| 75 |
-
interactive=True
|
| 76 |
-
)
|
| 77 |
-
rvc_version = gr.Radio(
|
| 78 |
-
label=translations["training_version"],
|
| 79 |
-
info=translations["training_version_info"],
|
| 80 |
-
choices=[
|
| 81 |
-
"v1",
|
| 82 |
-
"v2"
|
| 83 |
-
],
|
| 84 |
-
value="v2",
|
| 85 |
-
interactive=True
|
| 86 |
-
)
|
| 87 |
-
with gr.Group():
|
| 88 |
-
with gr.Row():
|
| 89 |
-
clean_dataset = gr.Checkbox(
|
| 90 |
-
label=translations["clear_dataset"],
|
| 91 |
-
value=False,
|
| 92 |
-
interactive=True
|
| 93 |
-
)
|
| 94 |
-
process_effects = gr.Checkbox(
|
| 95 |
-
label=translations["preprocess_effect"],
|
| 96 |
-
value=False,
|
| 97 |
-
interactive=True
|
| 98 |
-
)
|
| 99 |
-
pitch_guidance = gr.Checkbox(
|
| 100 |
-
label=translations["training_pitch"],
|
| 101 |
-
value=True,
|
| 102 |
-
interactive=True
|
| 103 |
-
)
|
| 104 |
-
with gr.Row():
|
| 105 |
-
custom_reference = gr.Checkbox(
|
| 106 |
-
label=translations["custom_reference"],
|
| 107 |
-
value=False,
|
| 108 |
-
interactive=True
|
| 109 |
-
)
|
| 110 |
-
checkpointing = gr.Checkbox(
|
| 111 |
-
label=translations["memory_efficient_training"],
|
| 112 |
-
value=False,
|
| 113 |
-
interactive=True
|
| 114 |
-
)
|
| 115 |
-
dataset_upload = gr.Checkbox(
|
| 116 |
-
label=translations["upload_dataset"],
|
| 117 |
-
value=False,
|
| 118 |
-
interactive=True
|
| 119 |
-
)
|
| 120 |
-
with gr.Row():
|
| 121 |
-
split_audio_mode = gr.Radio(
|
| 122 |
-
label=translations["split_audio_mode"],
|
| 123 |
-
info=translations["split_audio_mode_info"],
|
| 124 |
-
value="Automatic",
|
| 125 |
-
choices=[
|
| 126 |
-
"Automatic",
|
| 127 |
-
"Simple",
|
| 128 |
-
"Skip"
|
| 129 |
-
],
|
| 130 |
-
interactive=True
|
| 131 |
-
)
|
| 132 |
-
normalization_mode = gr.Radio(
|
| 133 |
-
label=translations["normalization_mode"],
|
| 134 |
-
info=translations["normalization_mode_info"],
|
| 135 |
-
value="post",
|
| 136 |
-
choices=[
|
| 137 |
-
"none",
|
| 138 |
-
"pre",
|
| 139 |
-
"post"
|
| 140 |
-
],
|
| 141 |
-
interactive=True
|
| 142 |
-
)
|
| 143 |
-
with gr.Row(visible=False) as custom_reference_row:
|
| 144 |
-
with gr.Accordion(
|
| 145 |
-
translations["custom_reference"],
|
| 146 |
-
open=True
|
| 147 |
-
):
|
| 148 |
-
reference_name = gr.Dropdown(
|
| 149 |
-
label=translations["reference_name"],
|
| 150 |
-
info=translations["reference_name_info"],
|
| 151 |
-
choices=reference_list,
|
| 152 |
-
value=reference_list[0] if len(reference_list) >= 1 else "",
|
| 153 |
-
allow_custom_value=True,
|
| 154 |
-
interactive=True
|
| 155 |
-
)
|
| 156 |
-
reference_refresh = gr.Button(
|
| 157 |
-
translations["refresh"],
|
| 158 |
-
scale=2
|
| 159 |
-
)
|
| 160 |
-
with gr.Row(visible=False) as clean_dataset_row:
|
| 161 |
-
clean_dataset_strength = gr.Slider(
|
| 162 |
-
label=translations["clean_strength"],
|
| 163 |
-
info=translations["clean_strength_info"],
|
| 164 |
-
minimum=0,
|
| 165 |
-
maximum=1,
|
| 166 |
-
value=0.7,
|
| 167 |
-
step=0.1,
|
| 168 |
-
interactive=True
|
| 169 |
-
)
|
| 170 |
-
with gr.Column():
|
| 171 |
-
preprocess_button = gr.Button(
|
| 172 |
-
translations["preprocess_button"],
|
| 173 |
-
scale=2
|
| 174 |
-
)
|
| 175 |
-
upload_dataset = gr.Files(
|
| 176 |
-
label=translations["drop_audio"],
|
| 177 |
-
file_types=file_types,
|
| 178 |
-
visible=False
|
| 179 |
-
)
|
| 180 |
-
preprocess_info = gr.Textbox(
|
| 181 |
-
label=translations["preprocess_info"],
|
| 182 |
-
value="",
|
| 183 |
-
interactive=False,
|
| 184 |
-
container=True,
|
| 185 |
-
lines=2
|
| 186 |
-
)
|
| 187 |
-
with gr.Column():
|
| 188 |
-
with gr.Row():
|
| 189 |
-
with gr.Column():
|
| 190 |
-
with gr.Accordion(
|
| 191 |
-
label=translations["f0_method"],
|
| 192 |
-
open=False
|
| 193 |
-
):
|
| 194 |
-
with gr.Group():
|
| 195 |
-
with gr.Row():
|
| 196 |
-
predictor_onnx = gr.Checkbox(
|
| 197 |
-
label=translations["predictor_onnx"],
|
| 198 |
-
value=False,
|
| 199 |
-
interactive=True
|
| 200 |
-
)
|
| 201 |
-
unlock_full_method = gr.Checkbox(
|
| 202 |
-
label=translations["f0_unlock"],
|
| 203 |
-
value=False,
|
| 204 |
-
interactive=True
|
| 205 |
-
)
|
| 206 |
-
autotune = gr.Checkbox(
|
| 207 |
-
label=translations["autotune"],
|
| 208 |
-
value=False,
|
| 209 |
-
interactive=True
|
| 210 |
-
)
|
| 211 |
-
f0_method = gr.Radio(
|
| 212 |
-
label=translations["f0_method"],
|
| 213 |
-
info=translations["f0_method_info"],
|
| 214 |
-
choices=method_f0,
|
| 215 |
-
value="rmvpe",
|
| 216 |
-
interactive=True
|
| 217 |
-
)
|
| 218 |
-
hybrid_f0method = gr.Dropdown(
|
| 219 |
-
label=translations["f0_method_hybrid"],
|
| 220 |
-
info=translations["f0_method_hybrid_info"],
|
| 221 |
-
choices=hybrid_f0_method,
|
| 222 |
-
value=hybrid_f0_method[0],
|
| 223 |
-
interactive=True,
|
| 224 |
-
allow_custom_value=True,
|
| 225 |
-
visible=False
|
| 226 |
-
)
|
| 227 |
-
hop_length = gr.Slider(
|
| 228 |
-
label=translations['hop_length'],
|
| 229 |
-
info=translations["hop_length_info"],
|
| 230 |
-
minimum=64,
|
| 231 |
-
maximum=512,
|
| 232 |
-
value=160,
|
| 233 |
-
step=1,
|
| 234 |
-
interactive=True,
|
| 235 |
-
visible=False
|
| 236 |
-
)
|
| 237 |
-
f0_autotune_strength = gr.Slider(
|
| 238 |
-
label=translations["autotune_rate"],
|
| 239 |
-
info=translations["autotune_rate_info"],
|
| 240 |
-
minimum=0,
|
| 241 |
-
maximum=1,
|
| 242 |
-
value=1,
|
| 243 |
-
step=0.1,
|
| 244 |
-
interactive=True,
|
| 245 |
-
visible=False
|
| 246 |
-
)
|
| 247 |
-
alpha = gr.Slider(
|
| 248 |
-
label=translations["alpha_label"],
|
| 249 |
-
info=translations["alpha_info"],
|
| 250 |
-
minimum=0.1,
|
| 251 |
-
maximum=1,
|
| 252 |
-
value=0.5,
|
| 253 |
-
step=0.1,
|
| 254 |
-
interactive=True,
|
| 255 |
-
visible=False
|
| 256 |
-
)
|
| 257 |
-
with gr.Accordion(
|
| 258 |
-
label=translations["hubert_model"],
|
| 259 |
-
open=False
|
| 260 |
-
):
|
| 261 |
-
embedders_mix = gr.Checkbox(
|
| 262 |
-
label=translations["embedders_mix"],
|
| 263 |
-
info=translations["embedders_mix_info"],
|
| 264 |
-
value=False,
|
| 265 |
-
interactive=True
|
| 266 |
-
)
|
| 267 |
-
with gr.Group():
|
| 268 |
-
embedder_mode = gr.Radio(
|
| 269 |
-
label=translations["embed_mode"],
|
| 270 |
-
info=translations["embed_mode_info"],
|
| 271 |
-
value="fairseq",
|
| 272 |
-
choices=embedders_mode,
|
| 273 |
-
interactive=True,
|
| 274 |
-
visible=True
|
| 275 |
-
)
|
| 276 |
-
embedders = gr.Radio(
|
| 277 |
-
label=translations["hubert_model"],
|
| 278 |
-
info=translations["hubert_info"],
|
| 279 |
-
choices=embedders_model,
|
| 280 |
-
value="hubert_base",
|
| 281 |
-
interactive=True
|
| 282 |
-
)
|
| 283 |
-
with gr.Row():
|
| 284 |
-
embedders_custom = gr.Textbox(
|
| 285 |
-
label=translations["modelname"],
|
| 286 |
-
info=translations["modelname_info"],
|
| 287 |
-
value="",
|
| 288 |
-
placeholder="hubert_base",
|
| 289 |
-
interactive=True,
|
| 290 |
-
visible=False
|
| 291 |
-
)
|
| 292 |
-
with gr.Column(visible=False) as embedders_mix_column:
|
| 293 |
-
embedders_mix_layers = gr.Slider(
|
| 294 |
-
label=translations["embedders_mix_layers"],
|
| 295 |
-
info=translations["embedders_mix_layers_info"],
|
| 296 |
-
minimum=1,
|
| 297 |
-
maximum=12,
|
| 298 |
-
value=9,
|
| 299 |
-
step=1,
|
| 300 |
-
interactive=True
|
| 301 |
-
)
|
| 302 |
-
embedders_mix_ratio = gr.Slider(
|
| 303 |
-
label=translations["embedders_mix_ratio"],
|
| 304 |
-
info=translations["embedders_mix_ratio_info"],
|
| 305 |
-
minimum=0.1,
|
| 306 |
-
maximum=1,
|
| 307 |
-
value=0.5,
|
| 308 |
-
step=0.1,
|
| 309 |
-
interactive=True
|
| 310 |
-
)
|
| 311 |
-
with gr.Column():
|
| 312 |
-
extract_button = gr.Button(
|
| 313 |
-
translations["extract_button"],
|
| 314 |
-
scale=2
|
| 315 |
-
)
|
| 316 |
-
extract_info = gr.Textbox(
|
| 317 |
-
label=translations["extract_info"],
|
| 318 |
-
value="",
|
| 319 |
-
interactive=False,
|
| 320 |
-
lines=2
|
| 321 |
-
)
|
| 322 |
-
with gr.Column():
|
| 323 |
-
with gr.Row():
|
| 324 |
-
with gr.Column():
|
| 325 |
-
total_epochs = gr.Slider(
|
| 326 |
-
label=translations["total_epoch"],
|
| 327 |
-
info=translations["total_epoch_info"],
|
| 328 |
-
minimum=1,
|
| 329 |
-
maximum=10000,
|
| 330 |
-
value=300,
|
| 331 |
-
step=1,
|
| 332 |
-
interactive=True
|
| 333 |
-
)
|
| 334 |
-
save_epochs = gr.Slider(
|
| 335 |
-
label=translations["save_epoch"],
|
| 336 |
-
info=translations["save_epoch_info"],
|
| 337 |
-
minimum=1,
|
| 338 |
-
maximum=10000,
|
| 339 |
-
value=50,
|
| 340 |
-
step=1,
|
| 341 |
-
interactive=True
|
| 342 |
-
)
|
| 343 |
-
with gr.Column():
|
| 344 |
-
create_index_button = gr.Button(
|
| 345 |
-
f"3. {translations['create_index']}",
|
| 346 |
-
variant="primary",
|
| 347 |
-
scale=2
|
| 348 |
-
)
|
| 349 |
-
training_button = gr.Button(
|
| 350 |
-
f"4. {translations['training_model']}",
|
| 351 |
-
variant="primary",
|
| 352 |
-
scale=2
|
| 353 |
-
)
|
| 354 |
-
with gr.Row():
|
| 355 |
-
with gr.Accordion(
|
| 356 |
-
label=translations["setting"],
|
| 357 |
-
open=False
|
| 358 |
-
):
|
| 359 |
-
with gr.Row():
|
| 360 |
-
index_algorithm = gr.Radio(
|
| 361 |
-
label=translations["index_algorithm"],
|
| 362 |
-
info=translations["index_algorithm_info"],
|
| 363 |
-
choices=[
|
| 364 |
-
"Auto",
|
| 365 |
-
"Faiss",
|
| 366 |
-
"KMeans"
|
| 367 |
-
],
|
| 368 |
-
value="Auto",
|
| 369 |
-
interactive=True
|
| 370 |
-
)
|
| 371 |
-
with gr.Row():
|
| 372 |
-
nprobe = gr.Slider(
|
| 373 |
-
label=translations["nprobe"],
|
| 374 |
-
info=translations["nprobe_info"],
|
| 375 |
-
minimum=1,
|
| 376 |
-
maximum=64,
|
| 377 |
-
value=9,
|
| 378 |
-
step=1,
|
| 379 |
-
interactive=True
|
| 380 |
-
)
|
| 381 |
-
with gr.Row():
|
| 382 |
-
cache_in_gpu = gr.Checkbox(
|
| 383 |
-
label=translations["cache_in_gpu"],
|
| 384 |
-
info=translations["cache_in_gpu_info"],
|
| 385 |
-
value=True,
|
| 386 |
-
interactive=True
|
| 387 |
-
)
|
| 388 |
-
energy = gr.Checkbox(
|
| 389 |
-
label=translations["train&energy"],
|
| 390 |
-
info=translations["train&energy_info"],
|
| 391 |
-
value=False,
|
| 392 |
-
interactive=True
|
| 393 |
-
)
|
| 394 |
-
overtraining_detector = gr.Checkbox(
|
| 395 |
-
label=translations["overtraining_detector"],
|
| 396 |
-
info=translations["overtraining_detector_info"],
|
| 397 |
-
value=False,
|
| 398 |
-
interactive=True
|
| 399 |
-
)
|
| 400 |
-
with gr.Row():
|
| 401 |
-
custom_dataset = gr.Checkbox(
|
| 402 |
-
label=translations["custom_dataset"],
|
| 403 |
-
info=translations["custom_dataset_info"],
|
| 404 |
-
value=False,
|
| 405 |
-
interactive=True
|
| 406 |
-
)
|
| 407 |
-
save_only_latest = gr.Checkbox(
|
| 408 |
-
label=translations["save_only_latest"],
|
| 409 |
-
info=translations["save_only_latest_info"],
|
| 410 |
-
value=True,
|
| 411 |
-
interactive=True
|
| 412 |
-
)
|
| 413 |
-
save_every_weights = gr.Checkbox(
|
| 414 |
-
label=translations["save_every_weights"],
|
| 415 |
-
info=translations["save_every_weights_info"],
|
| 416 |
-
value=True,
|
| 417 |
-
interactive=True
|
| 418 |
-
)
|
| 419 |
-
with gr.Row():
|
| 420 |
-
cleanup_training = gr.Checkbox(
|
| 421 |
-
label=translations["cleanup_training"],
|
| 422 |
-
info=translations["cleanup_training_info"],
|
| 423 |
-
value=False,
|
| 424 |
-
interactive=True
|
| 425 |
-
)
|
| 426 |
-
not_use_pretrain = gr.Checkbox(
|
| 427 |
-
label=translations["not_use_pretrain_2"],
|
| 428 |
-
info=translations["not_use_pretrain_info"],
|
| 429 |
-
value=False,
|
| 430 |
-
interactive=True
|
| 431 |
-
)
|
| 432 |
-
custom_pretrain = gr.Checkbox(
|
| 433 |
-
label=translations["custom_pretrain"],
|
| 434 |
-
info=translations["custom_pretrain_info"],
|
| 435 |
-
value=False,
|
| 436 |
-
interactive=True
|
| 437 |
-
)
|
| 438 |
-
with gr.Column():
|
| 439 |
-
dataset_path = gr.Textbox(
|
| 440 |
-
label=translations["dataset_folder"],
|
| 441 |
-
value="dataset",
|
| 442 |
-
interactive=True,
|
| 443 |
-
visible=False
|
| 444 |
-
)
|
| 445 |
-
with gr.Column():
|
| 446 |
-
include_mutes = gr.Slider(
|
| 447 |
-
minimum=0,
|
| 448 |
-
maximum=10,
|
| 449 |
-
value=2,
|
| 450 |
-
step=1,
|
| 451 |
-
label=translations["include_mutes"],
|
| 452 |
-
info=translations["include_mutes_info"],
|
| 453 |
-
interactive=True
|
| 454 |
-
)
|
| 455 |
-
with gr.Row(visible=False) as simple_option:
|
| 456 |
-
chunk_len = gr.Slider(
|
| 457 |
-
minimum=0.5,
|
| 458 |
-
maximum=5.0,
|
| 459 |
-
value=3.0,
|
| 460 |
-
step=0.1,
|
| 461 |
-
label=translations["chunk_length"],
|
| 462 |
-
info=translations["chunk_length_info"],
|
| 463 |
-
interactive=True
|
| 464 |
-
)
|
| 465 |
-
overlap_len = gr.Slider(
|
| 466 |
-
minimum=0.0,
|
| 467 |
-
maximum=0.4,
|
| 468 |
-
value=0.3,
|
| 469 |
-
step=0.1,
|
| 470 |
-
label=translations["overlap_length"],
|
| 471 |
-
info=translations["overlap_length_info"],
|
| 472 |
-
interactive=True
|
| 473 |
-
)
|
| 474 |
-
threshold = gr.Slider(
|
| 475 |
-
minimum=1,
|
| 476 |
-
maximum=100,
|
| 477 |
-
value=50,
|
| 478 |
-
step=1,
|
| 479 |
-
label=translations["threshold"],
|
| 480 |
-
info=translations["overtraining_threshold"],
|
| 481 |
-
interactive=True,
|
| 482 |
-
visible=False
|
| 483 |
-
)
|
| 484 |
-
with gr.Accordion(
|
| 485 |
-
translations["setting_cpu_gpu"],
|
| 486 |
-
open=False
|
| 487 |
-
):
|
| 488 |
-
with gr.Row():
|
| 489 |
-
architecture = gr.Radio(
|
| 490 |
-
label=translations["architecture"],
|
| 491 |
-
info=translations["architecture_info"],
|
| 492 |
-
choices=[
|
| 493 |
-
"RVC",
|
| 494 |
-
"SVC"
|
| 495 |
-
],
|
| 496 |
-
value="RVC",
|
| 497 |
-
interactive=True
|
| 498 |
-
)
|
| 499 |
-
with gr.Column():
|
| 500 |
-
gpu_number = gr.Textbox(
|
| 501 |
-
label=translations["gpu_number"],
|
| 502 |
-
value=gpu_number_str(),
|
| 503 |
-
info=translations["gpu_number_info"],
|
| 504 |
-
interactive=True
|
| 505 |
-
)
|
| 506 |
-
gpu_str, gpu_len = get_gpu_info()
|
| 507 |
-
gr.Textbox(
|
| 508 |
-
label=translations["gpu_info"],
|
| 509 |
-
value=gpu_str,
|
| 510 |
-
info=translations["gpu_info_2"],
|
| 511 |
-
interactive=False,
|
| 512 |
-
lines=gpu_len
|
| 513 |
-
)
|
| 514 |
-
cpu_core = gr.Slider(
|
| 515 |
-
label=translations["cpu_core"],
|
| 516 |
-
info=translations["cpu_core_info"],
|
| 517 |
-
minimum=1,
|
| 518 |
-
maximum=os.cpu_count(),
|
| 519 |
-
value=min(os.cpu_count(), 4),
|
| 520 |
-
step=1,
|
| 521 |
-
interactive=True
|
| 522 |
-
)
|
| 523 |
-
batch_size = gr.Slider(
|
| 524 |
-
label=translations["batch_size"],
|
| 525 |
-
info=translations["batch_size_info"],
|
| 526 |
-
minimum=1,
|
| 527 |
-
maximum=64,
|
| 528 |
-
value=8,
|
| 529 |
-
step=1,
|
| 530 |
-
interactive=True
|
| 531 |
-
)
|
| 532 |
-
with gr.Group():
|
| 533 |
-
multiscale_mel_loss = gr.Checkbox(
|
| 534 |
-
label=translations["multiscale_mel_loss"],
|
| 535 |
-
info=translations["multiscale_mel_loss_info"],
|
| 536 |
-
value=False,
|
| 537 |
-
interactive=True
|
| 538 |
-
)
|
| 539 |
-
cosine_annealing_lr = gr.Checkbox(
|
| 540 |
-
label=translations["cosine_annealing_lr"],
|
| 541 |
-
info=translations["cosine_annealing_lr_info"],
|
| 542 |
-
value=False,
|
| 543 |
-
interactive=True
|
| 544 |
-
)
|
| 545 |
-
vocoders = gr.Radio(
|
| 546 |
-
label=translations["vocoder"],
|
| 547 |
-
info=translations["vocoder_info"],
|
| 548 |
-
choices=[
|
| 549 |
-
"Default",
|
| 550 |
-
"MRF-HiFi-GAN",
|
| 551 |
-
"RefineGAN",
|
| 552 |
-
"BigVGAN"
|
| 553 |
-
],
|
| 554 |
-
value="Default",
|
| 555 |
-
interactive=True
|
| 556 |
-
)
|
| 557 |
-
with gr.Row():
|
| 558 |
-
deterministic = gr.Checkbox(
|
| 559 |
-
label=translations["deterministic"],
|
| 560 |
-
info=translations["deterministic_info"],
|
| 561 |
-
value=False,
|
| 562 |
-
interactive=config.device.startswith("cuda") and not config.is_zluda
|
| 563 |
-
)
|
| 564 |
-
benchmark = gr.Checkbox(
|
| 565 |
-
label=translations["benchmark"],
|
| 566 |
-
info=translations["benchmark_info"],
|
| 567 |
-
value=False,
|
| 568 |
-
interactive=config.device.startswith("cuda") and not config.is_zluda
|
| 569 |
-
)
|
| 570 |
-
with gr.Row():
|
| 571 |
-
optimizer = gr.Radio(
|
| 572 |
-
label=translations["optimizer"],
|
| 573 |
-
info=translations["optimizer_info"],
|
| 574 |
-
value="AdamW",
|
| 575 |
-
choices=[
|
| 576 |
-
"AdamW",
|
| 577 |
-
"RAdam",
|
| 578 |
-
"AnyPrecisionAdamW",
|
| 579 |
-
"AdaBelief",
|
| 580 |
-
"AdaBeliefV2"
|
| 581 |
-
],
|
| 582 |
-
interactive=True
|
| 583 |
-
)
|
| 584 |
-
with gr.Row():
|
| 585 |
-
model_author = gr.Textbox(
|
| 586 |
-
label=translations["training_author"],
|
| 587 |
-
info=translations["training_author_info"],
|
| 588 |
-
value="",
|
| 589 |
-
placeholder=translations["training_author"],
|
| 590 |
-
interactive=True
|
| 591 |
-
)
|
| 592 |
-
with gr.Row():
|
| 593 |
-
with gr.Column():
|
| 594 |
-
with gr.Accordion(
|
| 595 |
-
translations["custom_pretrain_info"],
|
| 596 |
-
open=False,
|
| 597 |
-
visible=False
|
| 598 |
-
) as pretrain_setting:
|
| 599 |
-
pretrained_D = gr.Dropdown(
|
| 600 |
-
label=translations["pretrain_file"].format(dg="D"),
|
| 601 |
-
choices=pretrainedD,
|
| 602 |
-
value=pretrainedD[0] if len(pretrainedD) > 0 else '',
|
| 603 |
-
interactive=True,
|
| 604 |
-
allow_custom_value=True
|
| 605 |
-
)
|
| 606 |
-
pretrained_G = gr.Dropdown(
|
| 607 |
-
label=translations["pretrain_file"].format(dg="G"),
|
| 608 |
-
choices=pretrainedG,
|
| 609 |
-
value=pretrainedG[0] if len(pretrainedG) > 0 else '',
|
| 610 |
-
interactive=True,
|
| 611 |
-
allow_custom_value=True
|
| 612 |
-
)
|
| 613 |
-
pretrained_refresh = gr.Button(
|
| 614 |
-
translations["refresh"],
|
| 615 |
-
scale=2
|
| 616 |
-
)
|
| 617 |
-
with gr.Row():
|
| 618 |
-
training_info = gr.Textbox(
|
| 619 |
-
label=translations["train_info"],
|
| 620 |
-
value="",
|
| 621 |
-
interactive=False,
|
| 622 |
-
lines=3
|
| 623 |
-
)
|
| 624 |
-
with gr.Row():
|
| 625 |
-
with gr.Column():
|
| 626 |
-
with gr.Accordion(
|
| 627 |
-
translations["export_model"],
|
| 628 |
-
open=False
|
| 629 |
-
):
|
| 630 |
-
with gr.Row():
|
| 631 |
-
model_file = gr.Dropdown(
|
| 632 |
-
label=translations["model_name"],
|
| 633 |
-
choices=model_name,
|
| 634 |
-
value=model_name[0] if len(model_name) >= 1 else "",
|
| 635 |
-
interactive=True,
|
| 636 |
-
allow_custom_value=True
|
| 637 |
-
)
|
| 638 |
-
index_file = gr.Dropdown(
|
| 639 |
-
label=translations["index_path"],
|
| 640 |
-
choices=index_path,
|
| 641 |
-
value=index_path[0] if len(index_path) >= 1 else "",
|
| 642 |
-
interactive=True,
|
| 643 |
-
allow_custom_value=True
|
| 644 |
-
)
|
| 645 |
-
with gr.Row():
|
| 646 |
-
refresh_file = gr.Button(
|
| 647 |
-
f"1. {translations['refresh']}",
|
| 648 |
-
scale=2
|
| 649 |
-
)
|
| 650 |
-
zip_model = gr.Button(
|
| 651 |
-
translations["zip_model"],
|
| 652 |
-
variant="primary",
|
| 653 |
-
scale=2
|
| 654 |
-
)
|
| 655 |
-
with gr.Row():
|
| 656 |
-
zip_output = gr.File(
|
| 657 |
-
label=translations["output_zip"],
|
| 658 |
-
file_types=[".zip"],
|
| 659 |
-
interactive=False,
|
| 660 |
-
visible=False
|
| 661 |
-
)
|
| 662 |
-
with gr.Row():
|
| 663 |
-
vocoders.change(
|
| 664 |
-
fn=pitch_guidance_lock,
|
| 665 |
-
inputs=[
|
| 666 |
-
vocoders
|
| 667 |
-
],
|
| 668 |
-
outputs=[
|
| 669 |
-
pitch_guidance
|
| 670 |
-
]
|
| 671 |
-
)
|
| 672 |
-
pitch_guidance.change(
|
| 673 |
-
fn=vocoders_lock,
|
| 674 |
-
inputs=[
|
| 675 |
-
pitch_guidance
|
| 676 |
-
],
|
| 677 |
-
outputs=[
|
| 678 |
-
vocoders
|
| 679 |
-
]
|
| 680 |
-
)
|
| 681 |
-
unlock_full_method.change(
|
| 682 |
-
fn=unlock_f0,
|
| 683 |
-
inputs=[
|
| 684 |
-
unlock_full_method
|
| 685 |
-
],
|
| 686 |
-
outputs=[
|
| 687 |
-
f0_method
|
| 688 |
-
]
|
| 689 |
-
)
|
| 690 |
-
with gr.Row():
|
| 691 |
-
refresh_file.click(
|
| 692 |
-
fn=change_models_choices,
|
| 693 |
-
inputs=[],
|
| 694 |
-
outputs=[
|
| 695 |
-
model_file,
|
| 696 |
-
index_file
|
| 697 |
-
]
|
| 698 |
-
)
|
| 699 |
-
zip_model.click(
|
| 700 |
-
fn=zip_file,
|
| 701 |
-
inputs=[
|
| 702 |
-
modelname,
|
| 703 |
-
model_file,
|
| 704 |
-
index_file
|
| 705 |
-
],
|
| 706 |
-
outputs=[
|
| 707 |
-
zip_output
|
| 708 |
-
]
|
| 709 |
-
)
|
| 710 |
-
dataset_path.change(
|
| 711 |
-
fn=lambda folder: os.makedirs(folder, exist_ok=True) if folder else None,
|
| 712 |
-
inputs=[
|
| 713 |
-
dataset_path
|
| 714 |
-
],
|
| 715 |
-
outputs=[]
|
| 716 |
-
)
|
| 717 |
-
with gr.Row():
|
| 718 |
-
dataset_upload.change(
|
| 719 |
-
fn=visible,
|
| 720 |
-
inputs=[
|
| 721 |
-
dataset_upload
|
| 722 |
-
],
|
| 723 |
-
outputs=[
|
| 724 |
-
upload_dataset
|
| 725 |
-
]
|
| 726 |
-
)
|
| 727 |
-
overtraining_detector.change(
|
| 728 |
-
fn=visible,
|
| 729 |
-
inputs=[
|
| 730 |
-
overtraining_detector
|
| 731 |
-
],
|
| 732 |
-
outputs=[
|
| 733 |
-
threshold
|
| 734 |
-
]
|
| 735 |
-
)
|
| 736 |
-
clean_dataset.change(
|
| 737 |
-
fn=visible,
|
| 738 |
-
inputs=[
|
| 739 |
-
clean_dataset
|
| 740 |
-
],
|
| 741 |
-
outputs=[
|
| 742 |
-
clean_dataset_row
|
| 743 |
-
]
|
| 744 |
-
)
|
| 745 |
-
with gr.Row():
|
| 746 |
-
custom_dataset.change(
|
| 747 |
-
fn=lambda custom_dataset: [
|
| 748 |
-
visible(custom_dataset),
|
| 749 |
-
"dataset"
|
| 750 |
-
],
|
| 751 |
-
inputs=[
|
| 752 |
-
custom_dataset
|
| 753 |
-
],
|
| 754 |
-
outputs=[
|
| 755 |
-
dataset_path,
|
| 756 |
-
dataset_path
|
| 757 |
-
]
|
| 758 |
-
)
|
| 759 |
-
rvc_version.change(
|
| 760 |
-
fn=unlock_vocoder,
|
| 761 |
-
inputs=[
|
| 762 |
-
rvc_version,
|
| 763 |
-
vocoders
|
| 764 |
-
],
|
| 765 |
-
outputs=[
|
| 766 |
-
vocoders
|
| 767 |
-
]
|
| 768 |
-
)
|
| 769 |
-
vocoders.change(
|
| 770 |
-
inputs=[
|
| 771 |
-
rvc_version,
|
| 772 |
-
vocoders
|
| 773 |
-
],
|
| 774 |
-
fn=unlock_version,
|
| 775 |
-
outputs=[
|
| 776 |
-
rvc_version
|
| 777 |
-
]
|
| 778 |
-
)
|
| 779 |
-
with gr.Row():
|
| 780 |
-
custom_reference.change(
|
| 781 |
-
fn=visible,
|
| 782 |
-
inputs=[
|
| 783 |
-
custom_reference
|
| 784 |
-
],
|
| 785 |
-
outputs=[
|
| 786 |
-
custom_reference_row
|
| 787 |
-
]
|
| 788 |
-
)
|
| 789 |
-
f0_method.change(
|
| 790 |
-
fn=lambda method, hybrid: [
|
| 791 |
-
visible(method == "hybrid"),
|
| 792 |
-
visible(method == "hybrid"),
|
| 793 |
-
hoplength_show(method, hybrid)
|
| 794 |
-
],
|
| 795 |
-
inputs=[
|
| 796 |
-
f0_method,
|
| 797 |
-
hybrid_f0method
|
| 798 |
-
],
|
| 799 |
-
outputs=[
|
| 800 |
-
hybrid_f0method,
|
| 801 |
-
alpha,
|
| 802 |
-
hop_length
|
| 803 |
-
]
|
| 804 |
-
)
|
| 805 |
-
hybrid_f0method.change(
|
| 806 |
-
fn=hoplength_show,
|
| 807 |
-
inputs=[
|
| 808 |
-
f0_method,
|
| 809 |
-
hybrid_f0method
|
| 810 |
-
],
|
| 811 |
-
outputs=[
|
| 812 |
-
hop_length
|
| 813 |
-
]
|
| 814 |
-
)
|
| 815 |
-
with gr.Row():
|
| 816 |
-
autotune.change(
|
| 817 |
-
fn=visible,
|
| 818 |
-
inputs=[
|
| 819 |
-
autotune
|
| 820 |
-
],
|
| 821 |
-
outputs=[
|
| 822 |
-
f0_autotune_strength
|
| 823 |
-
]
|
| 824 |
-
)
|
| 825 |
-
split_audio_mode.change(
|
| 826 |
-
fn=lambda a: visible(a == "Simple"),
|
| 827 |
-
inputs=[
|
| 828 |
-
split_audio_mode
|
| 829 |
-
],
|
| 830 |
-
outputs=[
|
| 831 |
-
simple_option
|
| 832 |
-
]
|
| 833 |
-
)
|
| 834 |
-
upload_dataset.upload(
|
| 835 |
-
fn=lambda files, folder: [
|
| 836 |
-
shutil_move(f.name, os.path.join(folder, os.path.split(f.name)[1]))
|
| 837 |
-
for f in files
|
| 838 |
-
] if folder != "" else gr_warning(translations["dataset_folder1"]),
|
| 839 |
-
inputs=[
|
| 840 |
-
upload_dataset,
|
| 841 |
-
dataset_path
|
| 842 |
-
],
|
| 843 |
-
outputs=[],
|
| 844 |
-
api_name="upload_dataset"
|
| 845 |
-
)
|
| 846 |
-
with gr.Row():
|
| 847 |
-
not_use_pretrain.change(
|
| 848 |
-
fn=lambda a, b: visible(a and not b),
|
| 849 |
-
inputs=[
|
| 850 |
-
custom_pretrain,
|
| 851 |
-
not_use_pretrain
|
| 852 |
-
],
|
| 853 |
-
outputs=[
|
| 854 |
-
pretrain_setting
|
| 855 |
-
]
|
| 856 |
-
)
|
| 857 |
-
custom_pretrain.change(
|
| 858 |
-
fn=lambda a, b: visible(a and not b),
|
| 859 |
-
inputs=[
|
| 860 |
-
custom_pretrain,
|
| 861 |
-
not_use_pretrain
|
| 862 |
-
],
|
| 863 |
-
outputs=[
|
| 864 |
-
pretrain_setting
|
| 865 |
-
]
|
| 866 |
-
)
|
| 867 |
-
pretrained_refresh.click(
|
| 868 |
-
fn=change_pretrained_choices,
|
| 869 |
-
inputs=[],
|
| 870 |
-
outputs=[
|
| 871 |
-
pretrained_D,
|
| 872 |
-
pretrained_G
|
| 873 |
-
]
|
| 874 |
-
)
|
| 875 |
-
with gr.Row():
|
| 876 |
-
embedder_mode.change(
|
| 877 |
-
fn=change_embedders_mode,
|
| 878 |
-
inputs=[
|
| 879 |
-
embedder_mode
|
| 880 |
-
],
|
| 881 |
-
outputs=[
|
| 882 |
-
embedders
|
| 883 |
-
]
|
| 884 |
-
)
|
| 885 |
-
embedders.change(
|
| 886 |
-
fn=lambda embedders: visible(embedders == "custom"),
|
| 887 |
-
inputs=[
|
| 888 |
-
embedders
|
| 889 |
-
],
|
| 890 |
-
outputs=[
|
| 891 |
-
embedders_custom
|
| 892 |
-
]
|
| 893 |
-
)
|
| 894 |
-
reference_refresh.click(
|
| 895 |
-
fn=change_reference_choices,
|
| 896 |
-
inputs=[],
|
| 897 |
-
outputs=[
|
| 898 |
-
reference_name
|
| 899 |
-
]
|
| 900 |
-
)
|
| 901 |
-
with gr.Row():
|
| 902 |
-
embedders_mix.change(
|
| 903 |
-
fn=visible,
|
| 904 |
-
inputs=[
|
| 905 |
-
embedders_mix
|
| 906 |
-
],
|
| 907 |
-
outputs=[
|
| 908 |
-
embedders_mix_column
|
| 909 |
-
]
|
| 910 |
-
)
|
| 911 |
-
with gr.Row():
|
| 912 |
-
preprocess_button.click(
|
| 913 |
-
fn=preprocess,
|
| 914 |
-
inputs=[
|
| 915 |
-
modelname,
|
| 916 |
-
sample_rate,
|
| 917 |
-
cpu_core,
|
| 918 |
-
split_audio_mode,
|
| 919 |
-
process_effects,
|
| 920 |
-
dataset_path,
|
| 921 |
-
clean_dataset,
|
| 922 |
-
clean_dataset_strength,
|
| 923 |
-
chunk_len,
|
| 924 |
-
overlap_len,
|
| 925 |
-
normalization_mode,
|
| 926 |
-
architecture
|
| 927 |
-
],
|
| 928 |
-
outputs=[
|
| 929 |
-
preprocess_info
|
| 930 |
-
],
|
| 931 |
-
api_name="preprocess"
|
| 932 |
-
)
|
| 933 |
-
with gr.Row():
|
| 934 |
-
extract_button.click(
|
| 935 |
-
fn=extract,
|
| 936 |
-
inputs=[
|
| 937 |
-
modelname,
|
| 938 |
-
rvc_version,
|
| 939 |
-
f0_method,
|
| 940 |
-
pitch_guidance,
|
| 941 |
-
hop_length,
|
| 942 |
-
cpu_core,
|
| 943 |
-
gpu_number,
|
| 944 |
-
sample_rate,
|
| 945 |
-
embedders,
|
| 946 |
-
embedders_custom,
|
| 947 |
-
predictor_onnx,
|
| 948 |
-
embedder_mode,
|
| 949 |
-
autotune,
|
| 950 |
-
f0_autotune_strength,
|
| 951 |
-
hybrid_f0method,
|
| 952 |
-
energy,
|
| 953 |
-
alpha,
|
| 954 |
-
include_mutes,
|
| 955 |
-
embedders_mix,
|
| 956 |
-
embedders_mix_layers,
|
| 957 |
-
embedders_mix_ratio,
|
| 958 |
-
architecture
|
| 959 |
-
],
|
| 960 |
-
outputs=[
|
| 961 |
-
extract_info
|
| 962 |
-
],
|
| 963 |
-
api_name="extract"
|
| 964 |
-
)
|
| 965 |
-
with gr.Row():
|
| 966 |
-
create_index_button.click(
|
| 967 |
-
fn=create_index,
|
| 968 |
-
inputs=[
|
| 969 |
-
modelname,
|
| 970 |
-
rvc_version,
|
| 971 |
-
index_algorithm,
|
| 972 |
-
nprobe
|
| 973 |
-
],
|
| 974 |
-
outputs=[
|
| 975 |
-
training_info
|
| 976 |
-
],
|
| 977 |
-
api_name="create_index"
|
| 978 |
-
)
|
| 979 |
-
with gr.Row():
|
| 980 |
-
training_button.click(
|
| 981 |
-
fn=training,
|
| 982 |
-
inputs=[
|
| 983 |
-
modelname,
|
| 984 |
-
rvc_version,
|
| 985 |
-
save_epochs,
|
| 986 |
-
save_only_latest,
|
| 987 |
-
save_every_weights,
|
| 988 |
-
total_epochs,
|
| 989 |
-
sample_rate,
|
| 990 |
-
batch_size,
|
| 991 |
-
gpu_number,
|
| 992 |
-
pitch_guidance,
|
| 993 |
-
not_use_pretrain,
|
| 994 |
-
custom_pretrain,
|
| 995 |
-
pretrained_G,
|
| 996 |
-
pretrained_D,
|
| 997 |
-
overtraining_detector,
|
| 998 |
-
threshold,
|
| 999 |
-
cleanup_training,
|
| 1000 |
-
cache_in_gpu,
|
| 1001 |
-
model_author,
|
| 1002 |
-
vocoders,
|
| 1003 |
-
checkpointing,
|
| 1004 |
-
deterministic,
|
| 1005 |
-
benchmark,
|
| 1006 |
-
optimizer,
|
| 1007 |
-
energy,
|
| 1008 |
-
custom_reference,
|
| 1009 |
-
reference_name,
|
| 1010 |
-
multiscale_mel_loss,
|
| 1011 |
-
embedders,
|
| 1012 |
-
embedders_custom,
|
| 1013 |
-
cosine_annealing_lr,
|
| 1014 |
-
architecture
|
| 1015 |
-
],
|
| 1016 |
-
outputs=[
|
| 1017 |
-
training_info
|
| 1018 |
-
],
|
| 1019 |
-
api_name="training_model"
|
| 1020 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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gradio as gr
|
| 5 |
-
|
| 6 |
-
sys.path.append(os.getcwd())
|
| 7 |
-
|
| 8 |
-
from main.app.variables import (
|
| 9 |
-
configs,
|
| 10 |
-
translations
|
| 11 |
-
)
|
| 12 |
-
|
| 13 |
-
def training_tab():
|
| 14 |
-
with gr.TabItem(translations["training_model"]):
|
| 15 |
-
if configs.get("training_tab", True):
|
| 16 |
-
from main.app.tabs.training.child.training import training_model_tab
|
| 17 |
-
|
| 18 |
-
with gr.TabItem(translations["training_model"]):
|
| 19 |
-
gr.Markdown(f"## {translations['training_model']}")
|
| 20 |
-
training_model_tab()
|
| 21 |
-
|
| 22 |
-
if configs.get("create_dataset_tab", True):
|
| 23 |
-
from main.app.tabs.training.child.create_dataset import create_dataset_tab
|
| 24 |
-
|
| 25 |
-
with gr.TabItem(translations["createdataset"]):
|
| 26 |
-
gr.Markdown(translations["create_dataset_markdown"])
|
| 27 |
-
create_dataset_tab()
|
| 28 |
-
|
| 29 |
-
if configs.get("create_reference_tab", True):
|
| 30 |
-
from main.app.tabs.training.child.create_reference import create_reference_tab
|
| 31 |
-
|
| 32 |
-
with gr.TabItem(translations["create_reference"]):
|
| 33 |
-
gr.Markdown(translations["create_reference_markdown"])
|
| 34 |
-
create_reference_tab()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/app/variables.py
DELETED
|
@@ -1,345 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import re
|
| 3 |
-
import sys
|
| 4 |
-
import csv
|
| 5 |
-
import json
|
| 6 |
-
import spaces
|
| 7 |
-
import logging
|
| 8 |
-
import logging.handlers
|
| 9 |
-
|
| 10 |
-
@spaces.GPU
|
| 11 |
-
def dummpy():
|
| 12 |
-
pass
|
| 13 |
-
|
| 14 |
-
import gradio as gr
|
| 15 |
-
|
| 16 |
-
from packaging import version
|
| 17 |
-
|
| 18 |
-
sys.path.append(os.getcwd())
|
| 19 |
-
|
| 20 |
-
from main.configs.config import Config
|
| 21 |
-
|
| 22 |
-
logger = logging.getLogger(__name__)
|
| 23 |
-
logger.propagate = False
|
| 24 |
-
|
| 25 |
-
config = Config()
|
| 26 |
-
python = sys.executable
|
| 27 |
-
translations = config.translations
|
| 28 |
-
configs_json = os.path.join("main", "configs", "config.json")
|
| 29 |
-
configs = json.load(open(configs_json, "r"))
|
| 30 |
-
|
| 31 |
-
configs["debug_mode"] = "--debug" in sys.argv
|
| 32 |
-
configs["tensorrt"] = "--tensorrt" in sys.argv
|
| 33 |
-
|
| 34 |
-
with open(configs_json, "w") as f:
|
| 35 |
-
json.dump(configs, f, indent=4)
|
| 36 |
-
|
| 37 |
-
gradio_version = version.parse(gr.__version__) <= version.parse("6.0.0")
|
| 38 |
-
|
| 39 |
-
audio_params = {
|
| 40 |
-
"show_download_button": True,
|
| 41 |
-
"show_share_button": True
|
| 42 |
-
} if gradio_version else {
|
| 43 |
-
"buttons": ["download", "share"]
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
if not logger.hasHandlers():
|
| 47 |
-
console_handler = logging.StreamHandler()
|
| 48 |
-
console_formatter = logging.Formatter(fmt="\n%(asctime)s.%(msecs)03d | %(levelname)s | %(module)s | %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
|
| 49 |
-
console_handler.setFormatter(console_formatter)
|
| 50 |
-
console_handler.setLevel(logging.DEBUG if config.debug_mode else logging.INFO)
|
| 51 |
-
file_handler = logging.handlers.RotatingFileHandler(os.path.join(configs["logs_path"], "app.log"), maxBytes=10*1024*1024, backupCount=3, encoding='utf-8')
|
| 52 |
-
file_formatter = logging.Formatter(fmt="\n%(asctime)s.%(msecs)03d | %(levelname)s | %(module)s | %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
|
| 53 |
-
file_handler.setFormatter(file_formatter)
|
| 54 |
-
file_handler.setLevel(logging.DEBUG)
|
| 55 |
-
logger.addHandler(console_handler)
|
| 56 |
-
logger.addHandler(file_handler)
|
| 57 |
-
logger.setLevel(logging.DEBUG)
|
| 58 |
-
|
| 59 |
-
if config.device in ["cpu", "mps", "ocl:0", "privateuseone:0"] and configs.get("fp16", False) and not configs.get("allow_fp16_all_backend", False):
|
| 60 |
-
logger.warning(translations["fp16_not_support"])
|
| 61 |
-
configs["fp16"] = config.is_half = False
|
| 62 |
-
|
| 63 |
-
with open(configs_json, "w") as f:
|
| 64 |
-
json.dump(configs, f, indent=4)
|
| 65 |
-
|
| 66 |
-
if configs.get("asio_enabled", False):
|
| 67 |
-
logger.debug(translations["enabled_asio"])
|
| 68 |
-
os.environ["SD_ENABLE_ASIO"] = "1"
|
| 69 |
-
|
| 70 |
-
models = {}
|
| 71 |
-
model_options = {}
|
| 72 |
-
|
| 73 |
-
file_types = [
|
| 74 |
-
".wav",
|
| 75 |
-
".mp3",
|
| 76 |
-
".flac",
|
| 77 |
-
".ogg",
|
| 78 |
-
".opus",
|
| 79 |
-
".m4a",
|
| 80 |
-
".mp4",
|
| 81 |
-
".aac",
|
| 82 |
-
".alac",
|
| 83 |
-
".wma",
|
| 84 |
-
".aiff",
|
| 85 |
-
".webm",
|
| 86 |
-
".ac3"
|
| 87 |
-
]
|
| 88 |
-
|
| 89 |
-
export_format_choices = [
|
| 90 |
-
"wav",
|
| 91 |
-
"mp3",
|
| 92 |
-
"flac",
|
| 93 |
-
"ogg",
|
| 94 |
-
"opus",
|
| 95 |
-
"m4a",
|
| 96 |
-
"mp4",
|
| 97 |
-
"aac",
|
| 98 |
-
"alac",
|
| 99 |
-
"wma",
|
| 100 |
-
"aiff",
|
| 101 |
-
"webm",
|
| 102 |
-
"ac3"
|
| 103 |
-
]
|
| 104 |
-
|
| 105 |
-
method_f0 = [
|
| 106 |
-
"mangio-crepe-full",
|
| 107 |
-
"crepe-full",
|
| 108 |
-
"fcpe",
|
| 109 |
-
"rmvpe",
|
| 110 |
-
"harvest-stonemask",
|
| 111 |
-
"pyin",
|
| 112 |
-
"hybrid"
|
| 113 |
-
]
|
| 114 |
-
|
| 115 |
-
method_f0_full = [
|
| 116 |
-
"rmvpe-mix",
|
| 117 |
-
"rmvpe-mix-medfilt",
|
| 118 |
-
"hpa-rmvpe",
|
| 119 |
-
"hpa-rmvpe-medfilt",
|
| 120 |
-
"hpa-rmvpe-previous",
|
| 121 |
-
"hpa-rmvpe-previous-medfilt",
|
| 122 |
-
"rmvpe",
|
| 123 |
-
"rmvpe-medfilt",
|
| 124 |
-
"djcm",
|
| 125 |
-
"djcm-medfilt",
|
| 126 |
-
"djcm-svs",
|
| 127 |
-
"djcm-svs-medfilt",
|
| 128 |
-
"swift",
|
| 129 |
-
"fcpe",
|
| 130 |
-
"fcpe-previous",
|
| 131 |
-
"fcpe-legacy",
|
| 132 |
-
"mangio-crepe-full",
|
| 133 |
-
"crepe-full",
|
| 134 |
-
"mangio-crepe-large",
|
| 135 |
-
"crepe-large",
|
| 136 |
-
"mangio-crepe-medium",
|
| 137 |
-
"crepe-medium",
|
| 138 |
-
"mangio-crepe-small",
|
| 139 |
-
"crepe-small",
|
| 140 |
-
"mangio-crepe-tiny",
|
| 141 |
-
"crepe-tiny",
|
| 142 |
-
"harvest-stonemask",
|
| 143 |
-
"harvest",
|
| 144 |
-
"pesto",
|
| 145 |
-
"swipe-stonemask",
|
| 146 |
-
"swipe",
|
| 147 |
-
"mangio-penn",
|
| 148 |
-
"penn",
|
| 149 |
-
"dio-stonemask",
|
| 150 |
-
"dio",
|
| 151 |
-
"pm-ac",
|
| 152 |
-
"pm-cc",
|
| 153 |
-
"pm-shs",
|
| 154 |
-
"pyin",
|
| 155 |
-
"yin",
|
| 156 |
-
"piptrack",
|
| 157 |
-
"hybrid"
|
| 158 |
-
]
|
| 159 |
-
|
| 160 |
-
hybrid_f0_method = [
|
| 161 |
-
"hybrid[pm+dio]",
|
| 162 |
-
"hybrid[pm+crepe-tiny]",
|
| 163 |
-
"hybrid[pm+crepe]",
|
| 164 |
-
"hybrid[pm+fcpe]",
|
| 165 |
-
"hybrid[pm+rmvpe]",
|
| 166 |
-
"hybrid[pm+harvest]",
|
| 167 |
-
"hybrid[pm+yin]",
|
| 168 |
-
"hybrid[dio+crepe-tiny]",
|
| 169 |
-
"hybrid[dio+crepe]",
|
| 170 |
-
"hybrid[dio+fcpe]",
|
| 171 |
-
"hybrid[dio+rmvpe]",
|
| 172 |
-
"hybrid[dio+harvest]",
|
| 173 |
-
"hybrid[dio+yin]",
|
| 174 |
-
"hybrid[crepe-tiny+crepe]",
|
| 175 |
-
"hybrid[crepe-tiny+fcpe]",
|
| 176 |
-
"hybrid[crepe-tiny+rmvpe]",
|
| 177 |
-
"hybrid[crepe-tiny+harvest]",
|
| 178 |
-
"hybrid[crepe+fcpe]",
|
| 179 |
-
"hybrid[crepe+rmvpe]",
|
| 180 |
-
"hybrid[crepe+harvest]",
|
| 181 |
-
"hybrid[crepe+yin]",
|
| 182 |
-
"hybrid[fcpe+rmvpe]",
|
| 183 |
-
"hybrid[fcpe+harvest]",
|
| 184 |
-
"hybrid[fcpe+yin]",
|
| 185 |
-
"hybrid[rmvpe+harvest]",
|
| 186 |
-
"hybrid[rmvpe+yin]",
|
| 187 |
-
"hybrid[harvest+yin]"
|
| 188 |
-
]
|
| 189 |
-
|
| 190 |
-
embedders_mode = [
|
| 191 |
-
"fairseq",
|
| 192 |
-
"onnx",
|
| 193 |
-
"transformers",
|
| 194 |
-
"whisper"
|
| 195 |
-
]
|
| 196 |
-
|
| 197 |
-
embedders_model = [
|
| 198 |
-
"hubert_base",
|
| 199 |
-
"contentvec_base",
|
| 200 |
-
"vietnamese_hubert_base",
|
| 201 |
-
"japanese_hubert_base",
|
| 202 |
-
"korean_hubert_base",
|
| 203 |
-
"chinese_hubert_base",
|
| 204 |
-
"portuguese_hubert_base",
|
| 205 |
-
"spin-v1",
|
| 206 |
-
"spin-v2",
|
| 207 |
-
"custom"
|
| 208 |
-
]
|
| 209 |
-
|
| 210 |
-
whisper_model = [
|
| 211 |
-
"tiny",
|
| 212 |
-
"tiny.en",
|
| 213 |
-
"base",
|
| 214 |
-
"base.en",
|
| 215 |
-
"small",
|
| 216 |
-
"small.en",
|
| 217 |
-
"medium",
|
| 218 |
-
"medium.en",
|
| 219 |
-
"large-v1",
|
| 220 |
-
"large-v2",
|
| 221 |
-
"large-v3",
|
| 222 |
-
"large-v3-turbo"
|
| 223 |
-
]
|
| 224 |
-
|
| 225 |
-
whisper_languages = configs.get("whisper_languages", ["vi", "en"])
|
| 226 |
-
|
| 227 |
-
sample_rate_choice = [
|
| 228 |
-
8000,
|
| 229 |
-
11025,
|
| 230 |
-
12000,
|
| 231 |
-
16000,
|
| 232 |
-
22050,
|
| 233 |
-
24000,
|
| 234 |
-
32000,
|
| 235 |
-
44100,
|
| 236 |
-
48000,
|
| 237 |
-
88200,
|
| 238 |
-
96000,
|
| 239 |
-
176400,
|
| 240 |
-
192000,
|
| 241 |
-
352800,
|
| 242 |
-
384000
|
| 243 |
-
]
|
| 244 |
-
|
| 245 |
-
paths_for_files = sorted([
|
| 246 |
-
os.path.abspath(os.path.join(root, f))
|
| 247 |
-
for root, _, files in os.walk(configs["audios_path"])
|
| 248 |
-
for f in files
|
| 249 |
-
if os.path.splitext(f)[1].lower() in file_types and not f.startswith(("Convert", "output"))
|
| 250 |
-
])
|
| 251 |
-
|
| 252 |
-
reference_list = sorted([
|
| 253 |
-
re.sub(r'_v\d+_(?:[A-Za-z0-9_]+?)_(True|False)_(True|False)$', '', name)
|
| 254 |
-
for name in os.listdir(configs["reference_path"])
|
| 255 |
-
if (
|
| 256 |
-
os.path.exists(os.path.join(configs["reference_path"], name)) and
|
| 257 |
-
os.path.isdir(os.path.join(configs["reference_path"], name))
|
| 258 |
-
)
|
| 259 |
-
])
|
| 260 |
-
|
| 261 |
-
model_name = sorted([
|
| 262 |
-
model for model in os.listdir(configs["weights_path"])
|
| 263 |
-
if model.endswith((".pth", ".onnx")) and not model.startswith("G_") and not model.startswith("D_")
|
| 264 |
-
])
|
| 265 |
-
|
| 266 |
-
index_path = sorted([
|
| 267 |
-
os.path.join(root, name)
|
| 268 |
-
for root, _, files in os.walk(configs["logs_path"], topdown=False)
|
| 269 |
-
for name in files
|
| 270 |
-
if name.endswith(".index") and "trained" not in name
|
| 271 |
-
])
|
| 272 |
-
|
| 273 |
-
pretraineds = os.listdir(configs["pretrained_custom_path"])
|
| 274 |
-
|
| 275 |
-
pretrainedD = [
|
| 276 |
-
model for model in pretraineds
|
| 277 |
-
if model.endswith(".pth") and "D" in model
|
| 278 |
-
]
|
| 279 |
-
|
| 280 |
-
pretrainedG = [
|
| 281 |
-
model for model in pretraineds
|
| 282 |
-
if model.endswith(".pth") and "G" in model
|
| 283 |
-
]
|
| 284 |
-
|
| 285 |
-
all_presets = os.listdir(configs["presets_path"])
|
| 286 |
-
|
| 287 |
-
presets_file = sorted([
|
| 288 |
-
f for f in all_presets
|
| 289 |
-
if f.endswith(".conversion.json")
|
| 290 |
-
])
|
| 291 |
-
|
| 292 |
-
audio_effect_presets_file = sorted([
|
| 293 |
-
f for f in all_presets
|
| 294 |
-
if f.endswith(".effect.json")
|
| 295 |
-
])
|
| 296 |
-
|
| 297 |
-
realtime_presets_file = sorted([
|
| 298 |
-
f for f in all_presets
|
| 299 |
-
if f.endswith(".realtime.json")
|
| 300 |
-
])
|
| 301 |
-
|
| 302 |
-
f0_file = sorted([
|
| 303 |
-
os.path.abspath(os.path.join(root, f))
|
| 304 |
-
for root, _, files in os.walk(configs["f0_path"])
|
| 305 |
-
for f in files if f.endswith(".txt")
|
| 306 |
-
])
|
| 307 |
-
|
| 308 |
-
language = configs.get("language", "vi-VN")
|
| 309 |
-
theme = configs.get("theme", "NoCrypt/miku")
|
| 310 |
-
|
| 311 |
-
edgetts = configs.get("edge_tts", ["vi-VN-HoaiMyNeural", "vi-VN-NamMinhNeural"])
|
| 312 |
-
google_tts_voice = configs.get("google_tts_voice", ["vi", "en"])
|
| 313 |
-
|
| 314 |
-
vr_models = configs.get("vr_models", "")
|
| 315 |
-
demucs_models = configs.get("demucs_models", "")
|
| 316 |
-
mdx_models = configs.get("mdx_models", "")
|
| 317 |
-
karaoke_models = configs.get("karaoke_models", "")
|
| 318 |
-
reverb_models = configs.get("reverb_models", "")
|
| 319 |
-
denoise_models = configs.get("denoise_models", "")
|
| 320 |
-
uvr_model = list(demucs_models.keys()) + list(vr_models.keys()) + list(mdx_models.keys())
|
| 321 |
-
|
| 322 |
-
font = configs.get("font", "https://fonts.googleapis.com/css2?family=Saira&display=swap")
|
| 323 |
-
csv_path = configs["csv_path"]
|
| 324 |
-
|
| 325 |
-
try:
|
| 326 |
-
if "--allow_all_disk" in sys.argv and sys.platform == "win32":
|
| 327 |
-
import win32api
|
| 328 |
-
allow_disk = win32api.GetLogicalDriveStrings().split('\x00')[:-1]
|
| 329 |
-
else: allow_disk = []
|
| 330 |
-
except:
|
| 331 |
-
allow_disk = []
|
| 332 |
-
|
| 333 |
-
try:
|
| 334 |
-
for row in list(csv.DictReader(open(csv_path, newline='', encoding='utf-8'))):
|
| 335 |
-
filename = row['Filename']
|
| 336 |
-
url = None
|
| 337 |
-
|
| 338 |
-
for value in row.values():
|
| 339 |
-
if isinstance(value, str) and "huggingface" in value:
|
| 340 |
-
url = value
|
| 341 |
-
break
|
| 342 |
-
|
| 343 |
-
if url: models[filename] = url
|
| 344 |
-
except:
|
| 345 |
-
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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NoCrypt/miku",
|
| 10 |
-
"gstaff/xkcd",
|
| 11 |
-
"JohnSmith9982/small_and_pretty",
|
| 12 |
-
"ParityError/Interstellar",
|
| 13 |
-
"earneleh/paris",
|
| 14 |
-
"shivi/calm_seafoam",
|
| 15 |
-
"Hev832/Applio",
|
| 16 |
-
"YTheme/Minecraft",
|
| 17 |
-
"gstaff/sketch",
|
| 18 |
-
"SebastianBravo/simci_css",
|
| 19 |
-
"allenai/gradio-theme",
|
| 20 |
-
"Nymbo/Nymbo_Theme_5",
|
| 21 |
-
"lone17/kotaemon",
|
| 22 |
-
"Zarkel/IBM_Carbon_Theme",
|
| 23 |
-
"SherlockRamos/Feliz",
|
| 24 |
-
"freddyaboulton/dracula_revamped",
|
| 25 |
-
"freddyaboulton/bad-theme-space",
|
| 26 |
-
"gradio/dracula_revamped",
|
| 27 |
-
"abidlabs/dracula_revamped",
|
| 28 |
-
"gradio/dracula_test",
|
| 29 |
-
"gradio/seafoam",
|
| 30 |
-
"gradio/glass",
|
| 31 |
-
"gradio/monochrome",
|
| 32 |
-
"gradio/soft",
|
| 33 |
-
"gradio/default",
|
| 34 |
-
"gradio/base",
|
| 35 |
-
"abidlabs/pakistan",
|
| 36 |
-
"dawood/microsoft_windows",
|
| 37 |
-
"ysharma/steampunk",
|
| 38 |
-
"ysharma/huggingface",
|
| 39 |
-
"abidlabs/Lime",
|
| 40 |
-
"freddyaboulton/this-theme-does-not-exist-2",
|
| 41 |
-
"aliabid94/new-theme",
|
| 42 |
-
"aliabid94/test2",
|
| 43 |
-
"aliabid94/test3",
|
| 44 |
-
"aliabid94/test4",
|
| 45 |
-
"abidlabs/banana",
|
| 46 |
-
"freddyaboulton/test-blue",
|
| 47 |
-
"gstaff/whiteboard",
|
| 48 |
-
"ysharma/llamas",
|
| 49 |
-
"abidlabs/font-test",
|
| 50 |
-
"YenLai/Superhuman",
|
| 51 |
-
"bethecloud/storj_theme",
|
| 52 |
-
"sudeepshouche/minimalist",
|
| 53 |
-
"knotdgaf/gradiotest",
|
| 54 |
-
"ParityError/Anime",
|
| 55 |
-
"Ajaxon6255/Emerald_Isle",
|
| 56 |
-
"ParityError/LimeFace",
|
| 57 |
-
"finlaymacklon/smooth_slate",
|
| 58 |
-
"finlaymacklon/boxy_violet",
|
| 59 |
-
"derekzen/stardust",
|
| 60 |
-
"EveryPizza/Cartoony-Gradio-Theme",
|
| 61 |
-
"Ifeanyi/Cyanister",
|
| 62 |
-
"Tshackelton/IBMPlex-DenseReadable",
|
| 63 |
-
"snehilsanyal/scikit-learn",
|
| 64 |
-
"Himhimhim/xkcd",
|
| 65 |
-
"nota-ai/theme",
|
| 66 |
-
"rawrsor1/Everforest",
|
| 67 |
-
"rottenlittlecreature/Moon_Goblin",
|
| 68 |
-
"abidlabs/test-yellow",
|
| 69 |
-
"abidlabs/test-yellow3",
|
| 70 |
-
"idspicQstitho/dracula_revamped",
|
| 71 |
-
"kfahn/AnimalPose",
|
| 72 |
-
"HaleyCH/HaleyCH_Theme",
|
| 73 |
-
"simulKitke/dracula_test",
|
| 74 |
-
"braintacles/CrimsonNight",
|
| 75 |
-
"wentaohe/whiteboardv2",
|
| 76 |
-
"reilnuud/polite",
|
| 77 |
-
"remilia/Ghostly",
|
| 78 |
-
"Franklisi/darkmode",
|
| 79 |
-
"coding-alt/soft",
|
| 80 |
-
"xiaobaiyuan/theme_land",
|
| 81 |
-
"step-3-profit/Midnight-Deep",
|
| 82 |
-
"xiaobaiyuan/theme_demo",
|
| 83 |
-
"Taithrah/Minimal",
|
| 84 |
-
"Insuz/SimpleIndigo",
|
| 85 |
-
"zkunn/Alipay_Gradio_theme",
|
| 86 |
-
"Insuz/Mocha",
|
| 87 |
-
"xiaobaiyuan/theme_brief",
|
| 88 |
-
"Ama434/434-base-Barlow",
|
| 89 |
-
"Ama434/def_barlow",
|
| 90 |
-
"Ama434/neutral-barlow",
|
| 91 |
-
"dawood/dracula_test",
|
| 92 |
-
"nuttea/Softblue",
|
| 93 |
-
"BlueDancer/Alien_Diffusion",
|
| 94 |
-
"naughtondale/monochrome",
|
| 95 |
-
"Dagfinn1962/standard",
|
| 96 |
-
"default"
|
| 97 |
-
],
|
| 98 |
-
"mdx_models": {
|
| 99 |
-
"Main_340": "UVR-MDX-NET_Main_340.onnx",
|
| 100 |
-
"Main_390": "UVR-MDX-NET_Main_390.onnx",
|
| 101 |
-
"Main_406": "UVR-MDX-NET_Main_406.onnx",
|
| 102 |
-
"Main_427": "UVR-MDX-NET_Main_427.onnx",
|
| 103 |
-
"Main_438": "UVR-MDX-NET_Main_438.onnx",
|
| 104 |
-
"Inst_full_292": "UVR-MDX-NET-Inst_full_292.onnx",
|
| 105 |
-
"Inst_HQ_1": "UVR-MDX-NET-Inst_HQ_1.onnx",
|
| 106 |
-
"Inst_HQ_2": "UVR-MDX-NET-Inst_HQ_2.onnx",
|
| 107 |
-
"Inst_HQ_3": "UVR-MDX-NET-Inst_HQ_3.onnx",
|
| 108 |
-
"Inst_HQ_4": "UVR-MDX-NET-Inst_HQ_4.onnx",
|
| 109 |
-
"Inst_HQ_5": "UVR-MDX-NET-Inst_HQ_5.onnx",
|
| 110 |
-
"Kim_Vocal_1": "Kim_Vocal_1.onnx",
|
| 111 |
-
"Kim_Vocal_2": "Kim_Vocal_2.onnx",
|
| 112 |
-
"Kim_Inst": "Kim_Inst.onnx",
|
| 113 |
-
"Inst_187_beta": "UVR-MDX-NET_Inst_187_beta.onnx",
|
| 114 |
-
"Inst_82_beta": "UVR-MDX-NET_Inst_82_beta.onnx",
|
| 115 |
-
"Inst_90_beta": "UVR-MDX-NET_Inst_90_beta.onnx",
|
| 116 |
-
"Voc_FT": "UVR-MDX-NET-Voc_FT.onnx",
|
| 117 |
-
"Crowd_HQ": "UVR-MDX-NET_Crowd_HQ_1.onnx",
|
| 118 |
-
"MDXNET_9482": "UVR_MDXNET_9482.onnx",
|
| 119 |
-
"Inst_1": "UVR-MDX-NET-Inst_1.onnx",
|
| 120 |
-
"Inst_2": "UVR-MDX-NET-Inst_2.onnx",
|
| 121 |
-
"Inst_3": "UVR-MDX-NET-Inst_3.onnx",
|
| 122 |
-
"MDXNET_1_9703": "UVR_MDXNET_1_9703.onnx",
|
| 123 |
-
"MDXNET_2_9682": "UVR_MDXNET_2_9682.onnx",
|
| 124 |
-
"MDXNET_3_9662": "UVR_MDXNET_3_9662.onnx",
|
| 125 |
-
"Inst_Main": "UVR-MDX-NET-Inst_Main.onnx",
|
| 126 |
-
"MDXNET_Main": "UVR_MDXNET_Main.onnx"
|
| 127 |
-
},
|
| 128 |
-
"demucs_models": {
|
| 129 |
-
"HT-Tuned": "htdemucs_ft.pth",
|
| 130 |
-
"HT-Normal": "htdemucs.pth",
|
| 131 |
-
"HD_MMI": "hdemucs_mmi.pth",
|
| 132 |
-
"HT_6S": "htdemucs_6s.pth"
|
| 133 |
-
},
|
| 134 |
-
"vr_models": {
|
| 135 |
-
"HP-1": "1_HP-UVR.pth",
|
| 136 |
-
"HP-2": "2_HP-UVR.pth",
|
| 137 |
-
"HP-Vocal-1": "3_HP-Vocal-UVR.pth",
|
| 138 |
-
"HP-Vocal-2": "4_HP-Vocal-UVR.pth",
|
| 139 |
-
"HP2-1": "7_HP2-UVR.pth",
|
| 140 |
-
"HP2-2": "8_HP2-UVR.pth",
|
| 141 |
-
"HP2-3": "9_HP2-UVR.pth",
|
| 142 |
-
"SP-2B-1": "10_SP-UVR-2B-32000-1.pth",
|
| 143 |
-
"SP-2B-2": "11_SP-UVR-2B-32000-2.pth",
|
| 144 |
-
"SP-3B-1": "12_SP-UVR-3B-44100.pth",
|
| 145 |
-
"SP-4B-1": "13_SP-UVR-4B-44100-1.pth",
|
| 146 |
-
"SP-4B-2": "14_SP-UVR-4B-44100-2.pth",
|
| 147 |
-
"SP-MID-1": "15_SP-UVR-MID-44100-1.pth",
|
| 148 |
-
"SP-MID-2": "16_SP-UVR-MID-44100-2.pth"
|
| 149 |
-
},
|
| 150 |
-
"karaoke_models": {
|
| 151 |
-
"MDX-Version-1": "UVR_MDXNET_KARA.onnx",
|
| 152 |
-
"MDX-Version-2": "UVR_MDXNET_KARA_2.onnx",
|
| 153 |
-
"VR-Version-1": "5_HP-Karaoke-UVR.pth",
|
| 154 |
-
"VR-Version-2": "6_HP-Karaoke-UVR.pth"
|
| 155 |
-
},
|
| 156 |
-
"reverb_models": {
|
| 157 |
-
"MDX-Reverb": "Reverb_HQ_By_FoxJoy.onnx",
|
| 158 |
-
"VR-Reverb": "UVR-DeEcho-DeReverb.pth",
|
| 159 |
-
"Echo-Aggressive": "UVR-De-Echo-Aggressive.pth",
|
| 160 |
-
"Echo-Normal": "UVR-De-Echo-Normal.pth"
|
| 161 |
-
},
|
| 162 |
-
"denoise_models": {
|
| 163 |
-
"Lite": "UVR-DeNoise-Lite.pth",
|
| 164 |
-
"Normal": "UVR-DeNoise.pth"
|
| 165 |
-
},
|
| 166 |
-
"edge_tts": [
|
| 167 |
-
"af-ZA-AdriNeural",
|
| 168 |
-
"af-ZA-WillemNeural",
|
| 169 |
-
"sq-AL-AnilaNeural",
|
| 170 |
-
"sq-AL-IlirNeural",
|
| 171 |
-
"am-ET-AmehaNeural",
|
| 172 |
-
"am-ET-MekdesNeural",
|
| 173 |
-
"ar-DZ-AminaNeural",
|
| 174 |
-
"ar-DZ-IsmaelNeural",
|
| 175 |
-
"ar-BH-AliNeural",
|
| 176 |
-
"ar-BH-LailaNeural",
|
| 177 |
-
"ar-EG-SalmaNeural",
|
| 178 |
-
"ar-EG-ShakirNeural",
|
| 179 |
-
"ar-IQ-BasselNeural",
|
| 180 |
-
"ar-IQ-RanaNeural",
|
| 181 |
-
"ar-JO-SanaNeural",
|
| 182 |
-
"ar-JO-TaimNeural",
|
| 183 |
-
"ar-KW-FahedNeural",
|
| 184 |
-
"ar-KW-NouraNeural",
|
| 185 |
-
"ar-LB-LaylaNeural",
|
| 186 |
-
"ar-LB-RamiNeural",
|
| 187 |
-
"ar-LY-ImanNeural",
|
| 188 |
-
"ar-LY-OmarNeural",
|
| 189 |
-
"ar-MA-JamalNeural",
|
| 190 |
-
"ar-MA-MounaNeural",
|
| 191 |
-
"ar-OM-AbdullahNeural",
|
| 192 |
-
"ar-OM-AyshaNeural",
|
| 193 |
-
"ar-QA-AmalNeural",
|
| 194 |
-
"ar-QA-MoazNeural",
|
| 195 |
-
"ar-SA-HamedNeural",
|
| 196 |
-
"ar-SA-ZariyahNeural",
|
| 197 |
-
"ar-SY-AmanyNeural",
|
| 198 |
-
"ar-SY-LaithNeural",
|
| 199 |
-
"ar-TN-HediNeural",
|
| 200 |
-
"ar-TN-ReemNeural",
|
| 201 |
-
"ar-AE-FatimaNeural",
|
| 202 |
-
"ar-AE-HamdanNeural",
|
| 203 |
-
"ar-YE-MaryamNeural",
|
| 204 |
-
"ar-YE-SalehNeural",
|
| 205 |
-
"az-AZ-BabekNeural",
|
| 206 |
-
"az-AZ-BanuNeural",
|
| 207 |
-
"bn-BD-NabanitaNeural",
|
| 208 |
-
"bn-BD-PradeepNeural",
|
| 209 |
-
"bn-IN-BashkarNeural",
|
| 210 |
-
"bn-IN-TanishaaNeural",
|
| 211 |
-
"bs-BA-GoranNeural",
|
| 212 |
-
"bs-BA-VesnaNeural",
|
| 213 |
-
"bg-BG-BorislavNeural",
|
| 214 |
-
"bg-BG-KalinaNeural",
|
| 215 |
-
"my-MM-NilarNeural",
|
| 216 |
-
"my-MM-ThihaNeural",
|
| 217 |
-
"ca-ES-EnricNeural",
|
| 218 |
-
"ca-ES-JoanaNeural",
|
| 219 |
-
"zh-HK-HiuGaaiNeural",
|
| 220 |
-
"zh-HK-HiuMaanNeural",
|
| 221 |
-
"zh-HK-WanLungNeural",
|
| 222 |
-
"zh-CN-XiaoxiaoNeural",
|
| 223 |
-
"zh-CN-XiaoyiNeural",
|
| 224 |
-
"zh-CN-YunjianNeural",
|
| 225 |
-
"zh-CN-YunxiNeural",
|
| 226 |
-
"zh-CN-YunxiaNeural",
|
| 227 |
-
"zh-CN-YunyangNeural",
|
| 228 |
-
"zh-CN-liaoning-XiaobeiNeural",
|
| 229 |
-
"zh-TW-HsiaoChenNeural",
|
| 230 |
-
"zh-TW-YunJheNeural",
|
| 231 |
-
"zh-TW-HsiaoYuNeural",
|
| 232 |
-
"zh-CN-shaanxi-XiaoniNeural",
|
| 233 |
-
"hr-HR-GabrijelaNeural",
|
| 234 |
-
"hr-HR-SreckoNeural",
|
| 235 |
-
"cs-CZ-AntoninNeural",
|
| 236 |
-
"cs-CZ-VlastaNeural",
|
| 237 |
-
"da-DK-ChristelNeural",
|
| 238 |
-
"da-DK-JeppeNeural",
|
| 239 |
-
"nl-BE-ArnaudNeural",
|
| 240 |
-
"nl-BE-DenaNeural",
|
| 241 |
-
"nl-NL-ColetteNeural",
|
| 242 |
-
"nl-NL-FennaNeural",
|
| 243 |
-
"nl-NL-MaartenNeural",
|
| 244 |
-
"en-AU-NatashaNeural",
|
| 245 |
-
"en-AU-WilliamNeural",
|
| 246 |
-
"en-CA-ClaraNeural",
|
| 247 |
-
"en-CA-LiamNeural",
|
| 248 |
-
"en-HK-SamNeural",
|
| 249 |
-
"en-HK-YanNeural",
|
| 250 |
-
"en-IN-NeerjaExpressiveNeural",
|
| 251 |
-
"en-IN-NeerjaNeural",
|
| 252 |
-
"en-IN-PrabhatNeural",
|
| 253 |
-
"en-IE-ConnorNeural",
|
| 254 |
-
"en-IE-EmilyNeural",
|
| 255 |
-
"en-KE-AsiliaNeural",
|
| 256 |
-
"en-KE-ChilembaNeural",
|
| 257 |
-
"en-NZ-MitchellNeural",
|
| 258 |
-
"en-NZ-MollyNeural",
|
| 259 |
-
"en-NG-AbeoNeural",
|
| 260 |
-
"en-NG-EzinneNeural",
|
| 261 |
-
"en-PH-JamesNeural",
|
| 262 |
-
"en-PH-RosaNeural",
|
| 263 |
-
"en-SG-LunaNeural",
|
| 264 |
-
"en-SG-WayneNeural",
|
| 265 |
-
"en-ZA-LeahNeural",
|
| 266 |
-
"en-ZA-LukeNeural",
|
| 267 |
-
"en-TZ-ElimuNeural",
|
| 268 |
-
"en-TZ-ImaniNeural",
|
| 269 |
-
"en-GB-LibbyNeural",
|
| 270 |
-
"en-GB-MaisieNeural",
|
| 271 |
-
"en-GB-RyanNeural",
|
| 272 |
-
"en-GB-SoniaNeural",
|
| 273 |
-
"en-GB-ThomasNeural",
|
| 274 |
-
"en-US-AvaMultilingualNeural",
|
| 275 |
-
"en-US-AndrewMultilingualNeural",
|
| 276 |
-
"en-US-EmmaMultilingualNeural",
|
| 277 |
-
"en-US-BrianMultilingualNeural",
|
| 278 |
-
"en-US-AvaNeural",
|
| 279 |
-
"en-US-AndrewNeural",
|
| 280 |
-
"en-US-EmmaNeural",
|
| 281 |
-
"en-US-BrianNeural",
|
| 282 |
-
"en-US-AnaNeural",
|
| 283 |
-
"en-US-AriaNeural",
|
| 284 |
-
"en-US-ChristopherNeural",
|
| 285 |
-
"en-US-EricNeural",
|
| 286 |
-
"en-US-GuyNeural",
|
| 287 |
-
"en-US-JennyNeural",
|
| 288 |
-
"en-US-MichelleNeural",
|
| 289 |
-
"en-US-RogerNeural",
|
| 290 |
-
"en-US-SteffanNeural",
|
| 291 |
-
"et-EE-AnuNeural",
|
| 292 |
-
"et-EE-KertNeural",
|
| 293 |
-
"fil-PH-AngeloNeural",
|
| 294 |
-
"fil-PH-BlessicaNeural",
|
| 295 |
-
"fi-FI-HarriNeural",
|
| 296 |
-
"fi-FI-NooraNeural",
|
| 297 |
-
"fr-BE-CharlineNeural",
|
| 298 |
-
"fr-BE-GerardNeural",
|
| 299 |
-
"fr-CA-ThierryNeural",
|
| 300 |
-
"fr-CA-AntoineNeural",
|
| 301 |
-
"fr-CA-JeanNeural",
|
| 302 |
-
"fr-CA-SylvieNeural",
|
| 303 |
-
"fr-FR-VivienneMultilingualNeural",
|
| 304 |
-
"fr-FR-RemyMultilingualNeural",
|
| 305 |
-
"fr-FR-DeniseNeural",
|
| 306 |
-
"fr-FR-EloiseNeural",
|
| 307 |
-
"fr-FR-HenriNeural",
|
| 308 |
-
"fr-CH-ArianeNeural",
|
| 309 |
-
"fr-CH-FabriceNeural",
|
| 310 |
-
"gl-ES-RoiNeural",
|
| 311 |
-
"gl-ES-SabelaNeural",
|
| 312 |
-
"ka-GE-EkaNeural",
|
| 313 |
-
"ka-GE-GiorgiNeural",
|
| 314 |
-
"de-AT-IngridNeural",
|
| 315 |
-
"de-AT-JonasNeural",
|
| 316 |
-
"de-DE-SeraphinaMultilingualNeural",
|
| 317 |
-
"de-DE-FlorianMultilingualNeural",
|
| 318 |
-
"de-DE-AmalaNeural",
|
| 319 |
-
"de-DE-ConradNeural",
|
| 320 |
-
"de-DE-KatjaNeural",
|
| 321 |
-
"de-DE-KillianNeural",
|
| 322 |
-
"de-CH-JanNeural",
|
| 323 |
-
"de-CH-LeniNeural",
|
| 324 |
-
"el-GR-AthinaNeural",
|
| 325 |
-
"el-GR-NestorasNeural",
|
| 326 |
-
"gu-IN-DhwaniNeural",
|
| 327 |
-
"gu-IN-NiranjanNeural",
|
| 328 |
-
"he-IL-AvriNeural",
|
| 329 |
-
"he-IL-HilaNeural",
|
| 330 |
-
"hi-IN-MadhurNeural",
|
| 331 |
-
"hi-IN-SwaraNeural",
|
| 332 |
-
"hu-HU-NoemiNeural",
|
| 333 |
-
"hu-HU-TamasNeural",
|
| 334 |
-
"is-IS-GudrunNeural",
|
| 335 |
-
"is-IS-GunnarNeural",
|
| 336 |
-
"id-ID-ArdiNeural",
|
| 337 |
-
"id-ID-GadisNeural",
|
| 338 |
-
"ga-IE-ColmNeural",
|
| 339 |
-
"ga-IE-OrlaNeural",
|
| 340 |
-
"it-IT-GiuseppeNeural",
|
| 341 |
-
"it-IT-DiegoNeural",
|
| 342 |
-
"it-IT-ElsaNeural",
|
| 343 |
-
"it-IT-IsabellaNeural",
|
| 344 |
-
"ja-JP-KeitaNeural",
|
| 345 |
-
"ja-JP-NanamiNeural",
|
| 346 |
-
"jv-ID-DimasNeural",
|
| 347 |
-
"jv-ID-SitiNeural",
|
| 348 |
-
"kn-IN-GaganNeural",
|
| 349 |
-
"kn-IN-SapnaNeural",
|
| 350 |
-
"kk-KZ-AigulNeural",
|
| 351 |
-
"kk-KZ-DauletNeural",
|
| 352 |
-
"km-KH-PisethNeural",
|
| 353 |
-
"km-KH-SreymomNeural",
|
| 354 |
-
"ko-KR-HyunsuNeural",
|
| 355 |
-
"ko-KR-InJoonNeural",
|
| 356 |
-
"ko-KR-SunHiNeural",
|
| 357 |
-
"lo-LA-ChanthavongNeural",
|
| 358 |
-
"lo-LA-KeomanyNeural",
|
| 359 |
-
"lv-LV-EveritaNeural",
|
| 360 |
-
"lv-LV-NilsNeural",
|
| 361 |
-
"lt-LT-LeonasNeural",
|
| 362 |
-
"lt-LT-OnaNeural",
|
| 363 |
-
"mk-MK-AleksandarNeural",
|
| 364 |
-
"mk-MK-MarijaNeural",
|
| 365 |
-
"ms-MY-OsmanNeural",
|
| 366 |
-
"ms-MY-YasminNeural",
|
| 367 |
-
"ml-IN-MidhunNeural",
|
| 368 |
-
"ml-IN-SobhanaNeural",
|
| 369 |
-
"mt-MT-GraceNeural",
|
| 370 |
-
"mt-MT-JosephNeural",
|
| 371 |
-
"mr-IN-AarohiNeural",
|
| 372 |
-
"mr-IN-ManoharNeural",
|
| 373 |
-
"mn-MN-BataaNeural",
|
| 374 |
-
"mn-MN-YesuiNeural",
|
| 375 |
-
"ne-NP-HemkalaNeural",
|
| 376 |
-
"ne-NP-SagarNeural",
|
| 377 |
-
"nb-NO-FinnNeural",
|
| 378 |
-
"nb-NO-PernilleNeural",
|
| 379 |
-
"ps-AF-GulNawazNeural",
|
| 380 |
-
"ps-AF-LatifaNeural",
|
| 381 |
-
"fa-IR-DilaraNeural",
|
| 382 |
-
"fa-IR-FaridNeural",
|
| 383 |
-
"pl-PL-MarekNeural",
|
| 384 |
-
"pl-PL-ZofiaNeural",
|
| 385 |
-
"pt-BR-ThalitaNeural",
|
| 386 |
-
"pt-BR-AntonioNeural",
|
| 387 |
-
"pt-BR-FranciscaNeural",
|
| 388 |
-
"pt-PT-DuarteNeural",
|
| 389 |
-
"pt-PT-RaquelNeural",
|
| 390 |
-
"ro-RO-AlinaNeural",
|
| 391 |
-
"ro-RO-EmilNeural",
|
| 392 |
-
"ru-RU-DmitryNeural",
|
| 393 |
-
"ru-RU-SvetlanaNeural",
|
| 394 |
-
"sr-RS-NicholasNeural",
|
| 395 |
-
"sr-RS-SophieNeural",
|
| 396 |
-
"si-LK-SameeraNeural",
|
| 397 |
-
"si-LK-ThiliniNeural",
|
| 398 |
-
"sk-SK-LukasNeural",
|
| 399 |
-
"sk-SK-ViktoriaNeural",
|
| 400 |
-
"sl-SI-PetraNeural",
|
| 401 |
-
"sl-SI-RokNeural",
|
| 402 |
-
"so-SO-MuuseNeural",
|
| 403 |
-
"so-SO-UbaxNeural",
|
| 404 |
-
"es-AR-ElenaNeural",
|
| 405 |
-
"es-AR-TomasNeural",
|
| 406 |
-
"es-BO-MarceloNeural",
|
| 407 |
-
"es-BO-SofiaNeural",
|
| 408 |
-
"es-CL-CatalinaNeural",
|
| 409 |
-
"es-CL-LorenzoNeural",
|
| 410 |
-
"es-ES-XimenaNeural",
|
| 411 |
-
"es-CO-GonzaloNeural",
|
| 412 |
-
"es-CO-SalomeNeural",
|
| 413 |
-
"es-CR-JuanNeural",
|
| 414 |
-
"es-CR-MariaNeural",
|
| 415 |
-
"es-CU-BelkysNeural",
|
| 416 |
-
"es-CU-ManuelNeural",
|
| 417 |
-
"es-DO-EmilioNeural",
|
| 418 |
-
"es-DO-RamonaNeural",
|
| 419 |
-
"es-EC-AndreaNeural",
|
| 420 |
-
"es-EC-LuisNeural",
|
| 421 |
-
"es-SV-LorenaNeural",
|
| 422 |
-
"es-SV-RodrigoNeural",
|
| 423 |
-
"es-GQ-JavierNeural",
|
| 424 |
-
"es-GQ-TeresaNeural",
|
| 425 |
-
"es-GT-AndresNeural",
|
| 426 |
-
"es-GT-MartaNeural",
|
| 427 |
-
"es-HN-CarlosNeural",
|
| 428 |
-
"es-HN-KarlaNeural",
|
| 429 |
-
"es-MX-DaliaNeural",
|
| 430 |
-
"es-MX-JorgeNeural",
|
| 431 |
-
"es-NI-FedericoNeural",
|
| 432 |
-
"es-NI-YolandaNeural",
|
| 433 |
-
"es-PA-MargaritaNeural",
|
| 434 |
-
"es-PA-RobertoNeural",
|
| 435 |
-
"es-PY-MarioNeural",
|
| 436 |
-
"es-PY-TaniaNeural",
|
| 437 |
-
"es-PE-AlexNeural",
|
| 438 |
-
"es-PE-CamilaNeural",
|
| 439 |
-
"es-PR-KarinaNeural",
|
| 440 |
-
"es-PR-VictorNeural",
|
| 441 |
-
"es-ES-AlvaroNeural",
|
| 442 |
-
"es-ES-ElviraNeural",
|
| 443 |
-
"es-US-AlonsoNeural",
|
| 444 |
-
"es-US-PalomaNeural",
|
| 445 |
-
"es-UY-MateoNeural",
|
| 446 |
-
"es-UY-ValentinaNeural",
|
| 447 |
-
"es-VE-PaolaNeural",
|
| 448 |
-
"es-VE-SebastianNeural",
|
| 449 |
-
"su-ID-JajangNeural",
|
| 450 |
-
"su-ID-TutiNeural",
|
| 451 |
-
"sw-KE-RafikiNeural",
|
| 452 |
-
"sw-KE-ZuriNeural",
|
| 453 |
-
"sw-TZ-DaudiNeural",
|
| 454 |
-
"sw-TZ-RehemaNeural",
|
| 455 |
-
"sv-SE-MattiasNeural",
|
| 456 |
-
"sv-SE-SofieNeural",
|
| 457 |
-
"ta-IN-PallaviNeural",
|
| 458 |
-
"ta-IN-ValluvarNeural",
|
| 459 |
-
"ta-MY-KaniNeural",
|
| 460 |
-
"ta-MY-SuryaNeural",
|
| 461 |
-
"ta-SG-AnbuNeural",
|
| 462 |
-
"ta-SG-VenbaNeural",
|
| 463 |
-
"ta-LK-KumarNeural",
|
| 464 |
-
"ta-LK-SaranyaNeural",
|
| 465 |
-
"te-IN-MohanNeural",
|
| 466 |
-
"te-IN-ShrutiNeural",
|
| 467 |
-
"th-TH-NiwatNeural",
|
| 468 |
-
"th-TH-PremwadeeNeural",
|
| 469 |
-
"tr-TR-AhmetNeural",
|
| 470 |
-
"tr-TR-EmelNeural",
|
| 471 |
-
"uk-UA-OstapNeural",
|
| 472 |
-
"uk-UA-PolinaNeural",
|
| 473 |
-
"ur-IN-GulNeural",
|
| 474 |
-
"ur-IN-SalmanNeural",
|
| 475 |
-
"ur-PK-AsadNeural",
|
| 476 |
-
"ur-PK-UzmaNeural",
|
| 477 |
-
"uz-UZ-MadinaNeural",
|
| 478 |
-
"uz-UZ-SardorNeural",
|
| 479 |
-
"vi-VN-HoaiMyNeural",
|
| 480 |
-
"vi-VN-NamMinhNeural",
|
| 481 |
-
"cy-GB-AledNeural",
|
| 482 |
-
"cy-GB-NiaNeural",
|
| 483 |
-
"zu-ZA-ThandoNeural",
|
| 484 |
-
"zu-ZA-ThembaNeural"
|
| 485 |
-
],
|
| 486 |
-
"google_tts_voice": [
|
| 487 |
-
"af",
|
| 488 |
-
"am",
|
| 489 |
-
"ar",
|
| 490 |
-
"bg",
|
| 491 |
-
"bn",
|
| 492 |
-
"bs",
|
| 493 |
-
"ca",
|
| 494 |
-
"cs",
|
| 495 |
-
"cy",
|
| 496 |
-
"da",
|
| 497 |
-
"de",
|
| 498 |
-
"el",
|
| 499 |
-
"en",
|
| 500 |
-
"es",
|
| 501 |
-
"et",
|
| 502 |
-
"eu",
|
| 503 |
-
"fi",
|
| 504 |
-
"fr",
|
| 505 |
-
"fr-CA",
|
| 506 |
-
"gl",
|
| 507 |
-
"gu",
|
| 508 |
-
"ha",
|
| 509 |
-
"hi",
|
| 510 |
-
"hr",
|
| 511 |
-
"hu",
|
| 512 |
-
"id",
|
| 513 |
-
"is",
|
| 514 |
-
"it",
|
| 515 |
-
"iw",
|
| 516 |
-
"ja",
|
| 517 |
-
"jw",
|
| 518 |
-
"km",
|
| 519 |
-
"kn",
|
| 520 |
-
"ko",
|
| 521 |
-
"la",
|
| 522 |
-
"lt",
|
| 523 |
-
"lv",
|
| 524 |
-
"ml",
|
| 525 |
-
"mr",
|
| 526 |
-
"ms",
|
| 527 |
-
"my",
|
| 528 |
-
"ne",
|
| 529 |
-
"nl",
|
| 530 |
-
"no",
|
| 531 |
-
"pa",
|
| 532 |
-
"pl",
|
| 533 |
-
"pt",
|
| 534 |
-
"pt-PT",
|
| 535 |
-
"ro",
|
| 536 |
-
"ru",
|
| 537 |
-
"si",
|
| 538 |
-
"sk",
|
| 539 |
-
"sq",
|
| 540 |
-
"sr",
|
| 541 |
-
"su",
|
| 542 |
-
"sv",
|
| 543 |
-
"sw",
|
| 544 |
-
"ta",
|
| 545 |
-
"te",
|
| 546 |
-
"th",
|
| 547 |
-
"tl",
|
| 548 |
-
"tr",
|
| 549 |
-
"uk",
|
| 550 |
-
"ur",
|
| 551 |
-
"vi",
|
| 552 |
-
"yue",
|
| 553 |
-
"zh-CN",
|
| 554 |
-
"zh-TW",
|
| 555 |
-
"zh"
|
| 556 |
-
],
|
| 557 |
-
"whisper_languages": [
|
| 558 |
-
"en",
|
| 559 |
-
"zh",
|
| 560 |
-
"de",
|
| 561 |
-
"es",
|
| 562 |
-
"ru",
|
| 563 |
-
"ko",
|
| 564 |
-
"fr",
|
| 565 |
-
"ja",
|
| 566 |
-
"pt",
|
| 567 |
-
"tr",
|
| 568 |
-
"pl",
|
| 569 |
-
"ca",
|
| 570 |
-
"nl",
|
| 571 |
-
"ar",
|
| 572 |
-
"sv",
|
| 573 |
-
"it",
|
| 574 |
-
"id",
|
| 575 |
-
"hi",
|
| 576 |
-
"fi",
|
| 577 |
-
"vi",
|
| 578 |
-
"he",
|
| 579 |
-
"uk",
|
| 580 |
-
"el",
|
| 581 |
-
"ms",
|
| 582 |
-
"cs",
|
| 583 |
-
"ro",
|
| 584 |
-
"da",
|
| 585 |
-
"hu",
|
| 586 |
-
"ta",
|
| 587 |
-
"no",
|
| 588 |
-
"th",
|
| 589 |
-
"ur",
|
| 590 |
-
"hr",
|
| 591 |
-
"bg",
|
| 592 |
-
"lt",
|
| 593 |
-
"la",
|
| 594 |
-
"mi",
|
| 595 |
-
"ml",
|
| 596 |
-
"cy",
|
| 597 |
-
"sk",
|
| 598 |
-
"te",
|
| 599 |
-
"fa",
|
| 600 |
-
"lv",
|
| 601 |
-
"bn",
|
| 602 |
-
"sr",
|
| 603 |
-
"az",
|
| 604 |
-
"sl",
|
| 605 |
-
"kn",
|
| 606 |
-
"et",
|
| 607 |
-
"mk",
|
| 608 |
-
"br",
|
| 609 |
-
"eu",
|
| 610 |
-
"is",
|
| 611 |
-
"hy",
|
| 612 |
-
"ne",
|
| 613 |
-
"mn",
|
| 614 |
-
"bs",
|
| 615 |
-
"kk",
|
| 616 |
-
"sq",
|
| 617 |
-
"sw",
|
| 618 |
-
"gl",
|
| 619 |
-
"mr",
|
| 620 |
-
"pa",
|
| 621 |
-
"si",
|
| 622 |
-
"km",
|
| 623 |
-
"sn",
|
| 624 |
-
"yo",
|
| 625 |
-
"so",
|
| 626 |
-
"af",
|
| 627 |
-
"oc",
|
| 628 |
-
"ka",
|
| 629 |
-
"be",
|
| 630 |
-
"tg",
|
| 631 |
-
"sd",
|
| 632 |
-
"gu",
|
| 633 |
-
"am",
|
| 634 |
-
"yi",
|
| 635 |
-
"lo",
|
| 636 |
-
"uz",
|
| 637 |
-
"fo",
|
| 638 |
-
"ht",
|
| 639 |
-
"ps",
|
| 640 |
-
"tk",
|
| 641 |
-
"nn",
|
| 642 |
-
"mt",
|
| 643 |
-
"sa",
|
| 644 |
-
"lb",
|
| 645 |
-
"my",
|
| 646 |
-
"bo",
|
| 647 |
-
"tl",
|
| 648 |
-
"mg",
|
| 649 |
-
"as",
|
| 650 |
-
"tt",
|
| 651 |
-
"haw",
|
| 652 |
-
"ln",
|
| 653 |
-
"ha",
|
| 654 |
-
"ba",
|
| 655 |
-
"jw",
|
| 656 |
-
"su",
|
| 657 |
-
"yue"
|
| 658 |
-
],
|
| 659 |
-
"fp16": false,
|
| 660 |
-
"editing_tab": true,
|
| 661 |
-
"inference_tab": true,
|
| 662 |
-
"create_and_training_tab": true,
|
| 663 |
-
"extra_tab": true,
|
| 664 |
-
"separator_tab": true,
|
| 665 |
-
"convert_tab": true,
|
| 666 |
-
"convert_with_vad_tab": true,
|
| 667 |
-
"tts_tab": true,
|
| 668 |
-
"effects_tab": true,
|
| 669 |
-
"quirk_tab": true,
|
| 670 |
-
"create_dataset_tab": true,
|
| 671 |
-
"training_tab": true,
|
| 672 |
-
"fushion_tab": true,
|
| 673 |
-
"read_tab": true,
|
| 674 |
-
"onnx_tab": true,
|
| 675 |
-
"svc_tab": true,
|
| 676 |
-
"downloads_tab": true,
|
| 677 |
-
"f0_extractor_tab": true,
|
| 678 |
-
"settings_tab": true,
|
| 679 |
-
"create_srt_tab": true,
|
| 680 |
-
"realtime_tab": true,
|
| 681 |
-
"create_reference_tab": true,
|
| 682 |
-
"analyzer_tab": true,
|
| 683 |
-
"font": "https://fonts.googleapis.com/css2?family=Saira&display=swap",
|
| 684 |
-
"app_port": 7860,
|
| 685 |
-
"tensorboard_port": 6870,
|
| 686 |
-
"num_of_restart": 5,
|
| 687 |
-
"server_name": "0.0.0.0",
|
| 688 |
-
"app_show_error": true,
|
| 689 |
-
"delete_exists_file": false,
|
| 690 |
-
"audio_effects_path": "main/inference/audio_effects.py",
|
| 691 |
-
"convert_path": "main/inference/conversion/convert.py",
|
| 692 |
-
"separate_path": "main/inference/separate_music.py",
|
| 693 |
-
"create_dataset_path": "main/inference/create_dataset.py",
|
| 694 |
-
"preprocess_path": "main/inference/preprocess/preprocess.py",
|
| 695 |
-
"extract_path": "main/inference/extracting/extract.py",
|
| 696 |
-
"create_index_path": "main/inference/create_index.py",
|
| 697 |
-
"train_path": "main/inference/training/train.py",
|
| 698 |
-
"create_reference_path": "main/inference/create_reference.py",
|
| 699 |
-
"ico_path": "assets/ico.png",
|
| 700 |
-
"csv_path": "assets/spreadsheet.csv",
|
| 701 |
-
"weights_path": "assets/weights",
|
| 702 |
-
"logs_path": "assets/logs",
|
| 703 |
-
"binary_path": "assets/binary",
|
| 704 |
-
"f0_path": "assets/f0",
|
| 705 |
-
"language_path": "assets/languages",
|
| 706 |
-
"presets_path": "assets/presets",
|
| 707 |
-
"embedders_path": "assets/models/embedders",
|
| 708 |
-
"predictors_path": "assets/models/predictors",
|
| 709 |
-
"pretrained_custom_path": "assets/models/pretrained_custom",
|
| 710 |
-
"pretrained_v1_path": "assets/models/pretrained_v1",
|
| 711 |
-
"pretrained_v2_path": "assets/models/pretrained_v2",
|
| 712 |
-
"speaker_diarization_path": "assets/models/speaker_diarization",
|
| 713 |
-
"uvr5_path": "assets/models/uvr5",
|
| 714 |
-
"audios_path": "audios",
|
| 715 |
-
"reference_path": "assets/logs/reference",
|
| 716 |
-
"demucs_segments_enable": true,
|
| 717 |
-
"demucs_cpu_mode": false,
|
| 718 |
-
"limit_f0": 12,
|
| 719 |
-
"debug_mode": true,
|
| 720 |
-
"pretrain_strict": true,
|
| 721 |
-
"cpu_mode": false,
|
| 722 |
-
"brain": false,
|
| 723 |
-
"tf32": false,
|
| 724 |
-
"discord_presence": true,
|
| 725 |
-
"f0_min": 50,
|
| 726 |
-
"f0_max": 1100,
|
| 727 |
-
"turn_on_resize_f0_for_all": false,
|
| 728 |
-
"allow_fp16_all_backend": false,
|
| 729 |
-
"asio_enabled": false,
|
| 730 |
-
"ffmpeg_download": true,
|
| 731 |
-
"compile_all": false,
|
| 732 |
-
"compile_mode": null,
|
| 733 |
-
"compile_cache_dir": "assets/cache",
|
| 734 |
-
"check_data": false,
|
| 735 |
-
"tensorrt": false,
|
| 736 |
-
"faiss_cpu": false,
|
| 737 |
-
"allow_unsafe_fairseq": false,
|
| 738 |
-
"del4stem": true,
|
| 739 |
-
"enable_rmvpe_chunk": false,
|
| 740 |
-
"rmvpe_chunk_size": 8000
|
| 741 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/configs/config.py
DELETED
|
@@ -1,192 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import json
|
| 4 |
-
import torch
|
| 5 |
-
import onnxruntime
|
| 6 |
-
|
| 7 |
-
sys.path.append(os.getcwd())
|
| 8 |
-
|
| 9 |
-
from main.library.backends import directml, opencl, xpu, zluda
|
| 10 |
-
|
| 11 |
-
version_config_paths = [
|
| 12 |
-
os.path.join(version, size)
|
| 13 |
-
for version in ["v1", "v2"]
|
| 14 |
-
for size in ["24000.json", "32000.json", "40000.json", "44100.json", "48000.json"]
|
| 15 |
-
]
|
| 16 |
-
|
| 17 |
-
def singleton(cls):
|
| 18 |
-
instances = {}
|
| 19 |
-
|
| 20 |
-
def get_instance(*args, **kwargs):
|
| 21 |
-
if cls not in instances: instances[cls] = cls(*args, **kwargs)
|
| 22 |
-
return instances[cls]
|
| 23 |
-
|
| 24 |
-
return get_instance
|
| 25 |
-
|
| 26 |
-
@singleton
|
| 27 |
-
class Config:
|
| 28 |
-
def __init__(self):
|
| 29 |
-
self.configs_path = os.path.join("main", "configs", "config.json")
|
| 30 |
-
self.configs = json.load(open(self.configs_path, "r"))
|
| 31 |
-
|
| 32 |
-
self.cpu_mode = self.configs.get("cpu_mode", False)
|
| 33 |
-
self.cuda_available = torch.cuda.is_available()
|
| 34 |
-
self.is_zluda = self.cuda_available and torch.cuda.get_device_name().endswith("[ZLUDA]")
|
| 35 |
-
self.hip_version = torch.version.hip if hasattr(torch.version, "hip") else None
|
| 36 |
-
if self.is_zluda: zluda.init_zluda()
|
| 37 |
-
|
| 38 |
-
self.debug_mode = self.configs.get("debug_mode", False)
|
| 39 |
-
self.json_config = self.load_config_json()
|
| 40 |
-
self.translations = self.multi_language()
|
| 41 |
-
|
| 42 |
-
self.gpu_mem = None
|
| 43 |
-
self.per_preprocess = 3.7
|
| 44 |
-
self.device = self.get_default_device()
|
| 45 |
-
self.tensorrt = self.configs.get("tensorrt", False)
|
| 46 |
-
self.providers = self.get_providers()
|
| 47 |
-
|
| 48 |
-
self.cuda_tf32 = self.cuda_available and hasattr(torch.cuda, "is_tf32_supported") and torch.cuda.is_tf32_supported()
|
| 49 |
-
self.cuda_bf16 = self.cuda_available and hasattr(torch.cuda, "is_bf16_supported") and torch.cuda.is_bf16_supported()
|
| 50 |
-
self.xpu_fp16 = hasattr(torch, "xpu") and torch.xpu.is_available() and hasattr(torch.xpu, "is_bf16_supported") and torch.xpu.is_bf16_supported()
|
| 51 |
-
|
| 52 |
-
self.tf32_support = self.device.startswith("cuda") and self.cuda_tf32
|
| 53 |
-
self.bf16_support = self.device.startswith(("cuda", "xpu")) and self.cuda_bf16 or self.xpu_fp16
|
| 54 |
-
|
| 55 |
-
self.brain = self.configs.get("brain", False) and self.bf16_support and not self.cpu_mode
|
| 56 |
-
self.tf32 = self.configs.get("tf32", False) and self.tf32_support and not self.is_zluda and not self.cpu_mode
|
| 57 |
-
|
| 58 |
-
self.is_half = self.is_fp16()
|
| 59 |
-
self.compile_all = self.device.startswith("cuda") and self.configs.get("compile_all", False)
|
| 60 |
-
self.compile_mode = self.configs.get("compile_mode", None)
|
| 61 |
-
self.allow_is_half = not self.device.startswith(("cpu", "mps", "ocl", "privateuseone")) or self.configs.get("allow_fp16_all_backend", False)
|
| 62 |
-
self.x_pad, self.x_query, self.x_center, self.x_max = self.device_config()
|
| 63 |
-
if self.compile_all: self.setup_compile()
|
| 64 |
-
|
| 65 |
-
def multi_language(self):
|
| 66 |
-
try:
|
| 67 |
-
lang = self.configs.get("language", "vi-VN")
|
| 68 |
-
|
| 69 |
-
if len([l for l in os.listdir(self.configs["language_path"]) if l.endswith(".json")]) < 1:
|
| 70 |
-
raise FileNotFoundError("Không tìm thấy bất cứ gói ngôn ngữ nào(No package languages found)")
|
| 71 |
-
|
| 72 |
-
if not lang: lang = "vi-VN"
|
| 73 |
-
|
| 74 |
-
if lang not in self.configs["support_language"]:
|
| 75 |
-
raise ValueError("Ngôn ngữ không được hỗ trợ (Language not supported)")
|
| 76 |
-
|
| 77 |
-
lang_path = os.path.join(self.configs["language_path"], f"{lang}.json")
|
| 78 |
-
if not os.path.exists(lang_path):
|
| 79 |
-
lang_path = os.path.join(self.configs["language_path"], "vi-VN.json")
|
| 80 |
-
|
| 81 |
-
with open(lang_path, encoding="utf-8") as f:
|
| 82 |
-
translations = json.load(f)
|
| 83 |
-
except json.JSONDecodeError:
|
| 84 |
-
print(self.translations["empty_json"].format(file=lang))
|
| 85 |
-
pass
|
| 86 |
-
|
| 87 |
-
return translations
|
| 88 |
-
|
| 89 |
-
def is_fp16(self):
|
| 90 |
-
fp16 = self.configs.get("fp16", False)
|
| 91 |
-
|
| 92 |
-
if self.device in ["cpu", "mps", "ocl", "privateuseone"] and fp16:
|
| 93 |
-
self.configs["fp16"] = False
|
| 94 |
-
fp16 = False
|
| 95 |
-
|
| 96 |
-
with open(self.configs_path, "w") as f:
|
| 97 |
-
json.dump(self.configs, f, indent=4)
|
| 98 |
-
|
| 99 |
-
if not fp16: self.per_preprocess = 3.0
|
| 100 |
-
return fp16
|
| 101 |
-
|
| 102 |
-
def load_config_json(self):
|
| 103 |
-
configs = {}
|
| 104 |
-
|
| 105 |
-
for config_file in version_config_paths:
|
| 106 |
-
try:
|
| 107 |
-
with open(os.path.join("main", "configs", config_file), "r") as f:
|
| 108 |
-
configs[config_file] = json.load(f)
|
| 109 |
-
except json.JSONDecodeError:
|
| 110 |
-
print(self.translations["empty_json"].format(file=config_file))
|
| 111 |
-
pass
|
| 112 |
-
|
| 113 |
-
return configs
|
| 114 |
-
|
| 115 |
-
def setup_compile(self):
|
| 116 |
-
import importlib
|
| 117 |
-
|
| 118 |
-
try:
|
| 119 |
-
importlib.import_module("triton")
|
| 120 |
-
except ModuleNotFoundError:
|
| 121 |
-
self.compile_all = False
|
| 122 |
-
self.configs["compile_all"] = False
|
| 123 |
-
|
| 124 |
-
with open(self.configs_path, "w") as f:
|
| 125 |
-
json.dump(self.configs, f, indent=4)
|
| 126 |
-
|
| 127 |
-
if self.compile_all:
|
| 128 |
-
dirs = self.configs.get("compile_cache_dir", "none")
|
| 129 |
-
|
| 130 |
-
if dirs != "none":
|
| 131 |
-
if not os.path.exists(dirs): os.makedirs(dirs)
|
| 132 |
-
os.environ["TORCHINDUCTOR_CACHE_DIR"] = dirs
|
| 133 |
-
|
| 134 |
-
import torch._inductor.config as config
|
| 135 |
-
|
| 136 |
-
torch._dynamo.config.capture_scalar_outputs = True
|
| 137 |
-
config.freezing = True
|
| 138 |
-
|
| 139 |
-
def device_config(self):
|
| 140 |
-
if self.gpu_mem is not None and self.gpu_mem <= 4:
|
| 141 |
-
self.per_preprocess = 3.0
|
| 142 |
-
return 1, 5, 30, 32
|
| 143 |
-
|
| 144 |
-
return (3, 10, 60, 65) if self.is_half else (1, 6, 38, 41)
|
| 145 |
-
|
| 146 |
-
def get_default_device(self):
|
| 147 |
-
if not self.cpu_mode:
|
| 148 |
-
if torch.cuda.is_available():
|
| 149 |
-
device = "cuda:0"
|
| 150 |
-
self.gpu_mem = torch.cuda.get_device_properties(int(device.split(":")[-1])).total_memory // (1024**3)
|
| 151 |
-
elif hasattr(torch, "xpu") and torch.xpu.is_available():
|
| 152 |
-
device = "xpu:0"
|
| 153 |
-
self.gpu_mem = torch.xpu.get_device_properties(int(device.split(":")[-1])).total_memory // (1024**3)
|
| 154 |
-
xpu.setup_gradscaler()
|
| 155 |
-
elif directml.is_available():
|
| 156 |
-
device = "privateuseone:0"
|
| 157 |
-
elif opencl.is_available():
|
| 158 |
-
device = "ocl:0"
|
| 159 |
-
elif torch.backends.mps.is_available():
|
| 160 |
-
device = "mps"
|
| 161 |
-
else:
|
| 162 |
-
device = "cpu"
|
| 163 |
-
else:
|
| 164 |
-
torch.cuda.is_available = lambda : False
|
| 165 |
-
directml.is_available = lambda : False
|
| 166 |
-
opencl.is_available = lambda : False
|
| 167 |
-
torch.backends.mps.is_available = lambda : False
|
| 168 |
-
if hasattr(torch, "xpu"): torch.xpu.is_available = lambda: False
|
| 169 |
-
|
| 170 |
-
device = "cpu"
|
| 171 |
-
|
| 172 |
-
return device
|
| 173 |
-
|
| 174 |
-
def get_providers(self):
|
| 175 |
-
ort_providers = onnxruntime.get_available_providers()
|
| 176 |
-
providers = []
|
| 177 |
-
|
| 178 |
-
if self.device.startswith("cuda"):
|
| 179 |
-
if "TensorrtExecutionProvider" in ort_providers and self.tensorrt: providers.append("TensorrtExecutionProvider")
|
| 180 |
-
if "CUDAExecutionProvider" in ort_providers: providers.append("CUDAExecutionProvider")
|
| 181 |
-
elif "ROCMExecutionProvider" in ort_providers: providers.append("ROCMExecutionProvider")
|
| 182 |
-
elif "MIGraphXExecutionProvider" in ort_providers: providers.append("MIGraphXExecutionProvider")
|
| 183 |
-
elif "DmlExecutionProvider" in ort_providers: providers.append("DmlExecutionProvider")
|
| 184 |
-
elif self.device.startswith("xpu"):
|
| 185 |
-
if "OpenVINOExecutionProvider" in ort_providers: providers.append("OpenVINOExecutionProvider")
|
| 186 |
-
elif "DnnlExecutionProvider" in ort_providers: providers.append("DnnlExecutionProvider")
|
| 187 |
-
elif "DmlExecutionProvider" in ort_providers: providers.append("DmlExecutionProvider")
|
| 188 |
-
elif "DmlExecutionProvider" in ort_providers and self.device.startswith(("ocl", "privateuseone")): providers.append("DmlExecutionProvider")
|
| 189 |
-
elif "CoreMLExecutionProvider" in ort_providers and self.device.startswith("mps"): providers.append("CoreMLExecutionProvider")
|
| 190 |
-
|
| 191 |
-
providers.append("CPUExecutionProvider")
|
| 192 |
-
return providers
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/configs/rpc.py
DELETED
|
@@ -1,81 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import sys
|
| 3 |
-
import json
|
| 4 |
-
import time
|
| 5 |
-
import struct
|
| 6 |
-
import codecs
|
| 7 |
-
|
| 8 |
-
sys.path.append(os.getcwd())
|
| 9 |
-
|
| 10 |
-
from main.app.variables import translations
|
| 11 |
-
|
| 12 |
-
CLIENT_ID = "1392816674159202396"
|
| 13 |
-
|
| 14 |
-
def create_payload(opcode, payload):
|
| 15 |
-
data = json.dumps(payload).encode("utf-8")
|
| 16 |
-
|
| 17 |
-
return struct.pack(
|
| 18 |
-
"<I",
|
| 19 |
-
opcode
|
| 20 |
-
) + struct.pack(
|
| 21 |
-
"<I",
|
| 22 |
-
len(data)
|
| 23 |
-
) + data
|
| 24 |
-
|
| 25 |
-
def connect_discord_ipc():
|
| 26 |
-
try:
|
| 27 |
-
return open(
|
| 28 |
-
r"\\?\pipe\discord-ipc-0",
|
| 29 |
-
"r+b",
|
| 30 |
-
buffering=0
|
| 31 |
-
)
|
| 32 |
-
except Exception:
|
| 33 |
-
return None
|
| 34 |
-
|
| 35 |
-
def send_discord_rpc(pipe):
|
| 36 |
-
pipe.write(
|
| 37 |
-
create_payload(
|
| 38 |
-
0, {
|
| 39 |
-
"v": 1,
|
| 40 |
-
"client_id": CLIENT_ID
|
| 41 |
-
}
|
| 42 |
-
)
|
| 43 |
-
)
|
| 44 |
-
|
| 45 |
-
pipe.read(8)
|
| 46 |
-
pipe.read(
|
| 47 |
-
struct.unpack(
|
| 48 |
-
"<I",
|
| 49 |
-
pipe.read(4)
|
| 50 |
-
)[0]
|
| 51 |
-
)
|
| 52 |
-
|
| 53 |
-
pipe.write(
|
| 54 |
-
create_payload(
|
| 55 |
-
1, {
|
| 56 |
-
"cmd": "SET_ACTIVITY",
|
| 57 |
-
"args": {
|
| 58 |
-
"pid": os.getpid(),
|
| 59 |
-
"activity": {
|
| 60 |
-
"buttons": [{
|
| 61 |
-
"label": "Github",
|
| 62 |
-
"url": codecs.decode(
|
| 63 |
-
"uggcf://tvguho.pbz/CunzUhlauNau16/Ivrganzrfr-EIP",
|
| 64 |
-
"rot13"
|
| 65 |
-
)
|
| 66 |
-
}],
|
| 67 |
-
"details": translations["details"],
|
| 68 |
-
"timestamps": {
|
| 69 |
-
"start": int(
|
| 70 |
-
time.time()
|
| 71 |
-
)
|
| 72 |
-
},
|
| 73 |
-
"state": translations["use"]
|
| 74 |
-
}
|
| 75 |
-
},
|
| 76 |
-
"nonce": str(
|
| 77 |
-
time.time()
|
| 78 |
-
)
|
| 79 |
-
}
|
| 80 |
-
)
|
| 81 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/configs/v1/24000.json
DELETED
|
@@ -1,42 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"train": {
|
| 3 |
-
"log_interval": 200,
|
| 4 |
-
"seed": 1234,
|
| 5 |
-
"learning_rate": 1e-4,
|
| 6 |
-
"betas": [0.8, 0.99],
|
| 7 |
-
"eps": 1e-9,
|
| 8 |
-
"lr_decay": 0.999875,
|
| 9 |
-
"segment_size": 8640,
|
| 10 |
-
"c_mel": 45,
|
| 11 |
-
"c_kl": 1.0
|
| 12 |
-
},
|
| 13 |
-
"data": {
|
| 14 |
-
"max_wav_value": 32768.0,
|
| 15 |
-
"sample_rate": 24000,
|
| 16 |
-
"filter_length": 1024,
|
| 17 |
-
"hop_length": 240,
|
| 18 |
-
"win_length": 1024,
|
| 19 |
-
"n_mel_channels": 80,
|
| 20 |
-
"mel_fmin": 0.0,
|
| 21 |
-
"mel_fmax": null
|
| 22 |
-
},
|
| 23 |
-
"model": {
|
| 24 |
-
"inter_channels": 192,
|
| 25 |
-
"hidden_channels": 192,
|
| 26 |
-
"filter_channels": 768,
|
| 27 |
-
"text_enc_hidden_dim": 256,
|
| 28 |
-
"n_heads": 2,
|
| 29 |
-
"n_layers": 6,
|
| 30 |
-
"kernel_size": 3,
|
| 31 |
-
"p_dropout": 0,
|
| 32 |
-
"resblock": "1",
|
| 33 |
-
"resblock_kernel_sizes": [3, 7, 11],
|
| 34 |
-
"resblock_dilation_sizes": [[1, 3, 5], [1, 3, 5], [1, 3, 5]],
|
| 35 |
-
"upsample_rates": [10, 6, 2, 2],
|
| 36 |
-
"upsample_initial_channel": 512,
|
| 37 |
-
"upsample_kernel_sizes": [20, 12, 4, 4],
|
| 38 |
-
"use_spectral_norm": false,
|
| 39 |
-
"gin_channels": 256,
|
| 40 |
-
"spk_embed_dim": 109
|
| 41 |
-
}
|
| 42 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/configs/v1/32000.json
DELETED
|
@@ -1,42 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"train": {
|
| 3 |
-
"log_interval": 200,
|
| 4 |
-
"seed": 1234,
|
| 5 |
-
"learning_rate": 1e-4,
|
| 6 |
-
"betas": [0.8, 0.99],
|
| 7 |
-
"eps": 1e-9,
|
| 8 |
-
"lr_decay": 0.999875,
|
| 9 |
-
"segment_size": 12800,
|
| 10 |
-
"c_mel": 45,
|
| 11 |
-
"c_kl": 1.0
|
| 12 |
-
},
|
| 13 |
-
"data": {
|
| 14 |
-
"max_wav_value": 32768.0,
|
| 15 |
-
"sample_rate": 32000,
|
| 16 |
-
"filter_length": 1024,
|
| 17 |
-
"hop_length": 320,
|
| 18 |
-
"win_length": 1024,
|
| 19 |
-
"n_mel_channels": 80,
|
| 20 |
-
"mel_fmin": 0.0,
|
| 21 |
-
"mel_fmax": null
|
| 22 |
-
},
|
| 23 |
-
"model": {
|
| 24 |
-
"inter_channels": 192,
|
| 25 |
-
"hidden_channels": 192,
|
| 26 |
-
"filter_channels": 768,
|
| 27 |
-
"text_enc_hidden_dim": 256,
|
| 28 |
-
"n_heads": 2,
|
| 29 |
-
"n_layers": 6,
|
| 30 |
-
"kernel_size": 3,
|
| 31 |
-
"p_dropout": 0,
|
| 32 |
-
"resblock": "1",
|
| 33 |
-
"resblock_kernel_sizes": [3, 7, 11],
|
| 34 |
-
"resblock_dilation_sizes": [[1, 3, 5], [1, 3, 5], [1, 3, 5]],
|
| 35 |
-
"upsample_rates": [10, 4, 2, 2, 2],
|
| 36 |
-
"upsample_initial_channel": 512,
|
| 37 |
-
"upsample_kernel_sizes": [16, 16, 4, 4, 4],
|
| 38 |
-
"use_spectral_norm": false,
|
| 39 |
-
"gin_channels": 256,
|
| 40 |
-
"spk_embed_dim": 109
|
| 41 |
-
}
|
| 42 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/configs/v1/40000.json
DELETED
|
@@ -1,42 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"train": {
|
| 3 |
-
"log_interval": 200,
|
| 4 |
-
"seed": 1234,
|
| 5 |
-
"learning_rate": 1e-4,
|
| 6 |
-
"betas": [0.8, 0.99],
|
| 7 |
-
"eps": 1e-9,
|
| 8 |
-
"lr_decay": 0.999875,
|
| 9 |
-
"segment_size": 12800,
|
| 10 |
-
"c_mel": 45,
|
| 11 |
-
"c_kl": 1.0
|
| 12 |
-
},
|
| 13 |
-
"data": {
|
| 14 |
-
"max_wav_value": 32768.0,
|
| 15 |
-
"sample_rate": 40000,
|
| 16 |
-
"filter_length": 2048,
|
| 17 |
-
"hop_length": 400,
|
| 18 |
-
"win_length": 2048,
|
| 19 |
-
"n_mel_channels": 125,
|
| 20 |
-
"mel_fmin": 0.0,
|
| 21 |
-
"mel_fmax": null
|
| 22 |
-
},
|
| 23 |
-
"model": {
|
| 24 |
-
"inter_channels": 192,
|
| 25 |
-
"hidden_channels": 192,
|
| 26 |
-
"filter_channels": 768,
|
| 27 |
-
"text_enc_hidden_dim": 256,
|
| 28 |
-
"n_heads": 2,
|
| 29 |
-
"n_layers": 6,
|
| 30 |
-
"kernel_size": 3,
|
| 31 |
-
"p_dropout": 0,
|
| 32 |
-
"resblock": "1",
|
| 33 |
-
"resblock_kernel_sizes": [3, 7, 11],
|
| 34 |
-
"resblock_dilation_sizes": [[1, 3, 5], [1, 3, 5], [1, 3, 5]],
|
| 35 |
-
"upsample_rates": [10, 10, 2, 2],
|
| 36 |
-
"upsample_initial_channel": 512,
|
| 37 |
-
"upsample_kernel_sizes": [16, 16, 4, 4],
|
| 38 |
-
"use_spectral_norm": false,
|
| 39 |
-
"gin_channels": 256,
|
| 40 |
-
"spk_embed_dim": 109
|
| 41 |
-
}
|
| 42 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/configs/v1/44100.json
DELETED
|
@@ -1,42 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"train": {
|
| 3 |
-
"log_interval": 200,
|
| 4 |
-
"seed": 1234,
|
| 5 |
-
"learning_rate": 1e-4,
|
| 6 |
-
"betas": [0.8, 0.99],
|
| 7 |
-
"eps": 1e-9,
|
| 8 |
-
"lr_decay": 0.999875,
|
| 9 |
-
"segment_size": 10240,
|
| 10 |
-
"c_mel": 45,
|
| 11 |
-
"c_kl": 1.0
|
| 12 |
-
},
|
| 13 |
-
"data": {
|
| 14 |
-
"max_wav_value": 32768.0,
|
| 15 |
-
"sample_rate": 44100,
|
| 16 |
-
"filter_length": 2048,
|
| 17 |
-
"hop_length": 512,
|
| 18 |
-
"win_length": 2048,
|
| 19 |
-
"n_mel_channels": 80,
|
| 20 |
-
"mel_fmin": 0.0,
|
| 21 |
-
"mel_fmax": 22050
|
| 22 |
-
},
|
| 23 |
-
"model": {
|
| 24 |
-
"inter_channels": 192,
|
| 25 |
-
"hidden_channels": 192,
|
| 26 |
-
"filter_channels": 768,
|
| 27 |
-
"text_enc_hidden_dim": 256,
|
| 28 |
-
"n_heads": 2,
|
| 29 |
-
"n_layers": 6,
|
| 30 |
-
"kernel_size": 3,
|
| 31 |
-
"p_dropout": 0.1,
|
| 32 |
-
"resblock": "1",
|
| 33 |
-
"resblock_kernel_sizes": [3, 7, 11],
|
| 34 |
-
"resblock_dilation_sizes": [[1, 3, 5], [1, 3, 5], [1, 3, 5]],
|
| 35 |
-
"upsample_rates": [8, 8, 2, 2, 2],
|
| 36 |
-
"upsample_initial_channel": 512,
|
| 37 |
-
"upsample_kernel_sizes": [16, 16, 4, 4, 4],
|
| 38 |
-
"use_spectral_norm": false,
|
| 39 |
-
"gin_channels": 256,
|
| 40 |
-
"spk_embed_dim": 109
|
| 41 |
-
}
|
| 42 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|