Update app.py
Browse files
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
|
|
|
|
|
|
|
|
|
|
| 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()
|