leedoming commited on
Commit
f43a9e6
1 Parent(s): 77e6c3d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -155,11 +155,22 @@ if st.session_state.step == 'input':
155
  else:
156
  st.warning("Please enter an image URL.")
157
 
 
158
  elif st.session_state.step == 'select_category':
159
  st.image(st.session_state.query_image, caption="Query Image", use_column_width=True)
160
  st.subheader("Detected Clothing Items:")
 
 
 
 
 
 
 
 
 
161
  options = [f"{d['category']} (Confidence: {d['confidence']:.2f})" for d in st.session_state.detections]
162
  selected_option = st.selectbox("Select a category to search:", options)
 
163
  if st.button("Search Similar Items"):
164
  st.session_state.selected_category = selected_option
165
  st.session_state.step = 'show_results'
 
155
  else:
156
  st.warning("Please enter an image URL.")
157
 
158
+ # Update the 'select_category' step
159
  elif st.session_state.step == 'select_category':
160
  st.image(st.session_state.query_image, caption="Query Image", use_column_width=True)
161
  st.subheader("Detected Clothing Items:")
162
+
163
+ for detection in st.session_state.detections:
164
+ col1, col2 = st.columns([1, 3])
165
+ with col1:
166
+ st.write(f"{detection['category']} (Confidence: {detection['confidence']:.2f})")
167
+ with col2:
168
+ cropped_image = crop_image(st.session_state.query_image, detection['bbox'])
169
+ st.image(cropped_image, caption=detection['category'], use_column_width=True)
170
+
171
  options = [f"{d['category']} (Confidence: {d['confidence']:.2f})" for d in st.session_state.detections]
172
  selected_option = st.selectbox("Select a category to search:", options)
173
+
174
  if st.button("Search Similar Items"):
175
  st.session_state.selected_category = selected_option
176
  st.session_state.step = 'show_results'