kd5678 commited on
Commit
92adf64
1 Parent(s): 95cf596

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -0
README.md CHANGED
@@ -9,5 +9,34 @@ Our code and dataset are publicly available at https://prefpaint.github.io.
9
  # Usage
10
 
11
  ```bash
 
 
 
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ```
 
9
  # Usage
10
 
11
  ```bash
12
+ import os
13
+ from PIL import Image
14
+ from diffusers import AutoPipelineForInpainting
15
 
16
+ pipe = AutoPipelineForInpainting.from_pretrained(
17
+ 'kd5678/prefpaint-v1.0', cache_dir='/data/kendong/cache')
18
+ pipe = pipe.to("cuda")
19
+
20
+ color_path = 'images.png'
21
+ mask_path = 'mask.png'
22
+ save_path = './results'
23
+ os.makedirs(save_path, exist_ok=True)
24
+
25
+ image, mask = Image.open(color_path), Image.open(mask_path).convert('L')
26
+ # You can provide your prompt here.
27
+ prompt = " "
28
+ result = pipe(prompt=prompt, image=image, mask_image=mask, eta=1.0).images[0]
29
+ result.save(os.path.join(save_path, 'results.png'))
30
+
31
+ ```
32
+
33
+ # How to Cite
34
+
35
+ ```
36
+ @article{liu2024prefpaint,
37
+ title={PrefPaint: Aligning Image Inpainting Diffusion Model with Human Preference},
38
+ author={Liu, Kendong and Zhu, Zhiyu and Li, Chuanhao and Liu, Hui and Zeng, Huanqiang and Hou, Junhui},
39
+ journal={arXiv preprint arXiv:2410.21966},
40
+ year={2024}
41
+ }
42
  ```