Spaces:
Runtime error
Runtime error
fix queue jam.
Browse files- CodeFormer/facelib/utils/misc.py +20 -20
CodeFormer/facelib/utils/misc.py
CHANGED
@@ -13,26 +13,26 @@ from urllib.parse import urlparse
|
|
13 |
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
14 |
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
#
|
27 |
-
#
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
#
|
35 |
-
#
|
36 |
|
37 |
|
38 |
def imwrite(img, file_path, params=None, auto_mkdir=True):
|
|
|
13 |
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
14 |
|
15 |
|
16 |
+
def download_pretrained_models(file_ids, save_path_root):
|
17 |
+
os.makedirs(save_path_root, exist_ok=True)
|
18 |
+
|
19 |
+
for file_name, file_id in file_ids.items():
|
20 |
+
file_url = 'https://drive.google.com/uc?id='+file_id
|
21 |
+
save_path = osp.abspath(osp.join(save_path_root, file_name))
|
22 |
+
if osp.exists(save_path):
|
23 |
+
user_response = input(f'{file_name} already exist. Do you want to cover it? Y/N\n')
|
24 |
+
if user_response.lower() == 'y':
|
25 |
+
print(f'Covering {file_name} to {save_path}')
|
26 |
+
# gdown.download(file_url, save_path, quiet=False)
|
27 |
+
# download_file_from_google_drive(file_id, save_path)
|
28 |
+
elif user_response.lower() == 'n':
|
29 |
+
print(f'Skipping {file_name}')
|
30 |
+
else:
|
31 |
+
raise ValueError('Wrong input. Only accepts Y/N.')
|
32 |
+
else:
|
33 |
+
print(f'Downloading {file_name} to {save_path}')
|
34 |
+
# gdown.download(file_url, save_path, quiet=False)
|
35 |
+
# download_file_from_google_drive(file_id, save_path)
|
36 |
|
37 |
|
38 |
def imwrite(img, file_path, params=None, auto_mkdir=True):
|