Streamlit select box not retaining selected values and its inconsisting

Hi ,
I am trying to update select box values with rest call, and trying to select one item , but its working strangely. not retaining selected value.

def retrieve_indices():

indices = requests.post("http://127.0.0.1:8000/retrieve_indices/").json()

return indices

#select box
st.sidebar.subheader(“you can choose one from below”, )

st.sidebar.selectbox(“select one existing document”, options=retrieve_indices())

I have tried multiple ways but none of them worked. any help would highly appreicated.

streamlit-sample-2021-09-29-07-09-43
You can see weird behavior here, selected value is not consistent