Updated some change missing in this
#1
by
ameerazam08
- opened
README.md
CHANGED
@@ -64,7 +64,9 @@ pip install diffusers
|
|
64 |
```py
|
65 |
from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline
|
66 |
import torch
|
67 |
-
|
|
|
|
|
68 |
controlnet = ControlNetModel.from_pretrained(
|
69 |
"briaai/ControlNet-Canny",
|
70 |
torch_dtype=torch.float16
|
@@ -80,12 +82,15 @@ pipe.to("cuda")
|
|
80 |
prompt = "A portrait of a Beautiful and playful ethereal singer, golden designs, highly detailed, blurry background"
|
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 = cv2.imread('pics/singer.png')
|
85 |
-
|
86 |
input_image = input_image[:, :, None]
|
87 |
-
input_image = np.concatenate([input_image,
|
88 |
-
canny_image = Image.fromarray(
|
89 |
|
90 |
image = pipe(prompt=prompt, negative_prompt=negative_prompt, image=canny_image, controlnet_conditioning_scale=1.0, height=1024, width=1024).images[0]
|
91 |
```
|
|
|
64 |
```py
|
65 |
from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline
|
66 |
import torch
|
67 |
+
import cv2
|
68 |
+
from PIL import Image
|
69 |
+
import numpy as np
|
70 |
controlnet = ControlNetModel.from_pretrained(
|
71 |
"briaai/ControlNet-Canny",
|
72 |
torch_dtype=torch.float16
|
|
|
82 |
prompt = "A portrait of a Beautiful and playful ethereal singer, golden designs, highly detailed, blurry background"
|
83 |
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"
|
84 |
|
85 |
+
|
86 |
+
low_threshold=100
|
87 |
+
high_threshold=200
|
88 |
# Calculate Canny image
|
89 |
input_image = cv2.imread('pics/singer.png')
|
90 |
+
canny_image = cv2.Canny(input_image, low_threshold, high_threshold)
|
91 |
input_image = input_image[:, :, None]
|
92 |
+
input_image = np.concatenate([input_image, canny_image, input_image], axis=2)
|
93 |
+
canny_image = Image.fromarray(canny_image)
|
94 |
|
95 |
image = pipe(prompt=prompt, negative_prompt=negative_prompt, image=canny_image, controlnet_conditioning_scale=1.0, height=1024, width=1024).images[0]
|
96 |
```
|