ArturG9 commited on
Commit
ae84e58
1 Parent(s): b858a48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -15
app.py CHANGED
@@ -126,35 +126,36 @@ def main():
126
 
127
 
128
 
129
- st.subheader("Your documents")
130
- pdf_docs = st.file_uploader("For Chatbot to get alive, upload your PDFs here and click on 'Process'", accept_multiple_files=True)
 
131
 
132
 
133
 
134
- if st.button("Process"):
135
-
136
- if pdf_docs:
137
  # get pdf text
138
- raw_text = get_pdf_text(pdf_docs)
139
 
140
  # get the text chunks
141
- text_chunks = get_text_chunks(raw_text)
142
 
143
  # create vector store
144
- vectorstore = get_vectorstore(text_chunks)
145
 
146
  # create conversation chain
147
- conversation = get_conversation_chain()
148
 
149
- st.success("Files have been processed into a vector store.")
150
 
151
- return vectorstore , conversation
152
 
153
 
154
- if conversation is not None:
155
- st.subheader("Chat Bot")
156
- if user_question := st.text_input("Ask a question about your documents:"):
157
- handle_userinput(user_question, vectorstore, conversation)
158
 
159
 
160
 
 
126
 
127
 
128
 
129
+ with st.sidebar:
130
+ st.subheader("Your documents")
131
+ pdf_docs = st.file_uploader("For Chatbot to get alive, upload your PDFs here and click on 'Process'", accept_multiple_files=True)
132
 
133
 
134
 
135
+ if st.button("Process"):
136
+ with st.spinner:
137
+ if pdf_docs:
138
  # get pdf text
139
+ raw_text = get_pdf_text(pdf_docs)
140
 
141
  # get the text chunks
142
+ text_chunks = get_text_chunks(raw_text)
143
 
144
  # create vector store
145
+ vectorstore = get_vectorstore(text_chunks)
146
 
147
  # create conversation chain
148
+ conversation = get_conversation_chain()
149
 
150
+ st.success("Files have been processed into a vector store.")
151
 
152
+ return vectorstore , conversation
153
 
154
 
155
+
156
+ st.subheader("Chat Bot")
157
+ if user_question := st.text_input("Ask a question about your documents:"):
158
+ handle_userinput(user_question, vectorstore, conversation)
159
 
160
 
161