LakshmiHarika commited on
Commit
6738958
·
verified ·
1 Parent(s): 326887a

Update pages/Data Collection.py

Browse files
Files changed (1) hide show
  1. pages/Data Collection.py +14 -6
pages/Data Collection.py CHANGED
@@ -1853,13 +1853,20 @@ elif st.session_state.current_page == "image_transformations":
1853
  transformed_images.append(transformed_image)
1854
 
1855
  return transformed_images
1856
-
1857
  # Streamlit App
1858
  st.title("Dynamic Affine Transformation Tool")
1859
  st.write("Select a transformation type to proceed and learn how it works before uploading an image.")
1860
 
1861
- # Provide guidance based on the selected transformation
1862
- if transformation:
 
 
 
 
 
 
 
1863
  if transformation == "Rotation":
1864
  st.info("Rotation rotates the image around a fixed point. Angles are applied in steps of 10 degrees.")
1865
  elif transformation == "Scaling":
@@ -1870,8 +1877,8 @@ elif st.session_state.current_page == "image_transformations":
1870
  st.info("Shearing skews the image along the x-axis or y-axis, creating a slanted effect.")
1871
  elif transformation == "Cropping":
1872
  st.info("Cropping trims the image edges step by step to focus on a smaller region.")
1873
-
1874
- if transformation:
1875
  uploaded_file = st.file_uploader("Step 2: Now, upload an image", type=["jpg", "jpeg", "png"])
1876
 
1877
  if uploaded_file:
@@ -1907,7 +1914,8 @@ elif st.session_state.current_page == "image_transformations":
1907
  file_name=f"{transformation}_transformed_images.zip",
1908
  mime="application/zip"
1909
  )
1910
-
 
1911
 
1912
  col1, col2 = st.columns(2)
1913
  with col1:
 
1853
  transformed_images.append(transformed_image)
1854
 
1855
  return transformed_images
1856
+
1857
  # Streamlit App
1858
  st.title("Dynamic Affine Transformation Tool")
1859
  st.write("Select a transformation type to proceed and learn how it works before uploading an image.")
1860
 
1861
+ # Transformation Options
1862
+ transformation = st.selectbox(
1863
+ "Step 1: Select a transformation type:",
1864
+ ["Select a Transformation", "Rotation", "Scaling", "Translation", "Shearing", "Cropping"]
1865
+ )
1866
+
1867
+ # Ensure the user selects a valid transformation
1868
+ if transformation != "Select a Transformation":
1869
+ # Provide guidance based on the selected transformation
1870
  if transformation == "Rotation":
1871
  st.info("Rotation rotates the image around a fixed point. Angles are applied in steps of 10 degrees.")
1872
  elif transformation == "Scaling":
 
1877
  st.info("Shearing skews the image along the x-axis or y-axis, creating a slanted effect.")
1878
  elif transformation == "Cropping":
1879
  st.info("Cropping trims the image edges step by step to focus on a smaller region.")
1880
+
1881
+ # Image Uploader (Only appears after selection)
1882
  uploaded_file = st.file_uploader("Step 2: Now, upload an image", type=["jpg", "jpeg", "png"])
1883
 
1884
  if uploaded_file:
 
1914
  file_name=f"{transformation}_transformed_images.zip",
1915
  mime="application/zip"
1916
  )
1917
+ else:
1918
+ st.warning("Please select a valid transformation type to proceed.")
1919
 
1920
  col1, col2 = st.columns(2)
1921
  with col1: