Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -113,6 +113,14 @@ def find_similar_images(query_embedding, top_k=5):
|
|
113 |
})
|
114 |
return results
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
def detect_clothing(image):
|
117 |
results = yolo_model(image)
|
118 |
detections = results[0].boxes.data.cpu().numpy()
|
@@ -120,7 +128,7 @@ def detect_clothing(image):
|
|
120 |
for detection in detections:
|
121 |
x1, y1, x2, y2, conf, cls = detection
|
122 |
category = yolo_model.names[int(cls)]
|
123 |
-
if category in labels
|
124 |
categories.append({
|
125 |
'category': category,
|
126 |
'bbox': [int(x1), int(y1), int(x2), int(y2)],
|
|
|
113 |
})
|
114 |
return results
|
115 |
|
116 |
+
# 먼저 라벨 리스트를 정의합니다
|
117 |
+
labels = [
|
118 |
+
"bag", "coat", "dress", "fabric", "hat", "Hoodie", "jacket", "Jacket",
|
119 |
+
"jean", "m2m", "Mid-lenght dress", "Pants", "plain", "shirt", "Shirt",
|
120 |
+
"shoe", "short", "shorts", "skirt", "slacks", "suit", "sunglass",
|
121 |
+
"sweat", "tie", "tracksuit", "tshirt"
|
122 |
+
]
|
123 |
+
|
124 |
def detect_clothing(image):
|
125 |
results = yolo_model(image)
|
126 |
detections = results[0].boxes.data.cpu().numpy()
|
|
|
128 |
for detection in detections:
|
129 |
x1, y1, x2, y2, conf, cls = detection
|
130 |
category = yolo_model.names[int(cls)]
|
131 |
+
if category in labels:
|
132 |
categories.append({
|
133 |
'category': category,
|
134 |
'bbox': [int(x1), int(y1), int(x2), int(y2)],
|