Replace st.cache with st.cache_resource

#4
by whitphx HF staff - opened
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)