Progress bar not incrementally updating

Hello Streamlit Community,

I’m working on a Streamlit app where I’m performing a quality check on a dataset. I want to use a progress bar to show the progress of the QC steps. However, I’ve run into an issue: the progress bar appears to be complete from the start, even though the text updates correctly as the process moves through each step.

Here is a simplified version of my code:

progress_bar = st.progress(0)

df = read.csv(file) 
progress_bar.progress(10, text = “File Read")

df.head()
progress_bar.progress(20, text = “Displayed data")

df.summary()
progress_bar.progress(30, text = “Summarized data)

Despite these updates, the progress bar doesn’t seem to incrementally increase; instead, it shows as full (or nearly full) right from the start. I suspect I’m not correctly managing the progress updates in the Streamlit app.

Could someone please guide me on how to properly update the progress bar incrementally as each step is completed? I’d appreciate any tips or examples of best practices for using the st.progress function effectively.

Hey @DeeTherese ! Thanks for the question. Taking out the dataframe, I was able to update the progress bar here.

import streamlit as st
import time

progress_bar = st.progress(0)

time.sleep(2)
progress_bar.progress(10, text = "File Read")

time.sleep(2)
progress_bar.progress(20, text = "Displayed data")

time.sleep(2)
progress_bar.progress(30, text = "Summarized data")

My initial thought is simply that the dataframe happens far faster that the progress bar completes fast enough. Perhaps a video that demonstrates the problem could help?

Gotcha. Yea I am stumped. I only notice the colors are heavily changed, so I wonder if some styling is making it seem filled and not showing the progress. How are you styling it?

Here’s my change included without any styling.

ScreenRecording2024-08-28at9.06.04AM-ezgif.com-video-to-gif-converter

Hi, I haven’t added any styling to it! Here’s another sample of code. I also did add some sleep time but it made no difference.

if 'root_location' in st.session_state and 'filetype' in st.session_state:

        progress_bar = st.progress(0, text="Quality check in progress. Please wait...")

        root_location = st.session_state['root_location']
        filetype = st.session_state['filetype']
        filepath = f"{root_location}/rclif/clif_labs.{filetype}"

        logger.info(f"Filepath set to {filepath}")

        if os.path.exists(filepath):
            logger.info(f"File {filepath} exists.")
            # Start time
            start_time = time.time()
            progress_bar.progress(10, text='File found…')

Wondering the styling is from the custom theme, I just changed color there but didn’t specifically code it in, if that makes sense?

Can you try creating a standalone script that doesn’t use any custom theme, and just simply tries to progress the bar?

Hey @blackary, thank you it works without Streamlit’s custom theme settings! Is it possible to have it with the custom theme?

Hi @DeeTherese,

It’s hard to say for sure – what custom theme settings are you using exactly? Can you describe how you are using a custom theme in your app?

I meant this custom theme was what I was using before, but the progress bar wasn’t increasing in incremements.

Can you please explain what exactly is the custom theme you are using – what are all the different values?