ofermend commited on
Commit
8f01b41
·
verified ·
1 Parent(s): 2984786

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -54,13 +54,6 @@ def launch_bot():
54
  if "messages" not in st.session_state.keys():
55
  st.session_state.messages = [{"role": "assistant", "content": "How may I help you?"}]
56
 
57
- ###
58
- # Display clickable buttons for example questions
59
- st.markdown("## Try these example questions:")
60
- for question in cfg.examples:
61
- if st.button(question):
62
- prompt = question
63
- process_user_input(prompt) # Function to process and display the user input and response
64
 
65
  # Function to process and display the user input and response
66
  def process_user_input(user_input):
@@ -68,7 +61,15 @@ def launch_bot():
68
  response = generate_response(user_input)
69
  st.session_state.messages.append({"role": "assistant", "content": response})
70
  display_chat_messages()
71
- ###
 
 
 
 
 
 
 
 
72
 
73
  # Display chat messages
74
  for message in st.session_state.messages:
 
54
  if "messages" not in st.session_state.keys():
55
  st.session_state.messages = [{"role": "assistant", "content": "How may I help you?"}]
56
 
 
 
 
 
 
 
 
57
 
58
  # Function to process and display the user input and response
59
  def process_user_input(user_input):
 
61
  response = generate_response(user_input)
62
  st.session_state.messages.append({"role": "assistant", "content": response})
63
  display_chat_messages()
64
+
65
+ # Display clickable buttons for example questions
66
+ print(len(st.session_state.messages))
67
+ if len(st.session_state.messages)<=2:
68
+ st.markdown("## Try these example questions:")
69
+ for question in cfg.examples:
70
+ if st.button(question):
71
+ prompt = question
72
+ process_user_input(prompt) # Function to process and display the user input and response
73
 
74
  # Display chat messages
75
  for message in st.session_state.messages: