Instructions to use bbbboiwow/cocccck with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use bbbboiwow/cocccck with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("bbbboiwow/cocccck", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Download custom_nodes/image_control/annotator/binary/__init__.py from bbbboiwow/cocccck: direct link, hf CLI and curl.
- Browser
- Download file 505 Bytes
-
https://huggingface.co/bbbboiwow/cocccck/resolve/main/custom_nodes/image_control/annotator/binary/__init__.py
- Command line
-
hf download hf://bbbboiwow/cocccck/custom_nodes/image_control/annotator/binary/__init__.py
-
curl -L -o __init__.py https://huggingface.co/bbbboiwow/cocccck/resolve/main/custom_nodes/image_control/annotator/binary/__init__.py
505 Bytes
| import cv2 | |
| def apply_binary(img, bin_threshold): | |
| img_gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) | |
| if bin_threshold == 0 or bin_threshold == 255: | |
| # Otsu's threshold | |
| otsu_threshold, img_bin = cv2.threshold(img_gray, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU) | |
| print("Otsu threshold:", otsu_threshold) | |
| else: | |
| _, img_bin = cv2.threshold(img_gray, bin_threshold, 255, cv2.THRESH_BINARY_INV) | |
| return cv2.cvtColor(img_bin, cv2.COLOR_GRAY2RGB) | |