Skip to content

Commit 8859074

Browse files
authored
Create models.py
1 parent 64e50f8 commit 8859074

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

models.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import os
2+
import requests
3+
from pathlib import Path
4+
5+
# Function to download file
6+
def download_file(url, dest_path):
7+
try:
8+
response = requests.get(url, stream=True)
9+
response.raise_for_status() # Check if the request was successful
10+
11+
with open(dest_path, 'wb') as file:
12+
for chunk in response.iter_content(chunk_size=8192):
13+
file.write(chunk)
14+
15+
print(f"Successfully downloaded {dest_path}")
16+
17+
except requests.exceptions.RequestException as e:
18+
print(f"Error downloading {url}: {e}")
19+
20+
# Directory structure
21+
base_dir = "assets"
22+
directories = ["fcpe", "hubert", "rmvpe"]
23+
urls = [
24+
"https://huggingface.co/datasets/ylzz1997/rmvpe_pretrain_model/resolve/main/fcpe.pt",
25+
"https://huggingface.co/Kit-Lemonfoot/RVC_DidntAsk/resolve/main/hubert_base.pt",
26+
"https://huggingface.co/Kit-Lemonfoot/RVC_DidntAsk/resolve/main/rmvpe.pt"
27+
]
28+
29+
# Ensure directories exist
30+
for directory in directories:
31+
os.makedirs(Path(base_dir) / directory, exist_ok=True)
32+
33+
# Download the files
34+
for url, directory in zip(urls, directories):
35+
file_name = url.split("/")[-1]
36+
dest_path = Path(base_dir) / directory / file_name
37+
download_file(url, dest_path)

0 commit comments

Comments
 (0)