gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
2023-11-29 15:23:30.090 st.cache is deprecated. Please use one of Streamlit's new…
- User
2023-11-29 15:23:30.090
st.cacheis deprecated. Please use one of Streamlit's new caching commands,st.cache_dataorst.cache_resource. - Assistant
Starting from Streamlit version 0.84, the use of
st.cacheis deprecated and replaced with new caching commands:st.cache_dataandst.cache_resource.To cache data, you can use
st.cache_datadecorator. Here's an example:@st.cache_data def expensive_computation(arg1, arg2): # Perform expensive computation return result # Call the function and cache the result result = expensive_computation(arg1, arg2)Similarly, for caching resources, you can use
st.cache_resourcedecorator. Here's an example:@st.cache_resource def load_large_file(file_path): # Load the large file return data # Call the function and cache the result data = load_large_file(file_path)Make sure to replace any
st.cacheusages withst.cache_dataorst.cache_resourceto ensure compatibility with future versions of Streamlit.