How to use the streamlit.sidebar.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 JAVI897 / ML-Metrics / src / pages / pages_functions.py View on Github external
def configuration(other_graph = False):
    
    df_binary= pd.DataFrame({"threshold":["No","Yes"],
                  "fill":["No","Yes"],
                  "legend":["Yes","No"]})
    
    threshold=False
    fill=False
    legend=True
    number_threshold = 100
    if st.sidebar.checkbox("Show settings"):
        #Threshold visualization
        option_threshold= st.sidebar.selectbox("Threshold",list(df_binary["threshold"]), index = 0)
        threshold = True if option_threshold == "Yes" else False

        #Fill visualization
        if other_graph == False:
            option_fill=  st.sidebar.selectbox("Fill",list(df_binary["fill"]), index = 0)
            fill = True if option_fill == "Yes" else False
        if other_graph:
            fill = None
        #Legend visualization
        option_legend= st.sidebar.selectbox("Legend",list(df_binary["legend"]), index = 0)
        legend = True if option_legend == "Yes" else False
        
        number_threshold = st.sidebar.slider("Number of thresholds:", min_value = 0, 
                                             max_value = 100, value = 100)
github ICLRandD / Blackstone / black_lit.py View on Github external
"""
)


model_load_state = st.info(f"Loading model '{spacy_model}'...")
nlp = spacy.load('en_blackstone_proto')
model_load_state.empty()

text = st.text_area("Text to analyze", DEFAULT_TEXT)
doc = process_text(spacy_model, text)

if "parser" in nlp.pipe_names:
    st.header("Dependency Parse & Part-of-speech tags")
    st.sidebar.header("Dependency Parse")
    split_sents = st.sidebar.checkbox("Split sentences", value=True)
    collapse_punct = st.sidebar.checkbox("Collapse punctuation", value=True)
    collapse_phrases = st.sidebar.checkbox("Collapse phrases")
    compact = st.sidebar.checkbox("Compact mode")
    options = {
        "collapse_punct": collapse_punct,
        "collapse_phrases": collapse_phrases,
        "compact": compact,
    }
    docs = [span.as_doc() for span in doc.sents] if split_sents else [doc]
    for sent in docs:
        html = displacy.render(sent, options=options)
        # Double newlines seem to mess with the rendering
        html = html.replace("\n\n", "\n")
        if split_sents and len(docs) > 1:
            st.markdown(f"> {sent.text}")
        st.write(HTML_WRAPPER.format(html), unsafe_allow_html=True)
github MarcSkovMadsen / awesome-streamlit / gallery / layout_experiments / app.py View on Github external
def select_block_container_style():
    """Add selection section for setting setting the max-width and padding
    of the main block container"""
    st.sidebar.header("Block Container Style")
    max_width_100_percent = st.sidebar.checkbox("Max-width: 100%?", False)
    if not max_width_100_percent:
        max_width = st.sidebar.slider("Select max-width in px", 100, 2000, 1200, 100)
    else:
        max_width = 1200
    dark_theme = st.sidebar.checkbox("Dark Theme?", False)
    padding_top = st.sidebar.number_input("Select padding top in rem", 0, 200, 5, 1)
    padding_right = st.sidebar.number_input("Select padding right in rem", 0, 200, 1, 1)
    padding_left = st.sidebar.number_input("Select padding left in rem", 0, 200, 1, 1)
    padding_bottom = st.sidebar.number_input(
        "Select padding bottom in rem", 0, 200, 10, 1
    )
    if dark_theme:
        global COLOR
        global BACKGROUND_COLOR
        BACKGROUND_COLOR = "rgb(17,17,17)"
        COLOR = "#fff"
github paulozip / arauto / lib / sidebar_menus.py View on Github external
'Daily': 7, 
                        'Monthly': 12, 
                        'Quarterly': 4, 
                        'Yearly': 5}

    if menu_name == 'absolute':
        show_absolute_plot = st.sidebar.checkbox('Historical data', value=True)
        return show_absolute_plot
    elif menu_name == 'seasonal':
        show_seasonal_decompose = st.sidebar.checkbox('Seasonal decompose', value=True)
        return show_seasonal_decompose
    elif menu_name == 'adfuller':
        show_adfuller = st.sidebar.checkbox('Dickey-Fuller statistical test', value=True)
        return show_adfuller
    elif menu_name == 'train_predictions':
        show_train_predict_plot = st.sidebar.checkbox('Train set predictions', value=True)
        return show_train_predict_plot
    elif menu_name == 'test_predictions':
        show_test_predict_plot = st.sidebar.checkbox('Test set forecast', value=True)
        return show_test_predict_plot
    elif menu_name == 'feature_target':
        data_frequency = st.sidebar.selectbox('What is the FREQUENCY of your data? ', ['Select a frequency', 'Hourly', 'Daily', 'Monthly', 'Quarterly', 'Yearly'], 0)
        
        # If the frequency do not select a frequency for the dataset, it will raise an error
        if data_frequency == 'Select a frequency':
            # Hiding traceback in order to only show the error message
            sys.tracebacklimit = 0
            raise ValueError('Please, select the FREQUENCY for your data')
        
        # Show traceback error
        sys.tracebacklimit = None
github awarebayes / RecNN / examples / streamlit_demo.py View on Github external
def main():
    st.sidebar.header('📰 recnn by @awarebayes 👨‍🔧')

    if st.sidebar.checkbox('Use cuda', torch.cuda.is_available()):
        device = torch.device('cuda')
    else:
        device = torch.device('cpu')

    st.sidebar.subheader('Choose a page to proceed:')
    page = st.sidebar.selectbox("", ["🚀 Get Started", "📽 ️Recommend me a movie", "🔨 Test Recommendation",
                                     "⛏️ Test Diversity", "🤖 Reinforce Top K"])

    st.sidebar.markdown("""
    ### I need your help!
    Currently, I am at my final year of high school, doing all this to get into a university.
    I live in Russia and believe that I have no future here.
    
    If you happened to know a prof/teacher/postdoc/anyone at your 
    university, please show them my CV: [link](https://drive.google.com/file/d/1jgM-SzEUbUjqgHzaajoUv4ENhC7-oaDT/view?usp=sharing).
github IliaLarchenko / albumentations-demo / src / control.py View on Github external
def select_checkbox(param_name, defaults, **kwargs):
    st.sidebar.subheader(param_name)
    result = st.sidebar.checkbox("True", defaults, key=hash(param_name))
    return result
github MarcSkovMadsen / awesome-streamlit / gallery / yahoo_finance_app / yahoo_finance_app.py View on Github external
max_value=min([2000, data.shape[0]]),
        value=500,
        step=10,
    )

    data2 = data[-section:]["Adj Close"].to_frame("Adj Close")

    sma = st.sidebar.checkbox("SMA")
    if sma:
        period = st.sidebar.slider(
            "SMA period", min_value=5, max_value=500, value=20, step=1
        )
        data[f"SMA {period}"] = data["Adj Close"].rolling(period).mean()
        data2[f"SMA {period}"] = data[f"SMA {period}"].reindex(data2.index)

    sma2 = st.sidebar.checkbox("SMA2")
    if sma2:
        period2 = st.sidebar.slider(
            "SMA2 period", min_value=5, max_value=500, value=100, step=1
        )
        data[f"SMA2 {period2}"] = data["Adj Close"].rolling(period2).mean()
        data2[f"SMA2 {period2}"] = data[f"SMA2 {period2}"].reindex(data2.index)

    st.subheader("Chart")
    st.line_chart(data2)

    if st.sidebar.checkbox("View stadistic"):
        st.subheader("Stadistic")
        st.table(data2.describe())

    if st.sidebar.checkbox("View quotes"):
        st.subheader(f"{asset} historical data")
