Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -119,8 +119,14 @@ embeddings = embedding_model.encode(texts).tolist() # Convert numpy arrays to l
|
|
119 |
|
120 |
# Create a Chroma vector store and add documents and their embeddings
|
121 |
vectorstore = Chroma(persist_directory="./data")
|
122 |
-
|
123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
vectorstore.persist()
|
125 |
|
126 |
# Load the Hugging Face model for text generation
|
@@ -180,3 +186,4 @@ demo.launch(debug=True)
|
|
180 |
|
181 |
|
182 |
|
|
|
|
119 |
|
120 |
# Create a Chroma vector store and add documents and their embeddings
|
121 |
vectorstore = Chroma(persist_directory="./data")
|
122 |
+
vectorstore.add_texts(texts)
|
123 |
+
for i, embedding in enumerate(embeddings):
|
124 |
+
vectorstore._collection.upsert(
|
125 |
+
ids=[str(i)],
|
126 |
+
embeddings=[embedding],
|
127 |
+
metadatas=[{"id": i}],
|
128 |
+
documents=[texts[i]]
|
129 |
+
)
|
130 |
vectorstore.persist()
|
131 |
|
132 |
# Load the Hugging Face model for text generation
|
|
|
186 |
|
187 |
|
188 |
|
189 |
+
|