mathslearn commited on
Commit
9ebaa7e
1 Parent(s): 59ec27f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -10,7 +10,20 @@ from streamlit_chat import message
10
  from PIL import Image
11
 
12
  st.title("Nexus TCM Chatbot")
13
- query = st.text_input("Query: ", key="input")
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  # Set the logo URL
16
  #logo_url = "https://huggingface.co/spaces/mathslearn/chatbot_test_streamlit/blob/main/logo.jpeg"
 
10
  from PIL import Image
11
 
12
  st.title("Nexus TCM Chatbot")
13
+ #query = st.text_input("Query: ", key="input")
14
+
15
+ def clear_query_on_change():
16
+ # Your logic for processing the query and generating a response goes here
17
+ response = f"User entered: {st.session_state.input}"
18
+ st.write(response)
19
+
20
+ # Create the search bar with on_change event
21
+ query = st.text_input("Query:", key="input", on_change=clear_query_on_change)
22
+
23
+ # Check if the user has entered a new query
24
+ if 'input' in st.session_state:
25
+ # Clear the input after processing
26
+ st.session_state.input = ""
27
 
28
  # Set the logo URL
29
  #logo_url = "https://huggingface.co/spaces/mathslearn/chatbot_test_streamlit/blob/main/logo.jpeg"