Progress bar error: StreamlitAPIException: Progress Value has invalid value [0.0, 1.0]: 1.100000

Hello everyone,
I am working on a speech analytic app that makes use of the progress bar.
Once in a while, I get the following error and I am not sure what the issue is.

Progressbar error: StreamlitAPIException: Progress Value has invalid value [0.0, 1.0]: 1.100000

Here is my code:

and line 96 is

sleep_duration = 0.01

Thanks in advance for your help.

st.title("Speech to Text, made simple")
st.header("Transcribe audio to text")
# st.markdown("<h2 style='text-align: left; color:black;'>Automatic audio to text transcriptions</h2>",
#            unsafe_allow_html=True)

fileObject = st.file_uploader(
    label="Please upload your audio file", type=["mp3"])
if fileObject is not None:

    # st.write(type(fileObject))
    file_details = {"filename":,
                    "filetype": fileObject.type, "filesize": fileObject.size}
    audio_bytes = fileObject.getvalue(), format='audio/mp3')
    token, t_id = upload_file(fileObject)
    result = {}
    # polling
    sleep_duration = 1
    percent_complete = 0
    progress_bar = st.progress(percent_complete)
    while result.get("status") != "processing":
        percent_complete += sleep_duration
        result = get_text(token, t_id)
        sleep_duration = 0.01

    for percent in range(percent_complete, 101):

    with st.spinner("Grab a coffee while we transcribe your file....."):
        while result.get("status") != 'completed':
            result = get_text(token, t_id)
    # st.balloons()
    # st.header("Transcribed Text")
    # st.subheader(result['text'])

    nlp = spacy.load("en_core_web_sm")

    # DEFAULT_TEXT = result['text']
    CONFIDENCE = result['confidence']
    if CONFIDENCE > 0.90:
        st.write("Audio quality is pretty good with", round(
            CONFIDENCE, 2), "percentage confidence level")
        st.write("Audio quality could be better", round(
            CONFIDENCE, 2), "percentage confidence level")
    AUDIO_DURATION = time.strftime(
        "%M:%S", time.localtime(result['audio_duration']))
    # AUDIO_DURATION = round(result['audio_duration']/60, 2)
    # print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
    st.write("Audio file is:", AUDIO_DURATION, "(minutes, seconds) long")
    DEFAULT_TEXT = result['text']
    ALL_WORDS = result['utterances']

Hi @dariushazimi -

This error is telling you that st.progress only takes values between 0 and 1, and you are passing a value of 1.1. So you need to figure out what part of your code is causing the completion to go above 1.


1 Like

@randyzwitch still can’t figure out why I am getting this error.

Any ideas?