How to use the streamlit.checkbox function in streamlit

To help you get started, we’ve selected a few streamlit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github awarebayes / RecNN / examples / streamlit_demo.py View on Github external
if page == "🔨 Test Recommendation":

        st.header("Test the Recommendations")

        st.info("Upon the first opening the data will start loading."
                "\n Unfortunately there is no progress verbose in streamlit. Look in your console.")

        st.success('Data is loaded!')

        models = load_models(device)
        st.success('Models are loaded!')

        state, action, reward, next_state, done = get_batch(device)

        st.subheader('Here is a random batch sampled from testing environment:')
        if st.checkbox('Print batch info'):
            st.subheader('State')
            st.write(state)
            st.subheader('Action')
            st.write(action)
            st.subheader('Reward')
            st.write(reward.squeeze())

        st.subheader('(Optional) Select the state are getting the recommendations for')

        action_id = np.random.randint(0, state.size(0), 1)[0]
        action_id_manual = st.checkbox('Manually set state index')
        if action_id_manual:
            action_id = st.slider("Choose state index:", min_value=0, max_value=state.size(0))

        st.write('state:', state[action_id])
github MarcSkovMadsen / awesome-streamlit / gallery / iris_eda_app / iris_eda_app.py View on Github external
# Show All Column Names
    if st.checkbox("Show All Column Name"):
        st.text("Columns:")
        st.write(data.columns)

    # Show Dimensions and Shape of Dataset
    data_dim = st.radio("What Dimension Do You Want to Show", ("Rows", "Columns"))
    if data_dim == "Rows":
        st.text("Showing Length of Rows")
        st.write(len(data))
    if data_dim == "Columns":
        st.text("Showing Length of Columns")
        st.write(data.shape[1])

    # Show Summary of Dataset
    if st.checkbox("Show Summary of Dataset"):
        st.write(data.describe())

    # Selection of Columns
    species_option = st.selectbox(
        "Select Columns",
        ("sepal_length", "sepal_width", "petal_length", "petal_width", "species"),
    )
    if species_option == "sepal_length":
        st.write(data["sepal_length"])
    elif species_option == "sepal_width":
        st.write(data["sepal_width"])
    elif species_option == "petal_length":
        st.write(data["petal_length"])
    elif species_option == "petal_width":
        st.write(data["petal_width"])
    elif species_option == "species":
