Not-Adam commited on
Commit
adb12ac
1 Parent(s): a68aec8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -17
app.py CHANGED
@@ -169,23 +169,23 @@ def get_predicted_attributes(image_urls, category):
169
  continue
170
 
171
  # Adjust labels for the pipeline
172
- attribute = attribute.replace("colartype", "collar").replace("sleevelength", "sleeve length").replace("fabricstyle", "fabric")
173
- values = [f"{attribute}: {value.strip()}, clothing: {category}" for value in values]
174
-
175
- # Get the predicted values for the attribute
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
183
- for _ in range(2):
184
- values = [value for value in values if value != f"{most_common}, clothing: {category}"]
185
- responses = pipe(image_urls, candidate_labels=values)
186
- most_common, score = get_most_common_label(responses)
187
- if score > 0.8:
188
- common_result.append(most_common)
189
 
190
  # Convert common_result into a dictionary
191
  final = {}
 
169
  continue
170
 
171
  # Adjust labels for the pipeline
172
+ attribute = attribute.replace("colartype", "collar").replace("sleevelength", "sleeve length").replace("fabricstyle", "fabric")
173
+ values = [f"{attribute}: {value.strip()}, clothing: {category}" for value in values]
174
+
175
+ # Get the predicted values for the attribute
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
183
+ for _ in range(2):
184
+ values = [value for value in values if value != f"{most_common}, clothing: {category}"]
185
+ responses = pipe(image_urls, candidate_labels=values)
186
+ most_common, score = get_most_common_label(responses)
187
+ if score > 0.8:
188
+ common_result.append(most_common)
189
 
190
  # Convert common_result into a dictionary
191
  final = {}