tdecae commited on
Commit
a2e71cc
1 Parent(s): f2e7370

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -117,12 +117,8 @@ embedding_model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
117
  texts = [doc.page_content for doc in docs]
118
  embeddings = embedding_model.encode(texts).tolist() # Convert numpy arrays to lists
119
 
120
- # Create a wrapper function for the embedding function
121
- def embedding_function(texts):
122
- return embedding_model.encode(texts).tolist()
123
-
124
- # Create a Chroma vector store with an embedding function and add documents and their embeddings
125
- vectorstore = Chroma(persist_directory="./db", embedding_function=embedding_function)
126
  vectorstore.add_texts(texts=texts, metadatas=[{"id": i} for i in range(len(texts))], embeddings=embeddings)
127
  vectorstore.persist()
128
 
@@ -187,3 +183,4 @@ demo.launch(debug=True)
187
 
188
 
189
 
 
 
117
  texts = [doc.page_content for doc in docs]
118
  embeddings = embedding_model.encode(texts).tolist() # Convert numpy arrays to lists
119
 
120
+ # Create a Chroma vector store and add documents and their embeddings
121
+ vectorstore = Chroma(persist_directory="./db", embedding_function=embedding_model.encode)
 
 
 
 
122
  vectorstore.add_texts(texts=texts, metadatas=[{"id": i} for i in range(len(texts))], embeddings=embeddings)
123
  vectorstore.persist()
124
 
 
183
 
184
 
185
 
186
+