Update app.py
Browse files
app.py
CHANGED
@@ -284,19 +284,19 @@ def streamlit_app():
|
|
284 |
if db:
|
285 |
st.write("Models have been processed and added to the database.")
|
286 |
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
|
301 |
if __name__ == "__main__":
|
302 |
streamlit_app()
|
|
|
284 |
if db:
|
285 |
st.write("Models have been processed and added to the database.")
|
286 |
|
287 |
+
# Move user query input outside of the model search block
|
288 |
+
user_query = st.text_input("Ask a question about the biomodels:")
|
289 |
+
|
290 |
+
# Ensure that query submission and response generation occur properly
|
291 |
+
if user_query and db:
|
292 |
+
if 'previous_context' not in st.session_state:
|
293 |
+
st.session_state.previous_context = ""
|
294 |
+
|
295 |
+
# Stream the response incrementally for the second generation
|
296 |
+
response = generate_response(db, user_query, st.session_state.previous_context)
|
297 |
+
st.write(f"Final Response: {response}")
|
298 |
+
|
299 |
+
st.session_state.previous_context += f"{response}\n"
|
300 |
|
301 |
if __name__ == "__main__":
|
302 |
streamlit_app()
|