Is there a way to change the placeholder text of a spinner?

I would like to change the placeholder text displayed when calling a function:

I tried using

with st.spinner(text="Fetching measures"):
        measures = fetch_measures(userid, start_ts, end_ts)

but it just adds a new warning above with “Fetching measures”. Is there a way to just change the text “Running function_name(…)”?

Hi vinzee,

I am not sure there is a beautiful solution to this, but you can disable the ‘original Running fetch_measures(…)’ by adding the show_spinner=False option on the cache decorator.

@st.cache(show_spinner=False)
def fetch_measures(x,y,z):
    #do stuff

and then you can use your solution using with st.spinner(text="Fetching measures")

2 Likes

Hi PeterT and vinzee
Can you give me an example of your code?? I’m having trouble after running @st.cache(show_spinner=False)

Hi Jose,

I did it like this:

@st.cache(show_spinner=False)
def fetch_measures():
    # do stuff
    time.sleep(10)


def main():
    with st.spinner(text="Fetching measures"):
        measures = fetch_measures()

if __name__ == "__main__":
    main()
1 Like