Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -174,15 +174,16 @@ def main():
|
|
174 |
for i, source in enumerate(st.session_state['sources']):
|
175 |
st.text_area(f"Source {i + 1} - Page {source['page']}", value=source["content"], height=100)
|
176 |
|
177 |
-
|
|
|
|
|
178 |
|
179 |
-
if
|
180 |
with st.spinner("Generating response..."):
|
181 |
-
qa_chain, chat_history, response_answer, sources = conversation(st.session_state['qa_chain'],
|
182 |
st.session_state['qa_chain'] = qa_chain
|
183 |
st.session_state['chat_history'] = chat_history
|
184 |
st.session_state['sources'] = sources
|
185 |
-
st.session_state['message'] = ""
|
186 |
|
187 |
if __name__ == "__main__":
|
188 |
main()
|
|
|
174 |
for i, source in enumerate(st.session_state['sources']):
|
175 |
st.text_area(f"Source {i + 1} - Page {source['page']}", value=source["content"], height=100)
|
176 |
|
177 |
+
with st.form(key="question_form"):
|
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()
|