aroraaman commited on
Commit
fb921cd
1 Parent(s): fc9fb44

Update `app.py`

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -91,6 +91,7 @@ def load_image_embeddings():
91
 
92
  # Use the embeddings in your app
93
  image_embeddings = load_image_embeddings()
 
94
  image_embeddings.shape
95
  print(image_embeddings.shape)
96
 
@@ -147,7 +148,7 @@ def get_similar_images(caption, brightness, num_items):
147
  )
148
  top_indices = similarities.argsort(descending=True)[:1]
149
  print(top_indices, similarities[top_indices])
150
- return [dataset[i] for i in top_indices.cpu().numpy()]
151
 
152
 
153
  # Gradio interface
 
91
 
92
  # Use the embeddings in your app
93
  image_embeddings = load_image_embeddings()
94
+ image_embeddings = image_embeddings.to(DEVICE)
95
  image_embeddings.shape
96
  print(image_embeddings.shape)
97
 
 
148
  )
149
  top_indices = similarities.argsort(descending=True)[:1]
150
  print(top_indices, similarities[top_indices])
151
+ return [dataset[int(i)] for i in top_indices.cpu().numpy()]
152
 
153
 
154
  # Gradio interface