Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -157,11 +157,13 @@ def get_most_common_label(responses):
|
|
157 |
def get_predicted_attributes(image_urls, category):
|
158 |
# Assuming ATTRIBUTES_DICT and pipe are defined outside this function
|
159 |
attributes = list(ATTRIBUTES_DICT.get(category, {}).keys())
|
160 |
-
|
|
|
161 |
# Mapping of possible values per attribute
|
162 |
common_result = []
|
163 |
for attribute in attributes:
|
164 |
values = ATTRIBUTES_DICT.get(category, {}).get(attribute, [])
|
|
|
165 |
|
166 |
if len(values) == 0:
|
167 |
continue
|
@@ -174,6 +176,7 @@ def get_predicted_attributes(image_urls, category):
|
|
174 |
responses = pipe(image_urls, candidate_labels=values)
|
175 |
most_common, score = get_most_common_label(responses)
|
176 |
common_result.append(most_common)
|
|
|
177 |
|
178 |
if attribute == "details":
|
179 |
# Process additional details labels if the score is higher than 0.8
|
|
|
157 |
def get_predicted_attributes(image_urls, category):
|
158 |
# Assuming ATTRIBUTES_DICT and pipe are defined outside this function
|
159 |
attributes = list(ATTRIBUTES_DICT.get(category, {}).keys())
|
160 |
+
print(category, attributes)
|
161 |
+
|
162 |
# Mapping of possible values per attribute
|
163 |
common_result = []
|
164 |
for attribute in attributes:
|
165 |
values = ATTRIBUTES_DICT.get(category, {}).get(attribute, [])
|
166 |
+
print(attribute, values)
|
167 |
|
168 |
if len(values) == 0:
|
169 |
continue
|
|
|
176 |
responses = pipe(image_urls, candidate_labels=values)
|
177 |
most_common, score = get_most_common_label(responses)
|
178 |
common_result.append(most_common)
|
179 |
+
print(common_result)
|
180 |
|
181 |
if attribute == "details":
|
182 |
# Process additional details labels if the score is higher than 0.8
|