Pairavi commited on
Commit
2cbc400
·
1 Parent(s): 3cd6ad5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -105,8 +105,11 @@ def main():
105
  # Convert the uploaded image to an array using the read_image function
106
  image = read_image(uploaded_image)
107
 
108
- # Display the uploaded image
109
- st.image(image, caption="Query Image", width=224, height = 224)
 
 
 
110
 
111
  # Find similar images
112
  similar_images, length = find_similar_images(image)
@@ -114,6 +117,8 @@ def main():
114
  # Calculate the total number of pages required
115
  total_pages = (length + images_per_page - 1) // images_per_page
116
 
 
 
117
  # Calculate the range of images to display for the selected page
118
  start_index = (page_number - 1) * images_per_page
119
  end_index = min(start_index + images_per_page, length)
@@ -145,12 +150,6 @@ def main():
145
  st.write(f"Could not find details for image with ID: {img_id}")
146
 
147
 
148
- with st.container():
149
- st.write("Page Selector")
150
- page_number = st.number_input("Page", min_value=1, max_value=20, step=1, value=1)
151
-
152
-
153
-
154
 
155
  if __name__ == '__main__':
156
  main()
 
105
  # Convert the uploaded image to an array using the read_image function
106
  image = read_image(uploaded_image)
107
 
108
+ image = Image.fromarray(image)
109
+ image = image.resize((224, 224))
110
+
111
+ # Display the resized image
112
+ st.image(image, caption="Query Image", width=224)
113
 
114
  # Find similar images
115
  similar_images, length = find_similar_images(image)
 
117
  # Calculate the total number of pages required
118
  total_pages = (length + images_per_page - 1) // images_per_page
119
 
120
+ page_number = st.slider("Select Page", min_value=1, max_value=num_pages)
121
+
122
  # Calculate the range of images to display for the selected page
123
  start_index = (page_number - 1) * images_per_page
124
  end_index = min(start_index + images_per_page, length)
 
150
  st.write(f"Could not find details for image with ID: {img_id}")
151
 
152
 
 
 
 
 
 
 
153
 
154
  if __name__ == '__main__':
155
  main()