|
import streamlit as st |
|
|
|
|
|
try: |
|
options = ['cat', 'dog', 'mouse', 'bat', 'duck'] |
|
|
|
query_params = st.experimental_get_query_params() |
|
query_option = query_params['option'][0] |
|
|
|
option_selected = st.sidebar.selectbox('Pick option', |
|
options, |
|
index=options.index(query_option)) |
|
if option_selected: |
|
st.experimental_set_query_params(option=option_selected) |
|
|
|
|
|
except: |
|
options = ['cat', 'dog', 'mouse', 'bat', 'duck'] |
|
st.experimental_set_query_params(option=options[1]) |
|
|
|
query_params = st.experimental_get_query_params() |
|
query_option = query_params['option'][0] |
|
|
|
option_selected = st.sidebar.selectbox('Pick option', |
|
options, |
|
index=options.index(query_option)) |
|
if option_selected: |
|
st.experimental_set_query_params(option=option_selected) |