Spaces:
Running
on
Zero
Running
on
Zero
import os | |
import requests | |
from tqdm import tqdm | |
def dl_guff_model(model_dir, url): | |
file_name = url.split('/')[-1] | |
folder = model_dir | |
file_path = os.path.join(folder, file_name) | |
if not os.path.exists(file_path): | |
response = requests.get(url, allow_redirects=True) | |
if response.status_code == 200: | |
with open(file_path, 'wb') as f: | |
f.write(response.content) | |
print(f'Downloaded {file_name}') | |
else: | |
print(f'Failed to download {file_name}') | |
else: | |
print(f'{file_name} already exists.') |