DanilO0o commited on
Commit
e886e86
·
verified ·
1 Parent(s): de9c16e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -36,7 +36,15 @@ embeddings = np.array(embeddings).astype(np.float32)
36
  faiss.normalize_L2(embeddings)
37
 
38
  dimension = embeddings.shape[1]
39
- index = faiss.IndexFlatIP(dimension)
 
 
 
 
 
 
 
 
40
 
41
  index.add(embeddings)
42
 
 
36
  faiss.normalize_L2(embeddings)
37
 
38
  dimension = embeddings.shape[1]
39
+
40
+ nlist = 150
41
+
42
+ quantizer = faiss.IndexFlatIP(dimension)
43
+
44
+
45
+ index = faiss.IndexIVFFlat(quantizer, dimension, nlist, faiss.METRIC_L1)
46
+ index.train(embeddings)
47
+ # index = faiss.IndexFlatIP(dimension)
48
 
49
  index.add(embeddings)
50