Spaces:
Sleeping
Sleeping
| # download_models.py | |
| import os | |
| import requests | |
| def download_file(url, path): | |
| if not os.path.exists(path): | |
| print(f"Downloading {os.path.basename(path)} ...") | |
| os.makedirs(os.path.dirname(path), exist_ok=True) | |
| with requests.get(url, stream=True) as r: | |
| r.raise_for_status() | |
| with open(path, "wb") as f: | |
| for chunk in r.iter_content(chunk_size=8192): | |
| f.write(chunk) | |
| print(f"β {os.path.basename(path)} downloaded") | |
| else: | |
| print(f"β {os.path.basename(path)} already exists") | |
| # --- SD model (Civitai) --- | |
| download_file( | |
| "https://civitai.com/api/download/models/143906?type=Model&format=SafeTensor&size=pruned&fp=fp16", | |
| "stable-diffusion-webui/models/Stable-diffusion/model.safetensors" | |
| ) | |
| # --- TemporalNet ControlNet --- | |
| download_file( | |
| "https://huggingface.co/CiaraRowles/TemporalNet/resolve/main/diff_control_sd15_temporalnet_fp16.safetensors", | |
| "stable-diffusion-webui/extensions/ControlNet/models/diff_control_sd15_temporalnet_fp16.safetensors" | |
| ) | |
| # --- Additional ControlNet v1.1 --- | |
| download_file( | |
| "https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile.pth", | |
| "stable-diffusion-webui/extensions/ControlNet/models/control_v11f1e_sd15_tile.pth" | |
| ) | |
| # --- LORA --- | |
| download_file( | |
| "https://huggingface.co/latent-consistency/lcm-lora-sdv1-5/resolve/main/pytorch_lora_weights.safetensors", | |
| "stable-diffusion-webui/models/Lora/lcm-lora-sdv1-5.safetensors" | |
| ) | |