AINovelChat / utils /dl_utils.py
tori29umai's picture
Upload 5 files
20e3524 verified
raw
history blame
600 Bytes
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.')