achuthc1298 commited on
Commit
9063cbb
·
verified ·
1 Parent(s): cd80b60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -78,7 +78,6 @@ def main():
78
 
79
  obj_retriever = obj_index.as_retriever(similarity_top_k=6)
80
 
81
-
82
  context = """You are an agent designed to answer scientific queries over a set of given documents.
83
  Please always use the tools provided to answer a question. Do not rely on prior knowledge.
84
  """
@@ -94,18 +93,13 @@ def main():
94
 
95
  if user_prompt:
96
  st.session_state.history.append({"user": user_prompt})
97
- placeholder = st.empty()
98
- placeholder.markdown("### Query Response:\nProcessing...")
99
 
100
  with st.spinner("Processing..."):
101
- response_stream = agent.query(user_prompt, stream=True)
102
- response_text = ""
103
-
104
- for chunk in response_stream:
105
- response_text += chunk
106
- placeholder.markdown(f"### Query Response:\n{response_text}")
107
 
108
- st.session_state.history.append({"agent": response_text})
 
109
 
110
  # Display chat history
111
  if st.session_state.history:
 
78
 
79
  obj_retriever = obj_index.as_retriever(similarity_top_k=6)
80
 
 
81
  context = """You are an agent designed to answer scientific queries over a set of given documents.
82
  Please always use the tools provided to answer a question. Do not rely on prior knowledge.
83
  """
 
93
 
94
  if user_prompt:
95
  st.session_state.history.append({"user": user_prompt})
 
 
96
 
97
  with st.spinner("Processing..."):
98
+ response = agent.query(user_prompt)
99
+ st.session_state.history.append({"agent": response})
 
 
 
 
100
 
101
+ # Display the latest response
102
+ st.markdown(f"### Query Response:\n{response}")
103
 
104
  # Display chat history
105
  if st.session_state.history: