ayushtues commited on
Commit
d1b2c34
·
1 Parent(s): 4b272e9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +40 -26
README.md CHANGED
@@ -31,19 +31,23 @@ The model is created by Dongxu Li, Junnan Li, Steven C.H. Hoi.
31
  ```python
32
  from diffusers.pipelines import BlipDiffusionPipeline
33
  from diffusers.utils import load_image
 
34
 
35
-
36
- blip_diffusion_pipe= BlipDiffusionPipeline.from_pretrained('ayushtues/blipdiffusion')
37
- blip_diffusion_pipe.to('cuda')
38
 
39
  cond_subject = "dog"
40
  tgt_subject = "dog"
41
  text_prompt_input = "swimming underwater"
42
 
 
 
 
43
 
44
- cond_image = load_image("https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/dog.jpg")
45
  guidance_scale = 7.5
46
- num_inference_steps = 50
47
  negative_prompt = "over-exposure, under-exposure, saturated, duplicate, out of frame, lowres, cropped, worst quality, low quality, jpeg artifacts, morbid, mutilated, out of frame, ugly, bad anatomy, bad proportions, deformed, blurry, duplicate"
48
 
49
  output = blip_diffusion_pipe(
@@ -56,8 +60,8 @@ output = blip_diffusion_pipe(
56
  neg_prompt=negative_prompt,
57
  height=512,
58
  width=512,
59
- )
60
- output[0][0].save("image.png")
61
  ```
62
  Input Image : <img src="https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/dog.jpg" style="width:500px;"/>
63
 
@@ -70,17 +74,22 @@ from diffusers.pipelines import BlipDiffusionControlNetPipeline
70
  from diffusers.utils import load_image
71
  from controlnet_aux import CannyDetector
72
 
73
- blip_diffusion_pipe= BlipDiffusionControlNetPipeline.from_pretrained("ayushtues/blipdiffusion-controlnet")
74
- blip_diffusion_pipe.to('cuda')
 
75
 
76
- style_subject = "flower" # subject that defines the style
77
  tgt_subject = "teapot" # subject to generate.
78
  text_prompt = "on a marble table"
79
- cldm_cond_image = load_image("https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/kettle.jpg").resize((512, 512))
80
- canny = CannyDetector()
81
- cldm_cond_image = canny(cldm_cond_image, 30, 70, output_type='pil')
82
 
83
- style_image = load_image("https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/flower.jpg")
 
 
 
 
 
 
 
84
 
85
  guidance_scale = 7.5
86
  num_inference_steps = 50
