Skip to content

Commit

Permalink
fix the photo upload issue
Browse files Browse the repository at this point in the history
Signed-off-by: Stephanie <[email protected]>
  • Loading branch information
yangcao77 committed Jul 24, 2024
1 parent 9465129 commit 860393e
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
window.image(img, use_column_width=True)
# convert PIL image into bytes for post request
bytes_io = io.BytesIO()
if img.mode in ("RGBA", "P"):
img = img.convert("RGB")
img.save(bytes_io, "JPEG")
img_bytes = bytes_io.getvalue()
b64_image = base64.b64encode(img_bytes).decode('utf-8')
Expand Down

0 comments on commit 860393e

Please sign in to comment.