tdecae commited on
Commit
b938f22
1 Parent(s): 63f74ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -89,6 +89,7 @@ from langchain.vectorstores import Chroma
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')
@@ -118,7 +119,7 @@ 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")
122
  vectorstore.add_texts(texts=texts, metadatas=[{"id": i} for i in range(len(texts))], embeddings=embeddings)
123
  vectorstore.persist()
124
 
 
89
  import gradio as gr
90
  from transformers import pipeline
91
  from sentence_transformers import SentenceTransformer
92
+ from langchain.embeddings.openai import OpenAIEmbeddings
93
 
94
  __import__('pysqlite3')
95
  sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
 
119
  embeddings = embedding_model.encode(texts).tolist() # Convert numpy arrays to lists
120
 
121
  # Create a Chroma vector store and add documents and their embeddings
122
+ vectorstore = Chroma(persist_directory="./db",embedding_function=OpenAIEmbeddings())
123
  vectorstore.add_texts(texts=texts, metadatas=[{"id": i} for i in range(len(texts))], embeddings=embeddings)
124
  vectorstore.persist()
125