Spaces:
Runtime error
Runtime error
Create scr
Browse files
scr
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
MDX_DOWNLOAD_LINK = 'https://github.com/TRvlvr/model_repo/releases/download/all_public_uvr_models/'
|
| 5 |
+
RVC_DOWNLOAD_LINK = 'https://huggingface.co/lj1995/VoiceConversionWebUI/resolve/main/'
|
| 6 |
+
|
| 7 |
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
| 8 |
+
mdxnet_models_dir = BASE_DIR / 'mdxnet_models'
|
| 9 |
+
rvc_models_dir = BASE_DIR / 'rvc_models'
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def dl_model(link, model_name, dir_name):
|
| 13 |
+
with requests.get(f'{link}{model_name}') as r:
|
| 14 |
+
r.raise_for_status()
|
| 15 |
+
with open(dir_name / model_name, 'wb') as f:
|
| 16 |
+
for chunk in r.iter_content(chunk_size=8192):
|
| 17 |
+
f.write(chunk)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
if __name__ == '__main__':
|
| 21 |
+
mdx_model_names = ['UVR-MDX-NET-Voc_FT.onnx', 'UVR_MDXNET_KARA_2.onnx', 'Reverb_HQ_By_FoxJoy.onnx']
|
| 22 |
+
for model in mdx_model_names:
|
| 23 |
+
print(f'Downloading {model}...')
|
| 24 |
+
dl_model(MDX_DOWNLOAD_LINK, model, mdxnet_models_dir)
|
| 25 |
+
|
| 26 |
+
rvc_model_names = ['hubert_base.pt', 'rmvpe.pt']
|
| 27 |
+
for model in rvc_model_names:
|
| 28 |
+
print(f'Downloading {model}...')
|
| 29 |
+
dl_model(RVC_DOWNLOAD_LINK, model, rvc_models_dir)
|
| 30 |
+
|
| 31 |
+
print('All models downloaded!')
|