Update pages/4_Image Augmentation.py
Browse files
pages/4_Image Augmentation.py
CHANGED
|
@@ -39,7 +39,7 @@ def get_image_download_link(img_array, filename, text):
|
|
| 39 |
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
| 40 |
if uploaded_file is not None:
|
| 41 |
image = Image.open(uploaded_file)
|
| 42 |
-
st.image(image, caption='Uploaded Image.',
|
| 43 |
st.write("")
|
| 44 |
st.write("Select the augmentation operations you want to apply:")
|
| 45 |
|
|
@@ -96,9 +96,9 @@ if uploaded_file is not None:
|
|
| 96 |
if convert_gray:
|
| 97 |
img_array_gray = cv2.cvtColor(img_array, cv2.COLOR_RGB2GRAY)
|
| 98 |
img_array_gray = cv2.cvtColor(img_array_gray, cv2.COLOR_GRAY2RGB) # Convert back to RGB for consistency
|
| 99 |
-
st.image(img_array_gray, caption='Grayscale Image.',
|
| 100 |
st.markdown(get_image_download_link(img_array_gray, "grayscale.jpg", "Download Grayscale Image"), unsafe_allow_html=True)
|
| 101 |
|
| 102 |
-
# Convert numpy array back to image
|
| 103 |
-
|
| 104 |
-
|
|
|
|
| 39 |
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
| 40 |
if uploaded_file is not None:
|
| 41 |
image = Image.open(uploaded_file)
|
| 42 |
+
st.image(image, caption='Uploaded Image.', use_container_width=True)
|
| 43 |
st.write("")
|
| 44 |
st.write("Select the augmentation operations you want to apply:")
|
| 45 |
|
|
|
|
| 96 |
if convert_gray:
|
| 97 |
img_array_gray = cv2.cvtColor(img_array, cv2.COLOR_RGB2GRAY)
|
| 98 |
img_array_gray = cv2.cvtColor(img_array_gray, cv2.COLOR_GRAY2RGB) # Convert back to RGB for consistency
|
| 99 |
+
st.image(img_array_gray, caption='Grayscale Image.', use_container_width=True)
|
| 100 |
st.markdown(get_image_download_link(img_array_gray, "grayscale.jpg", "Download Grayscale Image"), unsafe_allow_html=True)
|
| 101 |
|
| 102 |
+
# Convert numpy array back to image
|
| 103 |
+
augmented_image = Image.fromarray(img_array)
|
| 104 |
+
st.image(augmented_image, caption='Augmented Image.', use_container_width=True)
|