Hi everyone,
I am building an app that has the following:
- User text input
- Submit button
- On pressing submit button, the app gives some output based on input
- After the output, the app gives the option for some feedback with another submit button
- On pressing button #2, the feedback gets stored in a database
Since it has 2 submit buttons, was trying to add session_state to it. Have tried multiple things and the closest to what I want was this:
usr = st.text_input("Enter a query")
if st.button("Show Results"):
st.session_state["feedback"] = ""
st.session_state["state"] = True
##perform some operation
if st.session_state["state"]:
st.session_state["feedback"] = st.text_area("Pls give feedback.")
if st.button("Submit response"):
##store in database
The issue is that it displays the text area asking for feedback immediately and does not wait for running the operation based on user query. Have tried setting session_state[“state”] to False but that does not solve the problem. Any help on this would be appreciated!
Thanks