Update app.py
Browse files
app.py
CHANGED
|
@@ -263,7 +263,8 @@ def streamlit_app():
|
|
| 263 |
st.title("BioModelsRAG")
|
| 264 |
|
| 265 |
search_str = st.text_input("Enter search query:")
|
| 266 |
-
|
|
|
|
| 267 |
if search_str:
|
| 268 |
models = search_models(search_str)
|
| 269 |
|
|
@@ -303,17 +304,20 @@ def streamlit_app():
|
|
| 303 |
|
| 304 |
# Check if the database is created before showing the query input
|
| 305 |
if db:
|
| 306 |
-
user_query = st.text_input("Ask a question about the biomodels:")
|
| 307 |
|
| 308 |
if user_query:
|
| 309 |
if 'previous_context' not in st.session_state:
|
| 310 |
st.session_state.previous_context = ""
|
| 311 |
|
| 312 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
response = generate_response(db, user_query, st.session_state.previous_context)
|
| 314 |
st.write(f"Final Response: {response}")
|
| 315 |
|
| 316 |
st.session_state.previous_context += f"{response}\n"
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
streamlit_app()
|
|
|
|
| 263 |
st.title("BioModelsRAG")
|
| 264 |
|
| 265 |
search_str = st.text_input("Enter search query:")
|
| 266 |
+
|
| 267 |
+
# Keep the search input field visible even after submission
|
| 268 |
if search_str:
|
| 269 |
models = search_models(search_str)
|
| 270 |
|
|
|
|
| 304 |
|
| 305 |
# Check if the database is created before showing the query input
|
| 306 |
if db:
|
| 307 |
+
user_query = st.text_input("Ask a question about the biomodels:", key="user_query")
|
| 308 |
|
| 309 |
if user_query:
|
| 310 |
if 'previous_context' not in st.session_state:
|
| 311 |
st.session_state.previous_context = ""
|
| 312 |
|
| 313 |
+
# Placeholder for indicating that response generation has started
|
| 314 |
+
response_placeholder = st.empty()
|
| 315 |
+
response_placeholder.write("Response generation is beginning...")
|
| 316 |
+
|
| 317 |
+
# Generate and display response
|
| 318 |
response = generate_response(db, user_query, st.session_state.previous_context)
|
| 319 |
st.write(f"Final Response: {response}")
|
| 320 |
|
| 321 |
st.session_state.previous_context += f"{response}\n"
|
| 322 |
+
# Clear the "Response generation is beginning..." placeholder after generation
|
| 323 |
+
response_placeholder.empty()
|
|
|