whitphx HF staff commited on
Commit
95de43d
1 Parent(s): ae58a5d

Replace st.cache with st.cache_resource

Browse files

> st.cache was deprecated in version 1.18.0. Use st.cache_data or st.cache_resource instead. Learn more in Caching.
> https://docs.streamlit.io/library/api-reference/performance/st.cache

Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -8,7 +8,7 @@ DATE_COLUMN = 'date/time'
8
  DATA_URL = ('https://s3-us-west-2.amazonaws.com/'
9
  'streamlit-demo-data/uber-raw-data-sep14.csv.gz')
10
 
11
- @st.cache
12
  def load_data(nrows):
13
  data = pd.read_csv(DATA_URL, nrows=nrows)
14
  lowercase = lambda x: str(x).lower()
@@ -33,4 +33,4 @@ hour_to_filter = st.slider('hour', 0, 23, 17)
33
  filtered_data = data[data[DATE_COLUMN].dt.hour == hour_to_filter]
34
 
35
  st.subheader('Map of all pickups at %s:00' % hour_to_filter)
36
- st.map(filtered_data)
 
8
  DATA_URL = ('https://s3-us-west-2.amazonaws.com/'
9
  'streamlit-demo-data/uber-raw-data-sep14.csv.gz')
10
 
11
+ @st.cache_resource
12
  def load_data(nrows):
13
  data = pd.read_csv(DATA_URL, nrows=nrows)
14
  lowercase = lambda x: str(x).lower()
 
33
  filtered_data = data[data[DATE_COLUMN].dt.hour == hour_to_filter]
34
 
35
  st.subheader('Map of all pickups at %s:00' % hour_to_filter)
36
+ st.map(filtered_data)