Last active
March 31, 2020 15:36
-
-
Save tc87/b7c9d5870afed0d7300c6be5f20badfd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
st.sidebar.title('Features') | |
... | |
# If the user doesn't want to select which features to control, these will be used. | |
default_control_features = ['Young','Smiling','Male'] | |
if st.sidebar.checkbox('Show advanced options'): | |
# Randomly initialize feature values. | |
features = get_random_features(feature_names, seed) | |
# Let the user pick which features to control with sliders. | |
control_features = st.sidebar.multiselect( | |
'Control which features?', | |
sorted(features), default_control_features) | |
else: | |
features = get_random_features(feature_names, seed) | |
# Don't let the user pick feature values to control. | |
control_features = default_control_features | |
# Insert user-controlled values from sliders into the feature vector. | |
for feature in control_features: | |
features[feature] = st.sidebar.slider(feature, 0, 100, 50, 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment