chuckma commited on
Commit
ab24a23
·
verified ·
1 Parent(s): cba2fd5

create readme

Browse files
Files changed (1) hide show
  1. README.md +21 -0
README.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ```python
2
+ import torch
3
+ from diffusers import AutoPipelineForInpainting
4
+ from diffusers.utils import load_image, make_image_grid
5
+
6
+ pipeline = AutoPipelineForInpainting.from_pretrained(
7
+ "chuckma/fooocus_inpainting_v2", torch_dtype=torch.float16, variant="fp16"
8
+ )
9
+ pipeline.enable_model_cpu_offload()
10
+ # remove following line if xFormers is not installed or you have PyTorch 2.0 or higher installed
11
+ # pipeline.enable_xformers_memory_efficient_attention()
12
+
13
+ # load base and mask image
14
+ init_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/inpaint.png")
15
+ mask_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/inpaint_mask.png")
16
+
17
+ generator = torch.Generator("cuda").manual_seed(92)
18
+ prompt = "concept art digital painting of an elven castle, inspired by lord of the rings, highly detailed, 8k"
19
+ image = pipeline(prompt=prompt, image=init_image, mask_image=mask_image, generator=generator).images[0]
20
+ make_image_grid([init_image, image], rows=1, cols=2)
21
+ ```