How to use the streamlit.button 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 streamlit / streamlit / e2e / scripts / button.py View on Github external
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# 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 / ml_app_registry / app.py View on Github external
def sallery_predictor_component():
    """## Sallery Predictor Component

    A user can input some of his developer features like years of experience and he will get a
    prediction of his sallery
    """
    st.markdown("## App 2: Salary Predictor For Techies")

    experience = st.number_input("Years of Experience")
    test_score = st.number_input("Aptitude Test score")
    interview_score = st.number_input("Interview Score")

    if st.button("Predict"):
        model = get_pickle(MODEL_PKL_FILE)
        features = [experience, test_score, interview_score]
        final_features = [np.array(features)]
        prediction = model.predict(final_features)
        st.balloons()
        st.success(f"Your Salary per anum is: Ghc {prediction[0]:.0f}")
github streamlit / streamlit / examples / interactive_widgets.py View on Github external
w1 = st.checkbox("I am human", True)
st.write(w1)

if w1:
    st.write("Agreed")

st.subheader("Slider")
w2 = st.slider("Age", 0.0, 100.0, (32.5, 72.5), 0.5)
st.write(w2)

st.subheader("Textarea")
w3 = st.text_area("Comments", "Streamlit is awesomeness!")
st.write(w3)

st.subheader("Button")
w4 = st.button("Click me")
st.write(w4)

if w4:
    st.write("Hello, Interactive Streamlit!")

st.subheader("Radio")
options = ("female", "male")
w5 = st.radio("Gender", options, 1)
st.write(w5)

st.subheader("Text input")
w6 = st.text_input("Text input widget", "i iz input")
st.write(w6)

st.subheader("Selectbox")
options = ("first", "second")
github ICLRandD / Blackstone / black_lit.py View on Github external
if vector_size:
    st.header("Vectors & Similarity")
    st.code(nlp.meta["vectors"])
    text1 = st.text_input("Text or word 1", "apple")
    text2 = st.text_input("Text or word 2", "orange")
    doc1 = process_text(spacy_model, text1)
    doc2 = process_text(spacy_model, text2)
    similarity = doc1.similarity(doc2)
    if similarity > 0.5:
        st.success(similarity)
    else:
        st.error(similarity)

st.header("Token attributes")

if st.button("Show token attributes"):
    attrs = [
        "idx",
        "text",
        "lemma_",
        "pos_",
        "tag_",
        "dep_",
        "head",
        "ent_type_",
        "ent_iob_",
        "shape_",
        "is_alpha",
        "is_ascii",
        "is_digit",
        "is_punct",
        "like_num",
github MarcSkovMadsen / awesome-streamlit / gallery / iris_eda_app / iris_eda_app.py View on Github external
+ To show a simple EDA of Iris using Streamlit framework.
		"""
    )

    # Your code goes below
    # Our Dataset
    my_dataset = "iris.csv"

    # 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)

    # Show Dimensions and Shape of Dataset
    data_dim = st.radio("What Dimension Do You Want to Show", ("Rows", "Columns"))
    if data_dim == "Rows":
github Jcharis / Streamlit_DataScience_Apps / Iris_EDA_Web_App / iris_app.py View on Github external
st.text("Showing Virginica Species")
    	st.image(load_image('imgs/iris_virginica.jpg'))



    # 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 ICLRandD / Blackstone / blackstream.py View on Github external
"is_ascii",
        "is_digit",
        "is_punct",
        "like_num",
    ]
    data = [[str(getattr(token, attr)) for attr in attrs] for token in doc]
    df = pd.DataFrame(data, columns=attrs)
    st.dataframe(df)


st.header("JSON Doc")
if st.button("Show JSON Doc"):
    st.json(doc.to_json())

st.header("JSON model meta")
if st.button("Show JSON model meta"):
    st.json(nlp.meta)
github streamlit / streamlit / lib / streamlit / hello / demos.py View on Github external
chart = st.line_chart(last_rows)

    for i in range(1, 101):
        new_rows = last_rows[-1, :] + np.random.randn(5, 1).cumsum(axis=0)
        status_text.text("%i%% Complete" % i)
        chart.add_rows(new_rows)
        progress_bar.progress(i)
        last_rows = new_rows
        time.sleep(0.05)

    progress_bar.empty()

    # Streamlit widgets automatically run the script from top to bottom. Since
    # this button is not connected to any other logic, it just causes a plain
    # rerun.
    st.button("Re-run")
github explosion / spaCy / examples / streamlit_spacy.py View on Github external
"ent_type_",
        "ent_iob_",
        "shape_",
        "is_alpha",
        "is_ascii",
        "is_digit",
        "is_punct",
        "like_num",
    ]
    data = [[str(getattr(token, attr)) for attr in attrs] for token in doc]
    df = pd.DataFrame(data, columns=attrs)
    st.dataframe(df)


st.header("JSON Doc")
if st.button("Show JSON Doc"):
    st.json(doc.to_json())

st.header("JSON model meta")
if st.button("Show JSON model meta"):
    st.json(nlp.meta)