Text in st.spinner

Hi, I’m using the st.spinner to show something like Calling API when calling an API. It takes some time, so is it possible to have multiple values like “Extracting”, “Processing” and similar text instead of just one text?

The easiest way to do this would probably be to just replace the spinner when you want to change the text value, e.g.:

import streamlit as st
import time

with st.spinner("Extracting"):
    time.sleep(5)
with st.spinner("Processing"):
    time.sleep(5)
st.success('Done!')
3 Likes

Hi, @Caroline thanks for the suggestion. But, my use case is something like this:

with st.spinner("Calling API"):
      call API

The API call takes about 20-30 sec. I want to display different text during that time.

Hi @VishnuS-S,

Perhaps you could also try st.progress, more info here:

This allows you to show a progress bar that can iteratively be updated to show the progress.

4 Likes

Modified my code so that st.progress can be used. Thanks for the help @dataprofessor.

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.