Hi, I have a function that recommends 3 random but similar cities, based on an input of the users current city. And another function that recommends 3 random, non-similar cities.
I am using st.form, st.text_input and submit_button for each function.
I am new to Streamlit and have 2 problems:
When clearing out the input city, the results from the previous input still remain. Even when refreshing the page. Is there are way for the form to reset after the input is cleared out?
When submitting an input for my first st.form (similar city), the 2nd st.form (non-similar city) populates based on the input in the first form. And vice versa.
This is the code I am using to put my function on streamlit:
#take user city as input
my_city = st.text_input(label=“Enter your current city (City, Country):”)
submit_button = st.form_submit_button(label=‘Get my next living destination!’)
similar_city_recommendations(city_country = my_city)
I would like the results to clear once the text box is cleared. I am making a demo video and I can’t have the previous results shown in the demo.
Again, both forms update based on input from just 1 form.
Any guidance would be appreciated!!
Using Streamlit version 0.87.0 and python version 3.8.8