Not-Adam commited on
Commit
86a7fd8
·
verified ·
1 Parent(s): 59e3412

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -42,7 +42,7 @@ with open(attributes_file_path, 'r') as file:
42
  COLOURS_DICT = color_data['color_mapping']
43
  ATTRIBUTES_DICT = attributes_data['attribute_mapping']
44
 
45
- DETAILS_THRESHOLD = 0.8 # This is how high the total score of an additional detail attribute should be for it to be included
46
 
47
 
48
  def shot(input, category, level):
@@ -183,7 +183,7 @@ def get_predicted_attributes(image_urls, category):
183
  values = [value for value in values if value != f"{most_common}, clothing: {category}"]
184
  responses = pipe(image_urls, candidate_labels=values)
185
  most_common, score = get_most_common_label(responses)
186
- if score > DETAILS_THRESHOLD:
187
  common_result.append(most_common)
188
 
189
  # Convert common_result into a dictionary
 
42
  COLOURS_DICT = color_data['color_mapping']
43
  ATTRIBUTES_DICT = attributes_data['attribute_mapping']
44
 
45
+ DETAILS_THRESHOLD = 0.4 # This is how high the total score of an additional detail attribute should be for it to be included (number scales up linearly with more images)
46
 
47
 
48
  def shot(input, category, level):
 
183
  values = [value for value in values if value != f"{most_common}, clothing: {category}"]
184
  responses = pipe(image_urls, candidate_labels=values)
185
  most_common, score = get_most_common_label(responses)
186
+ if score > DETAILS_THRESHOLD * len(image_urls):
187
  common_result.append(most_common)
188
 
189
  # Convert common_result into a dictionary