Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
@@ -34,11 +34,15 @@ def download_manager(url, output_dir):
|
|
34 |
output_path = os.path.join(output_dir, filename)
|
35 |
if os.path.exists(output_path):
|
36 |
return output_path
|
|
|
37 |
logger.info(f"Downloading: {filename}")
|
|
|
|
|
38 |
with requests.get(url, stream=True) as r:
|
39 |
r.raise_for_status()
|
40 |
with open(output_path, 'wb') as f:
|
41 |
for chunk in r.iter_content(chunk_size=8192):
|
42 |
f.write(chunk)
|
|
|
43 |
logger.info(f"Downloaded: {filename}")
|
44 |
return output_path
|
|
|
34 |
output_path = os.path.join(output_dir, filename)
|
35 |
if os.path.exists(output_path):
|
36 |
return output_path
|
37 |
+
|
38 |
logger.info(f"Downloading: {filename}")
|
39 |
+
os.makedirs(os.path.dirname(output_path), exist_ok=True) # Ensure directory exists
|
40 |
+
|
41 |
with requests.get(url, stream=True) as r:
|
42 |
r.raise_for_status()
|
43 |
with open(output_path, 'wb') as f:
|
44 |
for chunk in r.iter_content(chunk_size=8192):
|
45 |
f.write(chunk)
|
46 |
+
|
47 |
logger.info(f"Downloaded: {filename}")
|
48 |
return output_path
|