Not-Adam commited on
Commit
31ca29b
·
verified ·
1 Parent(s): a14139b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -161,7 +161,7 @@ def get_predicted_attributes(image_urls, category):
161
 
162
  # Adjust labels for the pipeline to be in format: "{attr}: {value}, clothing: {category}"
163
  attribute_formatted = attribute.replace("colartype", "collar").replace("sleevelength", "sleeve length").replace("fabricstyle", "fabric")
164
- values_formatted = [f"{attribute_formatted}: {value.trim()}, clothing: {category}" for value in values]
165
 
166
  # Get the predicted values for the attribute
167
  responses = pipe(image_urls, candidate_labels=values_formatted)
@@ -171,8 +171,8 @@ def get_predicted_attributes(image_urls, category):
171
 
172
  # If attribute is details, then remove the obtained label from the values, and get the next most common
173
  if attribute == "details":
174
- print(values_formatted, result[0].trim() + f", clothing: {category}")
175
- values_formatted.remove(result[0].trim() + f", clothing: {category}")
176
  responses = pipe(image_urls, candidate_labels=values_formatted)
177
  i = 0
178
  print("Responses: ", responses)
 
161
 
162
  # Adjust labels for the pipeline to be in format: "{attr}: {value}, clothing: {category}"
163
  attribute_formatted = attribute.replace("colartype", "collar").replace("sleevelength", "sleeve length").replace("fabricstyle", "fabric")
164
+ values_formatted = [f"{attribute_formatted}: {value.strip()}, clothing: {category}" for value in values]
165
 
166
  # Get the predicted values for the attribute
167
  responses = pipe(image_urls, candidate_labels=values_formatted)
 
171
 
172
  # If attribute is details, then remove the obtained label from the values, and get the next most common
173
  if attribute == "details":
174
+ print(values_formatted, result[0].strip() + f", clothing: {category}")
175
+ values_formatted.remove(result[0].strip() + f", clothing: {category}")
176
  responses = pipe(image_urls, candidate_labels=values_formatted)
177
  i = 0
178
  print("Responses: ", responses)