github paduel / streamlit_finance_chart / app.py View on Github external
data.index.name = None

    section = st.sidebar.slider('Number of quotes', min_value=30,
                        max_value=min([2000, data.shape[0]]),
                        value=500,  step=10)

    data2 = data[-section:]['Adj Close'].to_frame('Adj Close')

    sma = st.sidebar.checkbox('SMA')
    if sma:
        period= st.sidebar.slider('SMA period', min_value=5, max_value=500,
                             value=20,  step=1)
        data[f'SMA {period}'] = data['Adj Close'].rolling(period ).mean()
        data2[f'SMA {period}'] = data[f'SMA {period}'].reindex(data2.index)

    sma2 = st.sidebar.checkbox('SMA2')
    if sma2:
        period2= st.sidebar.slider('SMA2 period', min_value=5, max_value=500,
                             value=100,  step=1)
        data[f'SMA2 {period2}'] = data['Adj Close'].rolling(period2).mean()
        data2[f'SMA2 {period2}'] = data[f'SMA2 {period2}'].reindex(data2.index)

    st.subheader('Chart')
    st.line_chart(data2)

    if st.sidebar.checkbox('View stadistic'):
        st.subheader('Stadistic')
        st.table(data2.describe())

    if st.sidebar.checkbox('View quotes'):
        st.subheader(f'{asset} historical data')
        st.write(data2)