Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|