Hi,
I developed an app for web scraping with user input. All the scraped links and documents in a list which is st.session_state.papers. When i am working locally the code is worked perfectly. However i deployed the app on Streamlit Cloud. When i click Next button, It is not appending the list which links are selected yes. I am begginer, maybe i am missing something.
Here is my code:
if "count" not in st.session_state:
st.session_state['count'] = 0
if 'final_text' not in st.session_state:
st.session_state.final_text = []
if 'final_link' not in st.session_state:
st.session_state.final_link = []
def next_quote():
st.session_state.count += 0
if st.session_state.count == 7:
st.session_state.count += 1
index = st.session_state.count
with st.form("my_form"):
col1, col2 = st.columns(2)
if st.session_state.papers:
if st.session_state.count < 7:
st.write("Progress: ", st.session_state.count + 1 , "/", 7)
text = st.session_state.papers[st.session_state.count]["Description"]
link = st.session_state.papers[st.session_state.count]["Link"]
CHOICES = {1: "Yes", 2: "No", 3: None}
def format_func(label):
return CHOICES[label]
label = st.selectbox("Select option", options=list(CHOICES.keys()), format_func=format_func)
st.write(link)
res_box = st.empty()
for i in range(len(text) + 1):
res_box.markdown(" %s" % text[0:i])
time.sleep(0.003)
st.session_state.count += 1
with col2:
if st.form_submit_button("Next ⏭️", on_click=next_quote):
if st.session_state.count > 1:
if format_func(label) == "Yes":
st.session_state.final_text.append(st.session_state.papers[st.session_state.count - 2]["Description"])
st.session_state.final_link.append(st.session_state.papers[st.session_state.count - 2]["Link"])
if st.session_state == 2:
if format_func(label) == "Yes":
st.session_state.final_text.append(st.session_state.papers[0]["Description"])
st.session_state.final_link.append(st.session_state.papers[0]["Link"])
st.write(st.session_state.final_link)
st.write(st.session_state.count)
st.write(label)
st.session_state.final_link returning null on streamlit cloud. But the same code working in local perfectly.