Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,18 +12,18 @@ from PIL import Image
|
|
| 12 |
st.title("Nexus TCM Chatbot")
|
| 13 |
#query = st.text_input("Query: ", key="input")
|
| 14 |
|
| 15 |
-
def clear_query_on_change(
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# Create the search bar with on_change event
|
| 19 |
query = st.text_input("Query:", key="input", on_change=clear_query_on_change)
|
| 20 |
|
| 21 |
# Check if the user has entered a new query
|
| 22 |
-
if
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
response = f"User entered: {query}"
|
| 26 |
-
st.write(response)
|
| 27 |
|
| 28 |
# Set the logo URL
|
| 29 |
#logo_url = "https://huggingface.co/spaces/mathslearn/chatbot_test_streamlit/blob/main/logo.jpeg"
|
|
|
|
| 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 |
+
# This callback is now called without arguments, as the value is automatically used
|
| 26 |
+
clear_query_on_change()
|
|
|
|
|
|
|
| 27 |
|
| 28 |
# Set the logo URL
|
| 29 |
#logo_url = "https://huggingface.co/spaces/mathslearn/chatbot_test_streamlit/blob/main/logo.jpeg"
|