BleachNick
commited on
Commit
•
3355bc4
1
Parent(s):
6a3ffbb
Update README.md
Browse files
README.md
CHANGED
@@ -14,7 +14,39 @@ library_name: diffusers
|
|
14 |
|
15 |
<!-- Provide a longer summary of what this model is. -->
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
- **Developed by:** [More Information Needed]
|
20 |
- **Funded by [optional]:** [More Information Needed]
|
|
|
14 |
|
15 |
<!-- Provide a longer summary of what this model is. -->
|
16 |
|
17 |
+
StableDiffusion3 model trained with the UltraEdit data to perform the mask-based and free-form image editing.
|
18 |
+
|
19 |
+
You can get the modified verson of diffusers from the github [Page](https://github.com/HaozheZhao/UltraEdit): `cd diffusers && pip install -e .`. And then you can run:
|
20 |
+
|
21 |
+
```python
|
22 |
+
# For Editing with SD3
|
23 |
+
import torch
|
24 |
+
from diffusers import StableDiffusion3InstructPix2PixPipeline
|
25 |
+
from diffusers.utils import load_image
|
26 |
+
import requests
|
27 |
+
import PIL.Image
|
28 |
+
|
29 |
+
pipe = StableDiffusion3InstructPix2PixPipeline.from_pretrained("BleachNick/SD3_UltraEdit_w_mask", torch_dtype=torch.float16)
|
30 |
+
pipe = pipe.to("cuda")
|
31 |
+
prompt="What if the horse wears a hat?"
|
32 |
+
img = load_image("input.png").resize((512, 512))
|
33 |
+
mask_img = load_image("mask_img.png").resize(img.size)
|
34 |
+
# For free form Editing, seed a blank mask
|
35 |
+
# mask_img = PIL.Image.new("RGB", img.size, (255, 255, 255))
|
36 |
+
image = pipe(
|
37 |
+
prompt,
|
38 |
+
image=img,
|
39 |
+
mask_img=mask_img,
|
40 |
+
negative_prompt="",
|
41 |
+
num_inference_steps=50,
|
42 |
+
image_guidance_scale=1.5,
|
43 |
+
guidance_scale=7.5,
|
44 |
+
).images[0]
|
45 |
+
image.save("edited_image.png")
|
46 |
+
# display image
|
47 |
+
|
48 |
+
|
49 |
+
```
|
50 |
|
51 |
- **Developed by:** [More Information Needed]
|
52 |
- **Funded by [optional]:** [More Information Needed]
|