Measterly commited on
Commit
8dcc5f7
·
verified ·
1 Parent(s): 988a5be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -63,7 +63,10 @@ elif input_method == "Upload an image":
63
  st.image(image, caption="Uploaded Image", use_column_width=True)
64
  description = st.text_area("(Optional) Add additional details about the item")
65
 
66
- # Convert image to base64 if needed for future improvements
 
 
 
67
  img_bytes = io.BytesIO()
68
  image.save(img_bytes, format="JPEG")
69
  img_bytes = img_bytes.getvalue()
 
63
  st.image(image, caption="Uploaded Image", use_column_width=True)
64
  description = st.text_area("(Optional) Add additional details about the item")
65
 
66
+ # Convert image to RGB mode before saving as JPEG
67
+ if image.mode == "RGBA":
68
+ image = image.convert("RGB")
69
+
70
  img_bytes = io.BytesIO()
71
  image.save(img_bytes, format="JPEG")
72
  img_bytes = img_bytes.getvalue()