Update app.py
Browse files
app.py
CHANGED
@@ -106,26 +106,27 @@ def sidebar():
|
|
106 |
st.subheader("Your documents")
|
107 |
pdf_docs = st.file_uploader("For Chatbot to get alive, upload your PDFs here and click on 'Process'", accept_multiple_files=True)
|
108 |
|
109 |
-
|
|
|
110 |
|
111 |
if st.button("Process"):
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
raw_text = get_pdf_text(pdf_docs)
|
116 |
|
117 |
-
|
118 |
text_chunks = get_text_chunks(raw_text)
|
119 |
|
120 |
-
|
121 |
vectorstore = get_vectorstore(text_chunks)
|
122 |
|
123 |
-
|
124 |
conversation = get_conversation_chain()
|
125 |
|
126 |
st.success("Files have been processed into a vector store.")
|
127 |
-
|
128 |
-
|
129 |
|
130 |
|
131 |
|
|
|
106 |
st.subheader("Your documents")
|
107 |
pdf_docs = st.file_uploader("For Chatbot to get alive, upload your PDFs here and click on 'Process'", accept_multiple_files=True)
|
108 |
|
109 |
+
vectorstore = None
|
110 |
+
conversation = None
|
111 |
|
112 |
if st.button("Process"):
|
113 |
+
if pdf_docs:
|
114 |
+
with st.spinner("Processing"):
|
115 |
+
# get pdf text
|
116 |
raw_text = get_pdf_text(pdf_docs)
|
117 |
|
118 |
+
# get the text chunks
|
119 |
text_chunks = get_text_chunks(raw_text)
|
120 |
|
121 |
+
# create vector store
|
122 |
vectorstore = get_vectorstore(text_chunks)
|
123 |
|
124 |
+
# create conversation chain
|
125 |
conversation = get_conversation_chain()
|
126 |
|
127 |
st.success("Files have been processed into a vector store.")
|
128 |
+
|
129 |
+
return vectorstore, conversation
|
130 |
|
131 |
|
132 |
|