Closed BluePigman closed 3 months ago
I tried to run your code on Colab and faced the same issue Please find the gist here for reference. Thanks!
I tried to run your code on Colab and faced the same issue Please find the gist here for reference. Thanks!
You leaked your API key, just letting you know.
Ah, I see, thanks for reporting.
It looks like my first fix was junk. It looks like I can probably use img.get_format_mimetype()
to resolve this for all supported mime-types.
@BluePigman @manojssmk please have a look at the fix in #523 and LMK if you have any feedback.
Looks good to me!
Fixed.
Description of the bug:
Currently P mode images cannot be uploaded to Gemini. https://pillow.readthedocs.io/en/stable/handbook/concepts.html#modes
Actual vs expected behavior:
Actual: Running this code gives the errors: KeyError: 'P' OSError: cannot write mode P as JPEG
Expected: If we add the following line before generating the response
The code runs with no errors.
Any other information you'd like to share?
This is similar to this issue solved previously: https://github.com/google-gemini/generative-ai-python/issues/160