Yusif commited on
Commit
69cf133
·
verified ·
1 Parent(s): 04d1a5e

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. handler.py +3 -1
handler.py CHANGED
@@ -28,7 +28,9 @@ class EndpointHandler():
28
 
29
  # Get embeddings
30
  with torch.no_grad():
31
- image_features = self.model.get_image_features(**inputs)
 
 
32
 
33
  # Calculate similarity if 2 images provided
34
  if len(images) == 2:
 
28
 
29
  # Get embeddings
30
  with torch.no_grad():
31
+ outputs = self.model(**inputs)
32
+ # Get global image embedding by averaging the last hidden states
33
+ image_features = outputs.last_hidden_state.mean(dim=1)
34
 
35
  # Calculate similarity if 2 images provided
36
  if len(images) == 2: