ai-forever / ai-forever/Kandinsky-2

what is wrong with inpaint background?

未关闭
#95 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Jupyter Notebook
星标
2.8k
派生
319
PR 合并指标
30 天内没有已合并 PR

描述

![a](https://github.com/ai-forever/Kandinsky-2/assets/1147704/cb76acfa-7227-488e-a65d-dcdb52a53595)
![amsk](https://github.com/ai-forever/Kandinsky-2/assets/1147704/05899acf-1bf2-40af-b5f8-bf7a2c02820b)
![mask123](https://github.com/ai-forever/Kandinsky-2/assets/1147704/0b777daf-54d7-4bcb-8ee7-f7b42357ab73)
![download (7)](https://github.com/ai-forever/Kandinsky-2/assets/1147704/a3627785-fe60-4447-b8e9-0f29a2e1a582)

```py
import torch
import numpy as np
from PIL import Image, ImageOps
from diffusers import AutoPipelineForInpainting
import rembg

modelName = 'kandinsky-community/kandinsky-2-2-decoder-inpaint'

pipe = AutoPipelineForInpainting.from_pretrained(modelName, torch_dtype = torch.float16).to('cuda')
# pipe.enable_model_cpu_offload()

prompt = 'young lady, in front of garden, beautiful, 4k'

image = Image.open('./a.jpg')
mask = Image.open('./mask123.png').convert('RGB')
# mask = ImageOps.invert(mask)
# mask = mask.convert('L')
# mask = np.array(mask)

image = pipe(
image = image,
mask_image = mask,
prompt = prompt,
width = image.width,
height = image.height,
num_inference_steps = 50,
# prior_steps = 10,
).images[0]

display(image)
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。