Spaces:
Sleeping
Sleeping
Update models/model.py
Browse files- models/model.py +32 -1
models/model.py
CHANGED
@@ -65,6 +65,37 @@ def compress(modelname, files):
|
|
65 |
|
66 |
return file_path
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
def infer(model, f0_method, audio_file, index_rate, vc_transform0, protect0, resample_sr1, filter_radius1):
|
69 |
|
70 |
if not model:
|
@@ -95,7 +126,7 @@ def infer(model, f0_method, audio_file, index_rate, vc_transform0, protect0, res
|
|
95 |
|
96 |
def post_model(name, model_url, version, creator):
|
97 |
modelname = model_downloader(model_url, zips_folder, unzips_folder)
|
98 |
-
|
99 |
if not modelname:
|
100 |
return "抱歉!无法从您提供的链接下载模型,请尝试其他链接或稍后再试。"
|
101 |
|
|
|
65 |
|
66 |
return file_path
|
67 |
|
68 |
+
# download the model only
|
69 |
+
|
70 |
+
def download_online_model(url):
|
71 |
+
url = url.strip()
|
72 |
+
if url.startswith('https://download.openxlab.org.cn/models/'):
|
73 |
+
zip_path = get_username(url) + "-" + get_file_name(url)
|
74 |
+
elif url.startswith('https://huggingface.co/'):
|
75 |
+
zip_path = get_username_hf(url) + "-" + get_file_name(url)
|
76 |
+
else:
|
77 |
+
zip_path = get_file_name(url)
|
78 |
+
if not os.path.exists(zip_path + ".zip"):
|
79 |
+
print("P.S. AI歌手模型还未下载")
|
80 |
+
try:
|
81 |
+
|
82 |
+
zip_name = url.split('/')[-1]
|
83 |
+
|
84 |
+
if 'pixeldrain.com' in url:
|
85 |
+
url = f'https://pixeldrain.com/api/file/{zip_name}'
|
86 |
+
|
87 |
+
urllib.request.urlretrieve(url, zip_path + ".zip")
|
88 |
+
|
89 |
+
#return f'[√] {dir_name} Model successfully downloaded!'
|
90 |
+
|
91 |
+
except Exception as e:
|
92 |
+
raise Exception(str(e))
|
93 |
+
else:
|
94 |
+
print("P.S. AI歌手模型之前已经下载")
|
95 |
+
|
96 |
+
return zip_path + ".zip"
|
97 |
+
|
98 |
+
|
99 |
def infer(model, f0_method, audio_file, index_rate, vc_transform0, protect0, resample_sr1, filter_radius1):
|
100 |
|
101 |
if not model:
|
|
|
126 |
|
127 |
def post_model(name, model_url, version, creator):
|
128 |
modelname = model_downloader(model_url, zips_folder, unzips_folder)
|
129 |
+
print(f"下载的模型.zip文件名:{modelname}")
|
130 |
if not modelname:
|
131 |
return "抱歉!无法从您提供的链接下载模型,请尝试其他链接或稍后再试。"
|
132 |
|