Not-Adam commited on
Commit
2a19f14
1 Parent(s): f55e82b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -54,7 +54,11 @@ def shot(input, category, level):
54
  face_embeddings = get_face_embeddings(ast.literal_eval(str(input)))
55
  cropped_images, product_crops = get_cropped_images(ast.literal_eval(str(input)), category)
56
  print(product_crops)
57
- subColour, mainColour, score = get_colour(product_crops, category)
 
 
 
 
58
 
59
  # Ensure all outputs are JSON serializable
60
  output_dict['colors'] = {
 
54
  face_embeddings = get_face_embeddings(ast.literal_eval(str(input)))
55
  cropped_images, product_crops = get_cropped_images(ast.literal_eval(str(input)), category)
56
  print(product_crops)
57
+ if len(product_crops) == 0:
58
+ print("No product crops found. Using image urls instead.")
59
+ subColour, mainColour, score = get_colour(ast.literal_eval(str(input)), category)
60
+ else:
61
+ subColour, mainColour, score = get_colour(product_crops, category)
62
 
63
  # Ensure all outputs are JSON serializable
64
  output_dict['colors'] = {