Views
No views yet
1import os
2from PIL import Image
3from diffusers import AutoPipelineForInpainting
4
5pipe = AutoPipelineForInpainting.from_pretrained(
6 'kd5678/prefpaint-v1.0', cache_dir='/data/kendong/cache')
7pipe = pipe.to("cuda")
8
9color_path = 'images.png'
10mask_path = 'mask.png'
11save_path = './results'
12os.makedirs(save_path, exist_ok=True)
13
14image, mask = Image.open(color_path), Image.open(mask_path).convert('L')
15# You can provide your prompt here.
16prompt = " "
17result = pipe(prompt=prompt, image=image, mask_image=mask, eta=1.0).images[0]
18result.save(os.path.join(save_path, 'results.png'))
19 @article{liu2024prefpaint,
title={PrefPaint: Aligning Image Inpainting Diffusion Model with Human Preference},
author={Liu, Kendong and Zhu, Zhiyu and Li, Chuanhao and Liu, Hui and Zeng, Huanqiang and Hou, Junhui},
journal={arXiv preprint arXiv:2410.21966},
year={2024}
}