Update app.py
Browse files
app.py
CHANGED
@@ -22,12 +22,12 @@ hf = HuggingFaceEmbeddings(model_name=emb)
|
|
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,embedding_function=HuggingFaceEmbeddings(model_name=emb))
|
31 |
|
32 |
def proc_doc(doc_in):
|
33 |
for doc in doc_in:
|
|
|
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,embedding_function=HuggingFaceEmbeddings(model_name=emb),persist_directory=f"{cwd}/chroma_langchain_db")
|
31 |
|
32 |
def proc_doc(doc_in):
|
33 |
for doc in doc_in:
|