Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -113,7 +113,7 @@ def detect_clothing(image):
|
|
113 |
for detection in detections:
|
114 |
x1, y1, x2, y2, conf, cls = detection
|
115 |
category = yolo_model.names[int(cls)]
|
116 |
-
if category in ['
|
117 |
categories.append({
|
118 |
'category': category,
|
119 |
'bbox': [int(x1), int(y1), int(x2), int(y2)],
|
@@ -146,6 +146,7 @@ if search_type == "Image URL":
|
|
146 |
if st.button("Search Similar Items"):
|
147 |
selected_detection = next(d for d in detections if f"{d['category']} (Confidence: {d['confidence']:.2f})" == selected_category)
|
148 |
cropped_image = crop_image(query_image, selected_detection['bbox'])
|
|
|
149 |
query_embedding = get_image_embedding(cropped_image)
|
150 |
similar_images = find_similar_images(query_embedding)
|
151 |
|
|
|
113 |
for detection in detections:
|
114 |
x1, y1, x2, y2, conf, cls = detection
|
115 |
category = yolo_model.names[int(cls)]
|
116 |
+
if category in ['sunglass','hat','jacket','shirt','pants','shorts','skirt','dress','bag','shoe']:
|
117 |
categories.append({
|
118 |
'category': category,
|
119 |
'bbox': [int(x1), int(y1), int(x2), int(y2)],
|
|
|
146 |
if st.button("Search Similar Items"):
|
147 |
selected_detection = next(d for d in detections if f"{d['category']} (Confidence: {d['confidence']:.2f})" == selected_category)
|
148 |
cropped_image = crop_image(query_image, selected_detection['bbox'])
|
149 |
+
st.image(cropped_image, caption="Cropped Image", use_column_width=True)
|
150 |
query_embedding = get_image_embedding(cropped_image)
|
151 |
similar_images = find_similar_images(query_embedding)
|
152 |
|