Skip to content

Commit

Permalink
Merge pull request #691 from yangcao77/main
Browse files Browse the repository at this point in the history
fix the photo upload issue in object detection app
  • Loading branch information
rhatdan authored Jul 25, 2024
2 parents 340d7f5 + 860393e commit a508f36
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 a508f36

Please sign in to comment.