AlanOC commited on
Commit
4046108
1 Parent(s): 8ef9363

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -76,17 +76,17 @@ documents = text_splitter.split_documents(documents)
76
 
77
 
78
  def load_or_create_vector_database():
79
- # Check if the vector database already exists
80
  if os.path.exists("./data"):
81
- # If it exists, load and return it
82
- vectordb = Chroma.load("./data")
83
  else:
84
- # If it doesn't exist, create and persist the database
85
  documents = [] # Load your documents here
86
  vectordb = Chroma.from_documents(documents, embedding=OpenAIEmbeddings(), persist_directory="./data")
87
  vectordb.persist()
88
  return vectordb
89
 
 
 
 
90
  # Define Streamlit app
91
  def main():
92
  st.title("AI Chat Application")
 
76
 
77
 
78
  def load_or_create_vector_database():
 
79
  if os.path.exists("./data"):
80
+ vectordb = Chroma.from_directory("./data")
 
81
  else:
 
82
  documents = [] # Load your documents here
83
  vectordb = Chroma.from_documents(documents, embedding=OpenAIEmbeddings(), persist_directory="./data")
84
  vectordb.persist()
85
  return vectordb
86
 
87
+
88
+
89
+
90
  # Define Streamlit app
91
  def main():
92
  st.title("AI Chat Application")