github zacheberhart / Learning-to-Feel / src / app.py View on Github external
you choose as few as possible -- though you will definitely get some pretty funky results the more you add.
	''')

	# filters
	labels = st.multiselect("Choose:", dims)
	n_songs = st.slider('How many songs?', 1, 100, 20)
	popularity = st.slider('How popular?', 0, 100, (0, 100))

	try:

		# filter data to the labels the user specified
		cols = (non_label_cols, labels)
		df = filter_data(df, cols, n_songs, popularity)

		# show data
		if st.checkbox('Include Preview URLs', value = True):
			df['preview'] = add_stream_url(df.track_id)
			df['preview'] = df['preview'].apply(make_clickable, args = ('Listen',))
			data = df.drop('track_id', 1)
			data = data.to_html(escape = False)
			st.write(data, unsafe_allow_html = True)
		else:
			data = df.drop('track_id', 1)
			st.write(data)

	except: pass
github streamlit / streamlit / e2e / scripts / button.py View on Github external
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import streamlit as st

i1 = st.button("button 1")
st.write("value:", i1)

i2 = st.checkbox("reset button")
github MarcSkovMadsen / awesome-streamlit / gallery / iris_classification / iris.py View on Github external
def main():
    """## Main function of Iris Classifier App

    Run this to run the app.
    """
    st.title("Iris Classifier")
    st.header("Data Exploration")

    source_df = read_iris_csv()
    st.subheader("Source Data")
    if st.checkbox("Show Source Data"):
        st.write(source_df)

    selected_species_df = select_species(source_df)
    if not selected_species_df.empty:
        show_scatter_plot(selected_species_df)
        show_histogram_plot(selected_species_df)
    else:
        st.info("Please select one of more varieties above for further exploration.")

    show_machine_learning_model(source_df)
github MarcSkovMadsen / awesome-streamlit / src / pages / resources.py View on Github external
def write():
    """Writes content to the app"""
    ast.shared.components.title_awesome("Resources")
    st.sidebar.title("Resources")
    tags = ast.shared.components.multiselect(
        "Select Tag(s)", options=ast.database.TAGS, default=[]
    )

    author_all = ast.shared.models.Author(name="All", url="")
    author = st.selectbox("Select Author", options=[author_all] + ast.database.AUTHORS)
    if author == author_all:
        author = None
    show_awesome_resources_only = st.checkbox("Show Awesome Resources Only", value=True)
    if not tags:
        st.info(
            """Please note that **we list each resource under a most important tag only!**"""
        )
    resource_section = st.empty()

    with st.spinner("Loading resources ..."):
        markdown = resources.get_resources_markdown(
            tags, author, show_awesome_resources_only
        )
        resource_section.markdown(markdown)

    if st.sidebar.checkbox("Show Resource JSON"):
        st.subheader("Source JSON")
        st.write(ast.database.RESOURCES)
github MarcSkovMadsen / awesome-streamlit / gallery / iris_eda_app / iris_eda_app.py View on Github external
# Show Image or Hide Image with Checkbox
    if st.checkbox("Show Image/Hide Image"):
        my_image = load_image("iris_setosa.jpg")
        enh = ImageEnhance.Contrast(my_image)
        num = st.slider("Set Your Contrast Number", 1.0, 3.0)
        img_width = st.slider("Set Image Width", 300, 500)
        st.image(enh.enhance(num), width=img_width)

    # About
    if st.button("About App"):
        st.subheader("Iris Dataset EDA App")
        st.text("Built with Streamlit")
        st.text("Thanks to the Streamlit Team Amazing Work")

    if st.checkbox("By"):
        st.text("Jesse E.Agbe(JCharis)")
        st.text("Jesus Saves@JCharisTech")
github MarcSkovMadsen / awesome-streamlit / gallery / iris_eda_app / iris_eda_app.py View on Github external
# Show Dataset
    if st.checkbox("Preview DataFrame"):
        if st.button("Head"):
            st.write(data.head())
        if st.button("Tail"):
            st.write(data.tail())
        else:
            st.write(data.head(2))

    # Show Entire Dataframe
    if st.checkbox("Show All DataFrame"):
        st.dataframe(data)

    # Show All Column Names
    if st.checkbox("Show All Column Name"):
        st.text("Columns:")
        st.write(data.columns)

    # Show Dimensions and Shape of Dataset
    data_dim = st.radio("What Dimension Do You Want to Show", ("Rows", "Columns"))
    if data_dim == "Rows":
        st.text("Showing Length of Rows")
        st.write(len(data))
    if data_dim == "Columns":
        st.text("Showing Length of Columns")
        st.write(data.shape[1])

    # Show Summary of Dataset
    if st.checkbox("Show Summary of Dataset"):
        st.write(data.describe())
github Jcharis / Streamlit_DataScience_Apps / Iris_EDA_Web_App / iris_app.py View on Github external
# Your code goes below
    # Our Dataset
    my_dataset = "iris.csv"

    # To Improve speed and cache data
    @st.cache(persist=True)
    def explore_data(dataset):
    	df = pd.read_csv(os.path.join(dataset))
    	return df 

    # Load Our Dataset
    data = explore_data(my_dataset)

    # Show Dataset
    if st.checkbox("Preview DataFrame"):
    	if st.button("Head"):
    		st.write(data.head())
    	if st.button("Tail"):
    		st.write(data.tail())
    	else:
    		st.write(data.head(2))

    # Show Entire Dataframe
    if st.checkbox("Show All DataFrame"):
    	st.dataframe(data)

    # Show All Column Names
    if st.checkbox("Show All Column Name"):
    	st.text("Columns:")
    	st.write(data.columns)
github MarcSkovMadsen / awesome-streamlit / gallery / file_uploader_multiple_files / file_uploader_multiple_files.py View on Github external
if result:
        # Process you file here
        value = result.getvalue()

        # And add it to the static_store if not already in
        if not value in static_store.values():
            static_store[result] = value
    else:
        static_store.clear()  # Hack to clear list if the user clears the cache and reloads the page
        st.info("Upload one or more `.py` files.")

    if st.button("Clear file list"):
        static_store.clear()
    if st.checkbox("Show file list?", True):
        st.write(list(static_store.keys()))
    if st.checkbox("Show content of files?"):
        for value in static_store.values():
            st.code(value)