Aadhithya
commited on
Commit
•
dbcbb5d
1
Parent(s):
63bd3eb
Update roop/utilities.py
Browse files- roop/utilities.py +2 -3
roop/utilities.py
CHANGED
@@ -5,7 +5,6 @@ import platform
|
|
5 |
import shutil
|
6 |
import ssl
|
7 |
import subprocess
|
8 |
-
import urllib
|
9 |
from pathlib import Path
|
10 |
from typing import List, Optional
|
11 |
from tqdm import tqdm
|
@@ -139,10 +138,10 @@ def conditional_download(download_directory_path: str, urls: List[str]) -> None:
|
|
139 |
for url in urls:
|
140 |
download_file_path = os.path.join(download_directory_path, os.path.basename(url))
|
141 |
if not os.path.exists(download_file_path):
|
142 |
-
request =
|
143 |
total = int(request.headers.get('Content-Length', 0))
|
144 |
with tqdm(total=total, desc='Downloading', unit='B', unit_scale=True, unit_divisor=1024) as progress:
|
145 |
-
|
146 |
|
147 |
|
148 |
def resolve_relative_path(path: str) -> str:
|
|
|
5 |
import shutil
|
6 |
import ssl
|
7 |
import subprocess
|
|
|
8 |
from pathlib import Path
|
9 |
from typing import List, Optional
|
10 |
from tqdm import tqdm
|
|
|
138 |
for url in urls:
|
139 |
download_file_path = os.path.join(download_directory_path, os.path.basename(url))
|
140 |
if not os.path.exists(download_file_path):
|
141 |
+
request = request.urlopen(url) # type: ignore[attr-defined]
|
142 |
total = int(request.headers.get('Content-Length', 0))
|
143 |
with tqdm(total=total, desc='Downloading', unit='B', unit_scale=True, unit_divisor=1024) as progress:
|
144 |
+
request.urlretrieve(url, download_file_path, reporthook=lambda count, block_size, total_size: progress.update(block_size)) # type: ignore[attr-defined]
|
145 |
|
146 |
|
147 |
def resolve_relative_path(path: str) -> str:
|