我想更改调用函数时显示的占位符文本:
我尝试使用
with st.spinner(text="Fetching measures"):
measures = fetch_measures(userid, start_ts, end_ts)
,但是它只是在上面带有“提取措施”的警告中添加了新的警告。有没有办法只更改文本“ Running function_name(…)”?
答案 0 :(得分:1)
Streamlit's forum上有一种方法:
@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()
只需在show_spinner=False
装饰器中添加st.cache()
即可删除警告。然后,使用with st.spinner(text="Fetching measures")
添加您自己的警告。