Hi, I am in the process of developing an application that contains a “Settings” page. In it, I have a form with many fields (mainly text_input and selectbox). Depending on the selected option in the selectbox, I would like to display other things in the user interface. However, the selectbox in the form does not refresh my interface (this is the correct behavior according to the documentation). However, I would like to ask how I could achieve this.
Below is an example of simplified code:
import streamlit as st
# AI Section
form = st.form('ai_form')
type_of_something = form.selectbox('Type of something', CourtCaseType.get_all())
if SomethingType.get_by_name(type_of_something) == SomethingType.X:
left, right = form.columns(2)
with left.container(border=True):
first_provider = st.selectbox('provider', Providers.get_all())
first_model = st.selectbox('model', Models.get_all_by_provider(first_provider))
with right.container(border=True):
second_provider = st.selectbox('provider', Providers.get_all())
second_model = st.selectbox('Model', Models.get_all_by_provider(second_provider))
else:
left, right = form.columns(2)
with left.container(border=True):
first_provider = st.selectbox('provider', Providers.get_all())
first_model = st.selectbox('model', Models.get_all_by_provider(first_provider))
with right.container(border=True):
second_provider = st.selectbox('provider', Providers.get_all())
second_model = st.selectbox('model', Models.get_all_by_provider(second_provider))
# Form Submit
with form.columns([3, 3, 1])[2]:
submitted = st.form_submit_button('Submit')
if submitted:
pass
I looked for a solution in the documentation and on the forum, but I don’t think I found anything that addresses such a case.
For any suggestions and answers I will be grateful