Spaces:
Build error
Build error
Update
Browse files2 unmodified lines34567892 unmodified lines121314141516171819202122232415161718192021222324252627282930313233342 unmodified linesfrom __future__ import annotations
import osimport pathlibimport shleximport subprocess
2 unmodified linesif os.getenv('SYSTEM') == 'spaces': with open('patch') as f: subprocess.run(shlex.split('patch -p1'), stdin=f, cwd='ControlNet') commands = [ 'wget https://huggingface.co/ckpt/ControlNet/resolve/main/dpt_hybrid-midas-501f0c75.pt -O dpt_hybrid-midas-501f0c75.pt', 'wget https://huggingface.co/ckpt/ControlNet/resolve/main/body_pose_model.pth -O body_pose_model.pth', 'wget https://huggingface.co/ckpt/ControlNet/resolve/main/hand_pose_model.pth -O hand_pose_model.pth', 'wget https://huggingface.co/ckpt/ControlNet/resolve/main/mlsd_large_512_fp32.pth -O mlsd_large_512_fp32.pth', 'wget https://huggingface.co/ckpt/ControlNet/resolve/main/mlsd_tiny_512_fp32.pth -O mlsd_tiny_512_fp32.pth', 'wget https://huggingface.co/ckpt/ControlNet/resolve/main/network-bsds500.pth -O network-bsds500.pth', 'wget https://huggingface.co/ckpt/ControlNet/resolve/main/upernet_global_small.pth -O upernet_global_small.pth', ] for command in commands: subprocess.run(shlex.split(command), cwd='ControlNet/annotator/ckpts/')
base_url = 'https://huggingface.co/lllyasviel/ControlNet/resolve/main/annotator/ckpts/'names = [ 'body_pose_model.pth', 'dpt_hybrid-midas-501f0c75.pt', 'hand_pose_model.pth', 'mlsd_large_512_fp32.pth', 'mlsd_tiny_512_fp32.pth', 'network-bsds500.pth', 'upernet_global_small.pth',]for name in names: command = f'wget https://huggingface.co/lllyasviel/ControlNet/resolve/main/annotator/ckpts/{name} -O {name}' out_path = pathlib.Path(f'ControlNet/annotator/ckpts/{name}') if out_path.exists(): continue subprocess.run(shlex.split(command), cwd='ControlNet/annotator/ckpts/')
from gradio_canny2image import create_demo as create_demo_cannyfrom gradio_depth2image import create_demo as create_demo_depth37 unmodified lines383940414142434437 unmodified lines 'depth': 'control_sd15_depth.pth', 'normal': 'control_sd15_normal.pth',}ORIGINAL_WEIGHT_ROOT = 'https://huggingface.co/ckpt/ControlNet/resolve/main/'ORIGINAL_WEIGHT_ROOT = 'https://huggingface.co/lllyasviel/ControlNet/resolve/main/models/'
LIGHTWEIGHT_MODEL_NAMES = { 'canny': 'control_canny-fp16.safetensors',app.py+18-11
model.py+1-1