Update app.py
Browse files
app.py
CHANGED
@@ -131,32 +131,34 @@ def main():
|
|
131 |
|
132 |
|
133 |
if st.button("Process"):
|
134 |
-
|
135 |
-
|
136 |
# get pdf text
|
137 |
-
|
138 |
|
139 |
# get the text chunks
|
140 |
-
|
141 |
|
142 |
# create vector store
|
143 |
-
|
144 |
|
145 |
# create conversation chain
|
146 |
-
|
147 |
-
|
148 |
-
st.success("Files have been processed into a vector store.")
|
149 |
|
150 |
-
|
151 |
|
|
|
152 |
|
153 |
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
|
156 |
|
157 |
-
|
158 |
-
if user_question := st.text_input("Ask a question about your documents:"):
|
159 |
-
handle_userinput(user_question, vectorstore, conversation)
|
160 |
|
161 |
|
162 |
|
|
|
131 |
|
132 |
|
133 |
if st.button("Process"):
|
134 |
+
|
135 |
+
if pdf_docs:
|
136 |
# get pdf text
|
137 |
+
raw_text = get_pdf_text(pdf_docs)
|
138 |
|
139 |
# get the text chunks
|
140 |
+
text_chunks = get_text_chunks(raw_text)
|
141 |
|
142 |
# create vector store
|
143 |
+
vectorstore = get_vectorstore(text_chunks)
|
144 |
|
145 |
# create conversation chain
|
146 |
+
conversation = get_conversation_chain()
|
|
|
|
|
147 |
|
148 |
+
st.success("Files have been processed into a vector store.")
|
149 |
|
150 |
+
return vectorstore , conversation
|
151 |
|
152 |
|
153 |
+
if conversation not None:
|
154 |
+
st.subheader("Chat Bot")
|
155 |
+
if user_question := st.text_input("Ask a question about your documents:"):
|
156 |
+
handle_userinput(user_question, vectorstore, conversation)
|
157 |
+
|
158 |
|
159 |
|
160 |
|
161 |
+
|
|
|
|
|
162 |
|
163 |
|
164 |
|