Sharal commited on
Commit
63f79ca
·
verified ·
1 Parent(s): f749b78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -178,12 +178,19 @@ def main():
178
  message = st.text_input("Ask a question", key="message")
179
  submit_button = st.form_submit_button(label="Submit")
180
 
181
- if submit_button:
182
- with st.spinner("Generating response..."):
183
- qa_chain, chat_history, response_answer, sources = conversation(st.session_state['qa_chain'], message, st.session_state['chat_history'])
184
- st.session_state['qa_chain'] = qa_chain
185
- st.session_state['chat_history'] = chat_history
186
- st.session_state['sources'] = sources
 
 
 
 
 
187
 
188
  if __name__ == "__main__":
189
  main()
 
 
 
178
  message = st.text_input("Ask a question", key="message")
179
  submit_button = st.form_submit_button(label="Submit")
180
 
181
+ if submit_button:
182
+ with st.spinner("Generating response..."):
183
+ # Call the conversation function inside the form
184
+ qa_chain, chat_history, response_answer, sources = conversation(st.session_state['qa_chain'], message, st.session_state['chat_history'])
185
+ st.session_state['qa_chain'] = qa_chain
186
+ st.session_state['chat_history'] = chat_history
187
+ st.session_state['sources'] = sources
188
+
189
+ # Clear the text input after submission
190
+ st.session_state.message = ""
191
+ st.experimental_rerun() # Force a rerun to update the UI
192
 
193
  if __name__ == "__main__":
194
  main()
195
+
196
+