Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
Change-Id: Ifb93c70f8ad48dce0fd0921de0e9e117819dc55c
  • Loading branch information
MarkDaoust committed Aug 23, 2024
1 parent 9fa575d commit e7b802c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion google/generativeai/types/content_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def pil_to_blob(img):
mime_type = "image/gif"
else:
if img.mode != "RGB":
img = img.convert('RGB')
img = img.convert("RGB")
img.save(bytesio, format="JPEG")
mime_type = "image/jpeg"
bytesio.seek(0)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
TEST_GIF_URL = "https://storage.googleapis.com/generativeai-downloads/data/test_img.gif"
TEST_GIF_DATA = TEST_GIF_PATH.read_bytes()


# simple test function
def datetime():
"Returns the current UTC date and time."
Expand Down Expand Up @@ -93,7 +94,7 @@ def test_jpg_to_blob(self, image):

@parameterized.named_parameters(
["PIL", PIL.Image.open(TEST_GIF_PATH)],
["P", PIL.Image.fromarray(np.zeros([6, 6, 3], dtype=np.uint8)).convert('P')],
["P", PIL.Image.fromarray(np.zeros([6, 6, 3], dtype=np.uint8)).convert("P")],
["IPython", IPython.display.Image(filename=TEST_GIF_PATH)],
)
def test_gif_to_blob(self, image):
Expand Down

0 comments on commit e7b802c

Please sign in to comment.