Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|