Spaces:
Sleeping
Sleeping
fix memory wrongly reset at every reload
Browse files- streamlit_app.py +5 -2
streamlit_app.py
CHANGED
|
@@ -217,7 +217,8 @@ with st.sidebar:
|
|
| 217 |
|
| 218 |
st.button(
|
| 219 |
'Reset chat memory.',
|
| 220 |
-
|
|
|
|
| 221 |
help="Clear the conversational memory. Currently implemented to retrain the 4 most recent messages.")
|
| 222 |
|
| 223 |
st.title("📝 Scientific Document Insights Q/A")
|
|
@@ -226,7 +227,9 @@ st.subheader("Upload a scientific article in PDF, ask questions, get insights.")
|
|
| 226 |
st.markdown(
|
| 227 |
":warning: Do not upload sensitive data. We **temporarily** store text from the uploaded PDF documents solely for the purpose of processing your request, and we **do not assume responsibility** for any subsequent use or handling of the data submitted to third parties LLMs.")
|
| 228 |
|
| 229 |
-
uploaded_file = st.file_uploader("Upload an article",
|
|
|
|
|
|
|
| 230 |
disabled=st.session_state['model'] is not None and st.session_state['model'] not in
|
| 231 |
st.session_state['api_keys'],
|
| 232 |
help="The full-text is extracted using Grobid. ")
|
|
|
|
| 217 |
|
| 218 |
st.button(
|
| 219 |
'Reset chat memory.',
|
| 220 |
+
key="reset-memory-button",
|
| 221 |
+
on_click=clear_memory,
|
| 222 |
help="Clear the conversational memory. Currently implemented to retrain the 4 most recent messages.")
|
| 223 |
|
| 224 |
st.title("📝 Scientific Document Insights Q/A")
|
|
|
|
| 227 |
st.markdown(
|
| 228 |
":warning: Do not upload sensitive data. We **temporarily** store text from the uploaded PDF documents solely for the purpose of processing your request, and we **do not assume responsibility** for any subsequent use or handling of the data submitted to third parties LLMs.")
|
| 229 |
|
| 230 |
+
uploaded_file = st.file_uploader("Upload an article",
|
| 231 |
+
type=("pdf", "txt"),
|
| 232 |
+
on_change=new_file,
|
| 233 |
disabled=st.session_state['model'] is not None and st.session_state['model'] not in
|
| 234 |
st.session_state['api_keys'],
|
| 235 |
help="The full-text is extracted using Grobid. ")
|