Samuel Schmidt commited on
Commit
cfa8379
·
1 Parent(s): dbf298b

Fix index bug

Browse files
Files changed (1) hide show
  1. src/app.py +4 -1
src/app.py CHANGED
@@ -16,13 +16,16 @@ def emb_dataset(dataset):
16
  ## Color Embeddings
17
  cd = ColorDescriptor((8, 12, 3))
18
  dataset_with_embeddings = dataset.map(lambda row: {'color_embeddings': cd.describe(row["image"])}) # we assume that dataset has a column 'image'
19
- dataset_with_embeddings.add_faiss_index(column='color_embeddings')
20
 
21
  ## CLIP Embeddings
22
  clip_model = CLIPImageEncoder()
23
  dataset_with_embeddings = dataset_with_embeddings.map(lambda row: {'clip_embeddings': clip_model.encode_image(row["image"])})
 
 
 
24
  dataset_with_embeddings.add_faiss_index(column='clip_embeddings')
25
 
 
26
  print(dataset_with_embeddings)
27
  return dataset_with_embeddings
28
 
 
16
  ## Color Embeddings
17
  cd = ColorDescriptor((8, 12, 3))
18
  dataset_with_embeddings = dataset.map(lambda row: {'color_embeddings': cd.describe(row["image"])}) # we assume that dataset has a column 'image'
 
19
 
20
  ## CLIP Embeddings
21
  clip_model = CLIPImageEncoder()
22
  dataset_with_embeddings = dataset_with_embeddings.map(lambda row: {'clip_embeddings': clip_model.encode_image(row["image"])})
23
+
24
+ # Add index
25
+ dataset_with_embeddings.add_faiss_index(column='color_embeddings')
26
  dataset_with_embeddings.add_faiss_index(column='clip_embeddings')
27
 
28
+
29
  print(dataset_with_embeddings)
30
  return dataset_with_embeddings
31