Update app.py
Browse files
app.py
CHANGED
@@ -63,13 +63,15 @@ uploaded_image = st.sidebar.file_uploader("Upload your image here", type=["jpg",
|
|
63 |
# Display the uploaded image and process it if available
|
64 |
if uploaded_image is not None:
|
65 |
image = Image.open(uploaded_image)
|
|
|
|
|
66 |
image = image.resize((256,256))
|
67 |
|
68 |
# Save the image to a BytesIO object with a specific format
|
69 |
image_bytes = io.BytesIO()
|
70 |
image_format = image.format if image.format else 'PNG' # Default to 'PNG' if format is None
|
71 |
image.save(image_bytes, format=image_format)
|
72 |
-
|
73 |
# Display the image using Streamlit
|
74 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
75 |
image_binary = image_bytes.getvalue()
|
|
|
63 |
# Display the uploaded image and process it if available
|
64 |
if uploaded_image is not None:
|
65 |
image = Image.open(uploaded_image)
|
66 |
+
if image.mode != 'RGB':
|
67 |
+
image = image.convert('RGB')
|
68 |
image = image.resize((256,256))
|
69 |
|
70 |
# Save the image to a BytesIO object with a specific format
|
71 |
image_bytes = io.BytesIO()
|
72 |
image_format = image.format if image.format else 'PNG' # Default to 'PNG' if format is None
|
73 |
image.save(image_bytes, format=image_format)
|
74 |
+
image_bytes.seek(0)
|
75 |
# Display the image using Streamlit
|
76 |
st.image(image, caption="Uploaded Image", use_column_width=True)
|
77 |
image_binary = image_bytes.getvalue()
|