@@ -89,7 +98,7 @@ negative_prompt = "over-exposure, under-exposure, saturated, duplicate, out of f
89
  output = blip_diffusion_pipe(
90
  text_prompt,
91
  style_image,
92
- cldm_cond_image,
93
  style_subject,
94
  tgt_subject,
95
  guidance_scale=guidance_scale,
@@ -97,8 +106,8 @@ output = blip_diffusion_pipe(
97
  neg_prompt=negative_prompt,
98
  height=512,
99
  width=512,
100
- )
101
- output[0][0].save("image.png")
102
  ```
103
 
104
  Input Style Image : <img src="https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/flower.jpg" style="width:500px;"/>
@@ -111,19 +120,24 @@ from diffusers.pipelines import BlipDiffusionControlNetPipeline
111
  from diffusers.utils import load_image
112
  from controlnet_aux import HEDdetector
113
 
114
- blip_diffusion_pipe= BlipDiffusionControlNetPipeline.from_pretrained("ayushtues/blipdiffusion-controlnet")
 
 
115
  controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-scribble")
116
  blip_diffusion_pipe.controlnet = controlnet
117
- blip_diffusion_pipe.to('cuda')
118
 
119
- style_subject = "flower" # subject that defines the style
120
  tgt_subject = "bag" # subject to generate.
121
  text_prompt = "on a table"
122
- cldm_cond_image = load_image("https://huggingface.co/lllyasviel/sd-controlnet-scribble/resolve/main/images/bag.png" ).resize((512, 512))
 
 
123
  hed = HEDdetector.from_pretrained("lllyasviel/Annotators")
124
  cldm_cond_image = hed(cldm_cond_image)
125
-
126
- style_image = load_image("https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/flower.jpg")
 
127
 
128
  guidance_scale = 7.5
129
  num_inference_steps = 50
@@ -132,7 +146,7 @@ negative_prompt = "over-exposure, under-exposure, saturated, duplicate, out of f
132
  output = blip_diffusion_pipe(
133
  text_prompt,
134
  style_image,
135
- cldm_cond_image,
136
  style_subject,
137
  tgt_subject,
138
  guidance_scale=guidance_scale,
@@ -140,8 +154,8 @@ output = blip_diffusion_pipe(
140
  neg_prompt=negative_prompt,
141
  height=512,
142
  width=512,
143
- )
144
- output[0][0].save("image.png"')
145
  ```
146
 
147
  Input Style Image : <img src="https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/flower.jpg" style="width:500px;"/>
 
31
  ```python
32
  from diffusers.pipelines import BlipDiffusionPipeline
33
  from diffusers.utils import load_image
34
+ import torch
35
 
36
+ blip_diffusion_pipe = BlipDiffusionPipeline.from_pretrained(
37
+ "ayushtues/blipdiffusion", torch_dtype=torch.float16
38
+ ).to("cuda")
39
 
40
  cond_subject = "dog"
41
  tgt_subject = "dog"
42
  text_prompt_input = "swimming underwater"
43
 
44
+ cond_image = load_image(
45
+ "https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/dog.jpg"
46
+ )
47
 
48
+ iter_seed = 88888
49
  guidance_scale = 7.5
50
+ num_inference_steps = 25
51
  negative_prompt = "over-exposure, under-exposure, saturated, duplicate, out of frame, lowres, cropped, worst quality, low quality, jpeg artifacts, morbid, mutilated, out of frame, ugly, bad anatomy, bad proportions, deformed, blurry, duplicate"
52
 
53
  output = blip_diffusion_pipe(
 
60
  neg_prompt=negative_prompt,
61
  height=512,
62
  width=512,
63
+ ).images
64
+ output[0].save("image.png")
65
  ```
66
  Input Image : <img src="https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/dog.jpg" style="width:500px;"/>
67
 
 
74
  from diffusers.utils import load_image
75
  from controlnet_aux import CannyDetector
76
 
77
+ blip_diffusion_pipe = BlipDiffusionControlNetPipeline.from_pretrained(
78
+ "ayushtues/blipdiffusion-controlnet", torch_dtype=torch.float16
79
+ ).to("cuda")
80
 
81
+ style_subject = "flower" # subject that defines the style
82
  tgt_subject = "teapot" # subject to generate.
83
  text_prompt = "on a marble table"
 
 
 
84
 
85
+ cldm_cond_image = load_image(
86
+ "https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/kettle.jpg"
87
+ ).resize((512, 512))
88
+ canny = CannyDetector()
89
+ cldm_cond_image = canny(cldm_cond_image, 30, 70, output_type="pil")
90
+ style_image = load_image(
91
+ "https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/flower.jpg"
92
+ )
93
 
94
  guidance_scale = 7.5
95
  num_inference_steps = 50
 
98
  output = blip_diffusion_pipe(
99
  text_prompt,
100
  style_image,
101
+ cldm_cond_image,
102
  style_subject,
103
  tgt_subject,
104
  guidance_scale=guidance_scale,
 
106
  neg_prompt=negative_prompt,
107
  height=512,
108
  width=512,
109
+ ).images
110
+ output[0].save("image.png")
111
  ```
112
 
113
  Input Style Image : <img src="https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/flower.jpg" style="width:500px;"/>
 
120
  from diffusers.utils import load_image
121
  from controlnet_aux import HEDdetector
122
 
123
+ blip_diffusion_pipe = BlipDiffusionControlNetPipeline.from_pretrained(
124
+ "ayushtues/blipdiffusion-controlnet"
125
+ )
126
  controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-scribble")
127
  blip_diffusion_pipe.controlnet = controlnet
128
+ blip_diffusion_pipe.to("cuda")
129
 
130
+ style_subject = "flower" # subject that defines the style
131
  tgt_subject = "bag" # subject to generate.
132
  text_prompt = "on a table"
133
+ cldm_cond_image = load_image(
134
+ "https://huggingface.co/lllyasviel/sd-controlnet-scribble/resolve/main/images/bag.png"
135
+ ).resize((512, 512))
136
  hed = HEDdetector.from_pretrained("lllyasviel/Annotators")
137
  cldm_cond_image = hed(cldm_cond_image)
138
+ style_image = load_image(
139
+ "https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/flower.jpg"
140
+ )
141
 
142
  guidance_scale = 7.5
143
  num_inference_steps = 50
 
146
  output = blip_diffusion_pipe(
147
  text_prompt,
148
  style_image,
149
+ cldm_cond_image,
150
  style_subject,
151
  tgt_subject,
152
  guidance_scale=guidance_scale,
 
154
  neg_prompt=negative_prompt,
155
  height=512,
156
  width=512,
157
+ ).images
158
+ output[0].save("image.png")
159
  ```
160
 
161
  Input Style Image : <img src="https://huggingface.co/datasets/ayushtues/blipdiffusion_images/resolve/main/flower.jpg" style="width:500px;"/>