Omar Alam commited on
Commit
4e29c7a
·
1 Parent(s): e04e07d

Fix embedding funtion

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -33,11 +33,10 @@ transform = transforms.Compose([
33
  ])
34
 
35
  # Function to extract embedding
36
- def get_embedding(image_path):
37
- image = Image.open(image_path).convert('RGB')
38
- image = transform(image).unsqueeze(0) # Add batch dimension
39
  with torch.no_grad():
40
- embedding = model(image).squeeze() # Remove extra dimensions
41
  return embedding.numpy()
42
 
43
  # Prediction function
 
33
  ])
34
 
35
  # Function to extract embedding
36
+ def get_embedding(image):
37
+ image = transform(image).unsqueeze(0)
 
38
  with torch.no_grad():
39
+ embedding = model(image).squeeze()
40
  return embedding.numpy()
41
 
42
  # Prediction function