You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: content/library/api/performance/cache-resource.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,7 @@ def load_model():
73
73
You can also use [interactive input widgets](/library/api-reference/widgets) like `st.slider` or `st.text_input` in cached functions. Widget replay is an experimental feature at the moment. To enable it, you need to set the `experimental_allow_widgets` parameter:
74
74
75
75
```python
76
-
@st.cache_data(experimental_allow_widgets=True) # 👈 Set the parameter
76
+
@st.cache_resource(experimental_allow_widgets=True) # 👈 Set the parameter
77
77
defload_model():
78
78
pretrained = st.checkbox("Use pre-trained model:") # 👈 Add a checkbox
79
79
model = torchvision.models.resnet50(weights=ResNet50_Weights.DEFAULT, pretrained=pretrained)
0 commit comments