nightfury commited on
Commit
35a54f7
·
verified ·
1 Parent(s): f4cf793

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -17,6 +17,8 @@ logging.basicConfig(level=logging.DEBUG)
17
  ABS_PATH = os.path.dirname(os.path.abspath(__file__))
18
  DB_DIR = os.path.join(ABS_PATH, "db")
19
 
 
 
20
 
21
  def replace_newlines_and_spaces(text):
22
  # Replace all newline characters with spaces
@@ -47,15 +49,17 @@ def init_chromadb():
47
  texts = text_splitter.split_documents(documents)
48
 
49
  # Select which embeddings we want to use
50
- embeddings = OpenAIEmbeddings()
51
 
52
  # Create the vectorestore to use as the index
53
  vectorstore = Chroma.from_documents(texts, embeddings, persist_directory=DB_DIR)
54
  vectorstore.persist()
 
55
  print(vectorstore)
56
  #vectorstore = None
57
 
58
  db = vectorstore
 
59
  print(len(db.get()["ids"]))
60
 
61
  # Print the list of source files
 
17
  ABS_PATH = os.path.dirname(os.path.abspath(__file__))
18
  DB_DIR = os.path.join(ABS_PATH, "db")
19
 
20
+ embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
21
+ #embedding_function
22
 
23
  def replace_newlines_and_spaces(text):
24
  # Replace all newline characters with spaces
 
49
  texts = text_splitter.split_documents(documents)
50
 
51
  # Select which embeddings we want to use
52
+ #embeddings = OpenAIEmbeddings()
53
 
54
  # Create the vectorestore to use as the index
55
  vectorstore = Chroma.from_documents(texts, embeddings, persist_directory=DB_DIR)
56
  vectorstore.persist()
57
+
58
  print(vectorstore)
59
  #vectorstore = None
60
 
61
  db = vectorstore
62
+ db.get()
63
  print(len(db.get()["ids"]))
64
 
65
  # Print the list of source files