Downloads · 30 days
20
0% of all-time downloads
thepowerfuldeez/sd21-controlnet-canny
sd21-controlnet-canny is a machine learning model from thepowerfuldeez. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for diffusers. The card lists the license as openrail.
Converted Canny SD 2.1-base model from https://huggingface.co/thibaud/controlnet-sd21/ to diffusers format.
Downloads · 30 days
20
0% of all-time downloads
All-time downloads
40.6K
Public
Repo size
729 MB
Likes
7
Public
Click a slice to open those files.
.bin729 MB · 100%
From the Hugging Face model README
Converted Canny SD 2.1-base model from https://huggingface.co/thibaud/controlnet-sd21/ to diffusers format.
Saved only ControlNet weights
Usage:
from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, DEISMultistepScheduler
import cv2
from PIL import Image
import numpy as np
pipe = StableDiffusionControlNetPipeline.from_pretrained(
"stabilityai/stable-diffusion-2-1-base",
safety_checker=None,
# revision='fp16',
# torch_dtype=torch.float16,
controlnet=ControlNetModel.from_pretrained("thepowefuldeez/sd21-controlnet-canny")
).to('cuda')
pipe.scheduler = DEISMultistepScheduler.from_config(pipe.scheduler.config)
image = np.array(Image.open("10.png"))
low_threshold = 100
high_threshold = 200
image = cv2.Canny(image, low_threshold, high_threshold)
image = image[:, :, None]
image = np.concatenate([image, image, image], axis=2)
canny_image = Image.fromarray(image)
im = pipe(
"beautiful woman", image=canny_image, num_inference_steps=30,
negative_prompt="ugly, blurry, bad, deformed, bad anatomy",
generator=torch.manual_seed(42)
).images[0]