Spaces:
Runtime error
Runtime error
Download extensions/sd-webui-controlnet/annotator/shuffle/__init__.py from youngwoo-dev/test1: direct link, hf CLI and curl.
- Browser
- Download file 543 Bytes
-
https://huggingface.co/spaces/youngwoo-dev/test1/resolve/main/extensions/sd-webui-controlnet/annotator/shuffle/__init__.py
- Command line
-
hf download hf://spaces/youngwoo-dev/test1/extensions/sd-webui-controlnet/annotator/shuffle/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/youngwoo-dev/test1/resolve/main/extensions/sd-webui-controlnet/annotator/shuffle/__init__.py
543 Bytes
| import cv2 | |
| import numpy as np | |
| from annotator.util import make_noise_disk | |
| class ContentShuffleDetector: | |
| def __call__(self, img, h=None, w=None, f=None): | |
| H, W, C = img.shape | |
| if h is None: | |
| h = H | |
| if w is None: | |
| w = W | |
| if f is None: | |
| f = 256 | |
| x = make_noise_disk(h, w, 1, f) * float(W - 1) | |
| y = make_noise_disk(h, w, 1, f) * float(H - 1) | |
| flow = np.concatenate([x, y], axis=2).astype(np.float32) | |
| return cv2.remap(img, flow, None, cv2.INTER_LINEAR) | |