Summary
I have an if button. inside it output = function(). this function takes a minute to run, while it’s being ran, I get a lot of green "None"s printed in the webpage.
How do I stop this from happening? I’ve tried removing all print statements, changed the position of the function_that_takes_time_to_finish, added a time.sleep.
As soon as function_that_takes_time_to_finish is ran, I start getting None on the screen.
(This function is a bit long and has proprietary stuff that I can’t share.)
Steps to reproduce
Having a function that takes time to execute like the code snippet
Code snippet:
website = st.text_input(label="Website", placeholder="Website Here...")
slider = st.slider("How many children links to check", min_value=0, max_value=100, value=3)
col1, col2, col3 = st.columns(3)
with col2:
button = st.button("Generate")
if button:
with col2:
with st.spinner('Generating...',):
output = function_that_takes_time_to_finish(website, slider)
st.write(f"""{output}""")
Expected behavior:
I expect no None’s to get printed like the picture
Actual behavior:
I get a lot of Nones. The longer my method takes to run, the more Nones I see.