sourize
commited on
Commit
·
2a82939
1
Parent(s):
06b2acd
Updated main.py
Browse files
app.py
CHANGED
|
@@ -40,8 +40,8 @@ def chunk_text(text, chunk_size=500, overlap=50):
|
|
| 40 |
|
| 41 |
# Build FAISS index from chunks
|
| 42 |
@st.cache_resource
|
| 43 |
-
def build_faiss_index(chunks,
|
| 44 |
-
embeddings =
|
| 45 |
dim = embeddings.shape[1]
|
| 46 |
index = faiss.IndexFlatL2(dim)
|
| 47 |
index.add(embeddings)
|
|
|
|
| 40 |
|
| 41 |
# Build FAISS index from chunks
|
| 42 |
@st.cache_resource
|
| 43 |
+
def build_faiss_index(chunks, _embedder): # underscore to avoid hashing issues
|
| 44 |
+
embeddings = _embedder.encode(chunks)
|
| 45 |
dim = embeddings.shape[1]
|
| 46 |
index = faiss.IndexFlatL2(dim)
|
| 47 |
index.add(embeddings)
|