model card
Browse files
README.md
CHANGED
@@ -101,6 +101,8 @@ Please download them and place them in the ./base_models folder.
|
|
101 |
|
102 |
```python
|
103 |
import torch
|
|
|
|
|
104 |
from ip_adapter.utils import BLOCKS as BLOCKS
|
105 |
from ip_adapter.utils import controlnet_BLOCKS as controlnet_BLOCKS
|
106 |
from PIL import Image
|
@@ -150,9 +152,9 @@ csgo = CSGO(pipe, image_encoder_path, csgo_ckpt, device, num_content_tokens=4,nu
|
|
150 |
|
151 |
)
|
152 |
|
153 |
-
style_name = '
|
154 |
content_name = 'img_0.png'
|
155 |
-
style_image = "../assets/{}".format(style_name)
|
156 |
content_image = Image.open('../assets/{}'.format(content_name)).convert('RGB')
|
157 |
|
158 |
caption ='a small house with a sheep statue on top of it'
|
@@ -174,8 +176,8 @@ images = csgo.generate(pil_content_image= content_image, pil_style_image=style_i
|
|
174 |
controlnet_conditioning_scale=0.6,
|
175 |
)
|
176 |
|
177 |
-
#text-driven stylized synthesis
|
178 |
-
caption='a
|
179 |
images = csgo.generate(pil_content_image= content_image, pil_style_image=style_image,
|
180 |
prompt=caption,
|
181 |
negative_prompt= "text, watermark, lowres, low quality, worst quality, deformed, glitch, low contrast, noisy, saturation, blurry",
|
@@ -187,11 +189,14 @@ images = csgo.generate(pil_content_image= content_image, pil_style_image=style_i
|
|
187 |
num_inference_steps=50,
|
188 |
seed=42,
|
189 |
image=content_image.convert('RGB'),
|
190 |
-
controlnet_conditioning_scale=0.
|
191 |
)
|
192 |
|
193 |
-
#text
|
194 |
-
caption='a
|
|
|
|
|
|
|
195 |
images = csgo.generate(pil_content_image= content_image, pil_style_image=style_image,
|
196 |
prompt=caption,
|
197 |
negative_prompt= "text, watermark, lowres, low quality, worst quality, deformed, glitch, low contrast, noisy, saturation, blurry",
|
@@ -203,7 +208,7 @@ images = csgo.generate(pil_content_image= content_image, pil_style_image=style_i
|
|
203 |
num_inference_steps=50,
|
204 |
seed=42,
|
205 |
image=content_image.convert('RGB'),
|
206 |
-
controlnet_conditioning_scale=0.
|
207 |
)
|
208 |
```
|
209 |
|
|
|
101 |
|
102 |
```python
|
103 |
import torch
|
104 |
+
from ip_adapter.utils import resize_content
|
105 |
+
import numpy as np
|
106 |
from ip_adapter.utils import BLOCKS as BLOCKS
|
107 |
from ip_adapter.utils import controlnet_BLOCKS as controlnet_BLOCKS
|
108 |
from PIL import Image
|
|
|
152 |
|
153 |
)
|
154 |
|
155 |
+
style_name = 'img_1.png'
|
156 |
content_name = 'img_0.png'
|
157 |
+
style_image = Image.open("../assets/{}".format(style_name)).convert('RGB')
|
158 |
content_image = Image.open('../assets/{}'.format(content_name)).convert('RGB')
|
159 |
|
160 |
caption ='a small house with a sheep statue on top of it'
|
|
|
176 |
controlnet_conditioning_scale=0.6,
|
177 |
)
|
178 |
|
179 |
+
#text editing-driven stylized synthesis
|
180 |
+
caption='a small house'
|
181 |
images = csgo.generate(pil_content_image= content_image, pil_style_image=style_image,
|
182 |
prompt=caption,
|
183 |
negative_prompt= "text, watermark, lowres, low quality, worst quality, deformed, glitch, low contrast, noisy, saturation, blurry",
|
|
|
189 |
num_inference_steps=50,
|
190 |
seed=42,
|
191 |
image=content_image.convert('RGB'),
|
192 |
+
controlnet_conditioning_scale=0.4,
|
193 |
)
|
194 |
|
195 |
+
#text-driven stylized synthesis
|
196 |
+
caption='a cat'
|
197 |
+
#If the content image still interferes with the generated results, set the content image to an empty image.
|
198 |
+
# content_image =Image.fromarray(np.zeros((content_image.size[0],content_image.size[1], 3), dtype=np.uint8)).convert('RGB')
|
199 |
+
|
200 |
images = csgo.generate(pil_content_image= content_image, pil_style_image=style_image,
|
201 |
prompt=caption,
|
202 |
negative_prompt= "text, watermark, lowres, low quality, worst quality, deformed, glitch, low contrast, noisy, saturation, blurry",
|
|
|
208 |
num_inference_steps=50,
|
209 |
seed=42,
|
210 |
image=content_image.convert('RGB'),
|
211 |
+
controlnet_conditioning_scale=0.01,
|
212 |
)
|
213 |
```
|
214 |
|