|
import requests |
|
from pathlib import Path |
|
|
|
|
|
urls = [ |
|
'https://huggingface.co/lang03383/my_SD_mod/raw/main/sd_yun/config.json', |
|
'https://huggingface.co/lang03383/my_SD_mod/raw/main/sd_yun/ui-config.json', |
|
|
|
] |
|
|
|
|
|
save_dir = '/root/sdw/' |
|
|
|
|
|
Path(save_dir).mkdir(parents=True, exist_ok=True) |
|
|
|
|
|
download_success = True |
|
|
|
|
|
for url in urls: |
|
|
|
filename = url.split('/')[-1] |
|
|
|
|
|
save_path = Path(save_dir) / filename |
|
|
|
try: |
|
|
|
response = requests.get(url) |
|
response.raise_for_status() |
|
|
|
|
|
with save_path.open('wb') as file: |
|
file.write(response.content) |
|
|
|
except requests.exceptions.RequestException as e: |
|
|
|
print(f"\033[91mFailed to download {url}: {e}\033[0m") |
|
download_success = False |
|
break |
|
|
|
|
|
if download_success: |
|
print("\033[92mDownload Done!\033[0m") |
|
else: |
|
print("\033[91mDownload Failed!\033[0m") |
|
|