Update app.py
Browse files
app.py
CHANGED
@@ -48,6 +48,8 @@ st.title("Literature Based Research (LBR) - A. Unzicker and J. Bours - Chat with
|
|
48 |
|
49 |
if "vector" not in st.session_state:
|
50 |
|
|
|
|
|
51 |
# st.session_state.embeddings = OllamaEmbeddings() # ORIGINAL
|
52 |
st.session_state.embeddings = FastEmbedEmbeddings() # JB
|
53 |
|
@@ -117,10 +119,10 @@ if "vector" not in st.session_state:
|
|
117 |
# docs[0]
|
118 |
# Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \n\nTonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service. \n\nOne of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. \n\nAnd I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence.', metadata={'source': '../../../state_of_the_union.txt'})
|
119 |
#
|
120 |
-
|
121 |
|
122 |
# st.session_state.vector = FAISS.from_documents(st.session_state.documents, st.session_state.embeddings) # ORIGINAL
|
123 |
-
|
124 |
# The de-serialization relies loading a pickle file.
|
125 |
# Pickle files can be modified to deliver a malicious payload that results in execution of arbitrary code on your machine.
|
126 |
# You will need to set `allow_dangerous_deserialization` to `True` to enable deserialization. If you do this, make sure that you trust the source of the data.
|
|
|
48 |
|
49 |
if "vector" not in st.session_state:
|
50 |
|
51 |
+
st.write("Chunking, embedding, storing in FAISS vectorstore ...")
|
52 |
+
|
53 |
# st.session_state.embeddings = OllamaEmbeddings() # ORIGINAL
|
54 |
st.session_state.embeddings = FastEmbedEmbeddings() # JB
|
55 |
|
|
|
119 |
# docs[0]
|
120 |
# Document(page_content='Tonight. I call on the Senate to: Pass the Freedom to Vote Act. Pass the John Lewis Voting Rights Act. And while you’re at it, pass the Disclose Act so Americans can know who is funding our elections. \n\nTonight, I’d like to honor someone who has dedicated his life to serve this country: Justice Stephen Breyer—an Army veteran, Constitutional scholar, and retiring Justice of the United States Supreme Court. Justice Breyer, thank you for your service. \n\nOne of the most serious constitutional responsibilities a President has is nominating someone to serve on the United States Supreme Court. \n\nAnd I did that 4 days ago, when I nominated Circuit Court of Appeals Judge Ketanji Brown Jackson. One of our nation’s top legal minds, who will continue Justice Breyer’s legacy of excellence.', metadata={'source': '../../../state_of_the_union.txt'})
|
121 |
#
|
122 |
+
st.session_state.vector = FAISS.from_documents(st.session_state.documents, st.session_state.embeddings) # ORIGINAL
|
123 |
|
124 |
# st.session_state.vector = FAISS.from_documents(st.session_state.documents, st.session_state.embeddings) # ORIGINAL
|
125 |
+
st.session_state.vector.save_local("faiss_index")
|
126 |
# The de-serialization relies loading a pickle file.
|
127 |
# Pickle files can be modified to deliver a malicious payload that results in execution of arbitrary code on your machine.
|
128 |
# You will need to set `allow_dangerous_deserialization` to `True` to enable deserialization. If you do this, make sure that you trust the source of the data.
|