Maaz1 commited on
Commit
a095033
·
verified ·
1 Parent(s): aca7715

Update backend/supportingfiles/image_processor.py

Browse files
backend/supportingfiles/image_processor.py CHANGED
@@ -46,7 +46,16 @@ class ImageProcessor:
46
  except Exception as e:
47
  print(f"Error normalizing image: {str(e)}")
48
  return None
49
-
 
 
 
 
 
 
 
 
 
50
  def extract_embedding(self, image):
51
  """Extract feature embedding from an image.
52
 
 
46
  except Exception as e:
47
  print(f"Error normalizing image: {str(e)}")
48
  return None
49
+
50
+ def process_image(image, num_recommendations=5, skip_exact_match=True):
51
+ """Process the selected image and return recommendations."""
52
+ if isinstance(image, str): # If the input is a file path
53
+ image = Image.open(image)
54
+
55
+ recommender = JewelryRecommenderService()
56
+ recommendations = recommender.get_recommendations(image, num_recommendations, skip_exact_match)
57
+ return ResultFormatter.format_html(recommendations)
58
+
59
  def extract_embedding(self, image):
60
  """Extract feature embedding from an image.
61