Mpavan45 commited on
Commit
2f98247
·
verified ·
1 Parent(s): 04cb461

Update Image Augmentation.py

Browse files
Files changed (1) hide show
  1. Image Augmentation.py +6 -5
Image Augmentation.py CHANGED
@@ -84,6 +84,8 @@ if uploaded_file:
84
  blur = st.checkbox("Blur (5x5 Kernel)")
85
  translate = st.checkbox("Translate (50 pixels right and down)")
86
 
 
 
87
  if st.button("Apply Transformations"):
88
  transformed_image = image.copy()
89
 
@@ -98,14 +100,13 @@ if uploaded_file:
98
 
99
  st.image(cv2.cvtColor(transformed_image, cv2.COLOR_BGR2RGB), caption="Transformed Image", use_column_width=True)
100
 
101
- # Provide download options after transformations
102
  if transformed_image is not None:
103
  st.markdown("### Download Transformed Image:")
104
  download_format = st.radio("Select Download Format:", ["JPG", "PNG", "PDF"], key="download_format")
105
 
106
- if download_format == "JPG":
107
- st.markdown(download_image(transformed_image, download_format), unsafe_allow_html=True)
108
- elif download_format == "PNG":
109
  st.markdown(download_image(transformed_image, download_format), unsafe_allow_html=True)
110
  elif download_format == "PDF":
111
- st.markdown(download_pdf(transformed_image, download_format), unsafe_allow_html=True)
 
 
84
  blur = st.checkbox("Blur (5x5 Kernel)")
85
  translate = st.checkbox("Translate (50 pixels right and down)")
86
 
87
+ transformed_image = None # Initialize transformed_image
88
+
89
  if st.button("Apply Transformations"):
90
  transformed_image = image.copy()
91
 
 
100
 
101
  st.image(cv2.cvtColor(transformed_image, cv2.COLOR_BGR2RGB), caption="Transformed Image", use_column_width=True)
102
 
103
+ # Provide download options after transformations
104
  if transformed_image is not None:
105
  st.markdown("### Download Transformed Image:")
106
  download_format = st.radio("Select Download Format:", ["JPG", "PNG", "PDF"], key="download_format")
107
 
108
+ if download_format == "JPG" or download_format == "PNG":
 
 
109
  st.markdown(download_image(transformed_image, download_format), unsafe_allow_html=True)
110
  elif download_format == "PDF":
111
+ st.markdown(download_pdf(transformed_image), unsafe_allow_html=True)
112
+