tree3po commited on
Commit
599dbd3
·
verified ·
1 Parent(s): 19eb5df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -17,17 +17,17 @@ token=""
17
  repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
18
  emb = "sentence-transformers/all-mpnet-base-v2"
19
  hf = HuggingFaceEmbeddings(model_name=emb)
20
- db = Chroma(persist_directory=f"{cwd}/chroma_langchain_db",embedding_function=HuggingFaceEmbeddings(model_name=emb))
21
  #db.persist()
22
  # Load the document, split it into chunks, embed each chunk and load it into the vector store.
23
  #raw_documents = TextLoader('state_of_the_union.txt').load()
24
  def embed_fn(inp):
25
- #db=Chroma()
26
  text_splitter = CharacterTextSplitter(chunk_size=200, chunk_overlap=10)
27
  documents = text_splitter.split_text(inp)
28
  out_emb= hf.embed_documents(documents)
29
  string_representation = dumps(out_emb, pretty=True)
30
- db.from_texts(documents,persist_directory=f"{cwd}/chroma_langchain_db",embedding_function=HuggingFaceEmbeddings(model_name=emb))
31
 
32
  def proc_doc(doc_in):
33
  for doc in doc_in:
 
17
  repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
18
  emb = "sentence-transformers/all-mpnet-base-v2"
19
  hf = HuggingFaceEmbeddings(model_name=emb)
20
+ #db = Chroma(persist_directory=f"{cwd}/chroma_langchain_db",embedding_function=HuggingFaceEmbeddings(model_name=emb))
21
  #db.persist()
22
  # Load the document, split it into chunks, embed each chunk and load it into the vector store.
23
  #raw_documents = TextLoader('state_of_the_union.txt').load()
24
  def embed_fn(inp):
25
+ db=Chroma(persist_directory=f"{cwd}/chroma_langchain_db",embedding_function=HuggingFaceEmbeddings(model_name=emb))
26
  text_splitter = CharacterTextSplitter(chunk_size=200, chunk_overlap=10)
27
  documents = text_splitter.split_text(inp)
28
  out_emb= hf.embed_documents(documents)
29
  string_representation = dumps(out_emb, pretty=True)
30
+ db.from_texts(documents)
31
 
32
  def proc_doc(doc_in):
33
  for doc in doc_in: