Fix example code
Browse files
README.md
CHANGED
|
@@ -60,6 +60,10 @@ pip install diffusers
|
|
| 60 |
```py
|
| 61 |
from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline
|
| 62 |
import torch
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
controlnet = ControlNetModel.from_pretrained(
|
| 65 |
"briaai/BRIA-2.3-ControlNet-Canny",
|
|
@@ -77,7 +81,10 @@ prompt = "A portrait of a Beautiful and playful ethereal singer, golden designs,
|
|
| 77 |
negative_prompt = "Logo,Watermark,Text,Ugly,Morbid,Extra fingers,Poorly drawn hands,Mutation,Blurry,Extra limbs,Gross proportions,Missing arms,Mutated hands,Long neck,Duplicate,Mutilated,Mutilated hands,Poorly drawn face,Deformed,Bad anatomy,Cloned face,Malformed limbs,Missing legs,Too many fingers"
|
| 78 |
|
| 79 |
# Calculate Canny image
|
| 80 |
-
input_image =
|
|
|
|
|
|
|
|
|
|
| 81 |
low_threshold, high_threshold = 100, 200
|
| 82 |
input_image = cv2.Canny(input_image, low_threshold, high_threshold)
|
| 83 |
input_image = input_image[:, :, None]
|
|
|
|
| 60 |
```py
|
| 61 |
from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline
|
| 62 |
import torch
|
| 63 |
+
import cv2
|
| 64 |
+
import numpy as np
|
| 65 |
+
from PIL import Image
|
| 66 |
+
from diffusers.utils import load_image
|
| 67 |
|
| 68 |
controlnet = ControlNetModel.from_pretrained(
|
| 69 |
"briaai/BRIA-2.3-ControlNet-Canny",
|
|
|
|
| 81 |
negative_prompt = "Logo,Watermark,Text,Ugly,Morbid,Extra fingers,Poorly drawn hands,Mutation,Blurry,Extra limbs,Gross proportions,Missing arms,Mutated hands,Long neck,Duplicate,Mutilated,Mutilated hands,Poorly drawn face,Deformed,Bad anatomy,Cloned face,Malformed limbs,Missing legs,Too many fingers"
|
| 82 |
|
| 83 |
# Calculate Canny image
|
| 84 |
+
input_image = load_image(
|
| 85 |
+
"https://hf.co/datasets/huggingface/documentation-images/resolve/main/diffusers/input_image_vermeer.png"
|
| 86 |
+
)
|
| 87 |
+
input_image = np.array(input_image)
|
| 88 |
low_threshold, high_threshold = 100, 200
|
| 89 |
input_image = cv2.Canny(input_image, low_threshold, high_threshold)
|
| 90 |
input_image = input_image[:, :, None]
|