tdecae commited on
Commit
b464b4e
1 Parent(s): 415fe71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -89,7 +89,6 @@ from langchain.vectorstores import Chroma
89
  import gradio as gr
90
  from transformers import pipeline
91
  from sentence_transformers import SentenceTransformer
92
- import numpy as np
93
 
94
  __import__('pysqlite3')
95
  sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
@@ -120,7 +119,8 @@ embeddings = embedding_model.encode(texts).tolist() # Convert numpy arrays to l
120
 
121
  # Create a Chroma vector store and add documents and their embeddings
122
  vectorstore = Chroma(persist_directory="./data")
123
- vectorstore.add_texts(texts, embeddings)
 
124
  vectorstore.persist()
125
 
126
  # Load the Hugging Face model for text generation
@@ -177,3 +177,4 @@ demo.launch(debug=True)
177
 
178
 
179
 
 
 
89
  import gradio as gr
90
  from transformers import pipeline
91
  from sentence_transformers import SentenceTransformer
 
92
 
93
  __import__('pysqlite3')
94
  sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
 
119
 
120
  # Create a Chroma vector store and add documents and their embeddings
121
  vectorstore = Chroma(persist_directory="./data")
122
+ for text, embedding in zip(texts, embeddings):
123
+ vectorstore.add_texts([text], [embedding])
124
  vectorstore.persist()
125
 
126
  # Load the Hugging Face model for text generation
 
177
 
178
 
179
 
180
+