#Using OpenAI API to edit photos

2 messages · Page 1 of 1 (latest)

inner scroll
#

Hello,

I used Python (flask) to create a program that connects to the api and allows me to upload images to a html page and then have them be edited according to a prompt i give it.

I'm happy to share the code if needed. Everything works fine, but I'm unable to actually edit the photo successfully. When I upload images, the program always returns the following error message:

openai.error.InvalidRequestError: Uploaded image must be a PNG and less than 4 MB.

I have ensured that the image is a png, the right size (512 x 512) and less than 4 mb (its 311kb). but no matter what i do i get this error message. i have been able to upload other pictures, but when i do i usually get the error message that the photo must be in RGB format (not P), even though I have checked and it is in RGB format.

So I'm just confused and I'm not sure how to proceed.

Attaching my code and the html files. Thank you so much to anyone who can provide help. I think I'm really close to getting this to work.