Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,16 +13,20 @@ st.title("Nexus TCM Chatbot")
|
|
13 |
#query = st.text_input("Query: ", key="input")
|
14 |
|
15 |
#https://discuss.streamlit.io/t/clear-input-box-after-hitting-enter/33824/2
|
16 |
-
|
17 |
-
|
|
|
|
|
18 |
|
19 |
def submit():
|
20 |
-
st.session_state.
|
21 |
-
st.session_state.widget =
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
|
|
|
|
26 |
|
27 |
# Set the logo URL
|
28 |
#logo_url = "https://huggingface.co/spaces/mathslearn/chatbot_test_streamlit/blob/main/logo.jpeg"
|
|
|
13 |
#query = st.text_input("Query: ", key="input")
|
14 |
|
15 |
#https://discuss.streamlit.io/t/clear-input-box-after-hitting-enter/33824/2
|
16 |
+
#https://discuss.streamlit.io/t/how-do-you-clear-the-input-box-after-hitting-enter/45691/4
|
17 |
+
#https://stackoverflow.com/questions/77093266/how-to-clear-input-field-after-hitting-enter-in-streamlit
|
18 |
+
if "my_text" not in st.session_state:
|
19 |
+
st.session_state.my_text = ""
|
20 |
|
21 |
def submit():
|
22 |
+
st.session_state.my_text = st.session_state.widget
|
23 |
+
st.session_state.widget = ""
|
24 |
|
25 |
+
st.text_input("Enter text here", key="widget", on_change=submit)
|
26 |
|
27 |
+
query = st.session_state.my_text
|
28 |
+
|
29 |
+
st.write(query)
|
30 |
|
31 |
# Set the logo URL
|
32 |
#logo_url = "https://huggingface.co/spaces/mathslearn/chatbot_test_streamlit/blob/main/logo.jpeg"
|