student-abdullah commited on
Commit
3552dca
·
verified ·
1 Parent(s): ba06cd7

Update a.py

Browse files
Files changed (1) hide show
  1. a.py +6 -6
a.py CHANGED
@@ -103,13 +103,15 @@ elif st.session_state.selected_service == "Medicine Services":
103
  st.write(f"**Bot:** {chat['bot']}")
104
 
105
  # User input section
106
- user_input = st.text_input("Enter medicine:")
107
-
108
- # Handle input when the "Send" button is clicked
109
- if st.button('Send'):
110
  if user_input:
111
  response = find_best_match(user_input)
112
  st.session_state.chat_history.append({"user": user_input, "bot": response})
 
 
 
 
113
 
114
  elif st.session_state.selected_service == "Kendra Locator":
115
  st.title("Kendra Locator")
@@ -137,7 +139,6 @@ elif st.session_state.selected_service == "Assistant":
137
  st.write(f"**Medicine Query:** {chat['user']}")
138
  st.write(f"**Chatbot:** {chat['bot']}")
139
 
140
-
141
  # Function to handle user input
142
  def handle_input():
143
  user_input = st.session_state['input']
@@ -161,6 +162,5 @@ elif st.session_state.selected_service == "Assistant":
161
  # Clear the input box
162
  st.session_state['input'] = ''
163
 
164
-
165
  # Persistent text input at the top
166
  st.text_input("Enter Medicine Query:", key="input", on_change=handle_input)
 
103
  st.write(f"**Bot:** {chat['bot']}")
104
 
105
  # User input section
106
+ def handle_input():
107
+ user_input = st.session_state['input']
 
 
108
  if user_input:
109
  response = find_best_match(user_input)
110
  st.session_state.chat_history.append({"user": user_input, "bot": response})
111
+ st.session_state['input'] = ''
112
+
113
+ # Persistent text input at the top
114
+ st.text_input("Enter medicine:", key="input", on_change=handle_input)
115
 
116
  elif st.session_state.selected_service == "Kendra Locator":
117
  st.title("Kendra Locator")
 
139
  st.write(f"**Medicine Query:** {chat['user']}")
140
  st.write(f"**Chatbot:** {chat['bot']}")
141
 
 
142
  # Function to handle user input
143
  def handle_input():
144
  user_input = st.session_state['input']
 
162
  # Clear the input box
163
  st.session_state['input'] = ''
164
 
 
165
  # Persistent text input at the top
166
  st.text_input("Enter Medicine Query:", key="input", on_change=handle_input)