mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2025-05-06 20:01:37 +08:00
chore(format): run black on dev (#1990)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
229fe68818
commit
55f9b3262c
@ -55,6 +55,7 @@ vc = VC(config)
|
||||
|
||||
if not config.nocheck:
|
||||
from infer.lib.rvcmd import check_all_assets, download_all_assets
|
||||
|
||||
if not check_all_assets():
|
||||
download_all_assets(tmpdir=tmp)
|
||||
if not check_all_assets():
|
||||
|
@ -114,7 +114,7 @@ def download_and_extract_tar_gz(url: str, folder: str):
|
||||
import tarfile
|
||||
|
||||
logger.info(f"downloading {url}")
|
||||
response = requests.get(url, stream=True, timeout=(5,10))
|
||||
response = requests.get(url, stream=True, timeout=(5, 10))
|
||||
with BytesIO() as out_file:
|
||||
out_file.write(response.content)
|
||||
out_file.seek(0)
|
||||
@ -128,7 +128,7 @@ def download_and_extract_zip(url: str, folder: str):
|
||||
import zipfile
|
||||
|
||||
logger.info(f"downloading {url}")
|
||||
response = requests.get(url, stream=True, timeout=(5,10))
|
||||
response = requests.get(url, stream=True, timeout=(5, 10))
|
||||
with BytesIO() as out_file:
|
||||
out_file.write(response.content)
|
||||
out_file.seek(0)
|
||||
@ -137,13 +137,15 @@ def download_and_extract_zip(url: str, folder: str):
|
||||
zip_ref.extractall(folder)
|
||||
logger.info(f"extracted into {folder}")
|
||||
|
||||
|
||||
def download_dns_yaml(url: str, folder: str):
|
||||
logger.info(f"downloading {url}")
|
||||
response = requests.get(url, stream=True, timeout=(5,10))
|
||||
response = requests.get(url, stream=True, timeout=(5, 10))
|
||||
with open(f"{folder}/dns.yaml", "wb") as out_file:
|
||||
out_file.write(response.content)
|
||||
logger.info(f"downloaded into {folder}")
|
||||
|
||||
|
||||
def download_all_assets(tmpdir: str, version="0.2.2"):
|
||||
import subprocess
|
||||
import platform
|
||||
@ -169,7 +171,9 @@ def download_all_assets(tmpdir: str, version="0.2.2"):
|
||||
logger.error(f"architecture {architecture} is not supported")
|
||||
exit(1)
|
||||
try:
|
||||
BASE_URL = "https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/"
|
||||
BASE_URL = (
|
||||
"https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/"
|
||||
)
|
||||
suffix = "zip" if is_win else "tar.gz"
|
||||
RVCMD_URL = BASE_URL + f"v{version}/rvcmd_{system_type}_{architecture}.{suffix}"
|
||||
cmdfile = tmpdir + "/rvcmd"
|
||||
@ -192,11 +196,16 @@ def download_all_assets(tmpdir: str, version="0.2.2"):
|
||||
"windows_amd64": "427",
|
||||
}[f"{system_type}_{architecture}"]
|
||||
RVCMD_URL = BASE_URL + suffix
|
||||
download_dns_yaml("https://raw.gitcode.com/u011570312/RVC-Models-Downloader/raw/main/dns.yaml", tmpdir)
|
||||
download_dns_yaml(
|
||||
"https://raw.gitcode.com/u011570312/RVC-Models-Downloader/raw/main/dns.yaml",
|
||||
tmpdir,
|
||||
)
|
||||
if is_win:
|
||||
download_and_extract_zip(RVCMD_URL, tmpdir)
|
||||
cmdfile += ".exe"
|
||||
else:
|
||||
download_and_extract_tar_gz(RVCMD_URL, tmpdir)
|
||||
os.chmod(cmdfile, 0o755)
|
||||
subprocess.run([cmdfile, "-notui", "-w", "0", "-dns", f"{tmpdir}/dns.yaml", "assets/all"])
|
||||
subprocess.run(
|
||||
[cmdfile, "-notui", "-w", "0", "-dns", f"{tmpdir}/dns.yaml", "assets/all"]
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user