Skip to content

Commit bcb6cc1

Browse files
authored
Updates Image to Image Inpainting community pipeline README (#1370)
* updates img2img_inpainting README * Adds example image to community pipeline README
1 parent 4d1e4e2 commit bcb6cc1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

examples/community/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ For example, this could be used to place a logo on a shirt and make it blend sea
602602
import PIL
603603
import torch
604604

605-
from diffusers import StableDiffusionInpaintPipeline
605+
from diffusers import DiffusionPipeline
606606

607607
image_path = "./path-to-image.png"
608608
inner_image_path = "./path-to-inner-image.png"
@@ -612,17 +612,20 @@ init_image = PIL.Image.open(image_path).convert("RGB").resize((512, 512))
612612
inner_image = PIL.Image.open(inner_image_path).convert("RGBA").resize((512, 512))
613613
mask_image = PIL.Image.open(mask_path).convert("RGB").resize((512, 512))
614614

615-
pipe = StableDiffusionInpaintPipeline.from_pretrained(
615+
pipe = DiffusionPipeline.from_pretrained(
616616
"runwayml/stable-diffusion-inpainting",
617+
custom_pipeline="img2img_inpainting",
617618
revision="fp16",
618-
torch_dtype=torch.float16,
619+
torch_dtype=torch.float16
619620
)
620621
pipe = pipe.to("cuda")
621622

622623
prompt = "Your prompt here!"
623624
image = pipe(prompt=prompt, image=init_image, inner_image=inner_image, mask_image=mask_image).images[0]
624625
```
625626

627+
![2 by 2 grid demonstrating image to image inpainting.](https://user-images.githubusercontent.com/44398246/203506577-ec303be4-887e-4ebd-a773-c83fcb3dd01a.png)
628+
626629
### Text Based Inpainting Stable Diffusion
627630

628631
Use a text prompt to generate the mask for the area to be inpainted.

0 commit comments

Comments
 (0)