sczhou commited on
Commit
8fd2b6a
1 Parent(s): 8a3d969

fix queue jam.

Browse files
Files changed (1) hide show
  1. CodeFormer/facelib/utils/misc.py +21 -21
CodeFormer/facelib/utils/misc.py CHANGED
@@ -7,32 +7,32 @@ import torch
7
  from torch.hub import download_url_to_file, get_dir
8
  from urllib.parse import urlparse
9
  # from basicsr.utils.download_util import download_file_from_google_drive
10
- import gdown
11
 
12
 
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):
 
7
  from torch.hub import download_url_to_file, get_dir
8
  from urllib.parse import urlparse
9
  # from basicsr.utils.download_util import download_file_from_google_drive
10
+ # import gdown
11
 
12
 
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):