Anne31415 commited on
Commit
9960fe7
·
verified ·
1 Parent(s): 373dc79

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -337,13 +337,18 @@ def page1():
337
 
338
 
339
 
 
 
 
340
  # Display new messages at the bottom
341
  new_messages = st.session_state['chat_history_page1'][-2:]
342
  for chat in new_messages:
343
  background_color = "#ffeecf" if chat[2] == "new" else "#ffeecf" if chat[0] == "User" else "#ffeecf"
344
  new_messages_placeholder.markdown(f"<div style='background-color: {background_color}; padding: 10px; border-radius: 10px; margin: 10px;'>{chat[0]}: {chat[1]}</div>", unsafe_allow_html=True)
 
 
 
345
 
346
- st.text(f"Response time: {duration:.2f} seconds")
347
 
348
 
349
  # Clear the input field after the query is made
 
337
 
338
 
339
 
340
+ # Create a placeholder for the response time
341
+ response_time_placeholder = st.empty()
342
+
343
  # Display new messages at the bottom
344
  new_messages = st.session_state['chat_history_page1'][-2:]
345
  for chat in new_messages:
346
  background_color = "#ffeecf" if chat[2] == "new" else "#ffeecf" if chat[0] == "User" else "#ffeecf"
347
  new_messages_placeholder.markdown(f"<div style='background-color: {background_color}; padding: 10px; border-radius: 10px; margin: 10px;'>{chat[0]}: {chat[1]}</div>", unsafe_allow_html=True)
348
+
349
+ # Update the response time placeholder after the messages are displayed
350
+ response_time_placeholder.text(f"Response time: {duration:.2f} seconds")
351
 
 
352
 
353
 
354
  # Clear the input field after the query is made