dalle2-in-python icon indicating copy to clipboard operation
dalle2-in-python copied to clipboard

Inpainting example for the masked image doesn't work

Open KyriaAnnwyn opened this issue 3 years ago • 2 comments

Try to test inpainting as in description. I get the error: ... <Image decoded data> }} is not valid under any of the given schemas", "type": "invalid_request_error", "param": null, "code": null } }

The case with only text prompt works ok.

KyriaAnnwyn avatar Oct 06 '22 12:10 KyriaAnnwyn

can you provide more information for this please? @KyriaAnnwyn

ezzcodeezzlife avatar Oct 11 '22 15:10 ezzcodeezzlife

I'm trying to run the example from the repo:

# make the right half of a saved image transparent
from PIL import Image, ImageDraw

image = Image.open('my_image.png')
m, n = image.size

area_to_keep = (0, 0, m//2, n)
image_alpha = Image.new("L", image.size, 0)
draw = ImageDraw.Draw(image_alpha)
draw.rectangle(area_to_keep, fill=255)

image_rgba = image.copy()
image_rgba.putalpha(image_alpha)
image_rgba = image_rgba.resize((1024, 1024)) # image must be square and 1024x1024
image_rgba.save('image_with_transparent_right_half.png')

# ask DALL·E to fill-in the transparent right half
generations = dalle.generate_from_masked_image(
    "portal to another dimension, digital art",
    "image_with_transparent_right_half.png",
)

and it fails with the error invalid_request error

The session is ok as the example with text prompt works well.

If you need more information, please specify what kind of information, i'll add it.

KyriaAnnwyn avatar Oct 12 '22 06:10 KyriaAnnwyn