st.title('Streamlit introduction')st.header('Build your first app')st.subheader('Text widgets are shown as below')st.text('I am the tool to display text')st.markdown('I am the *tool* to **display markdown**')st.markdown(':sunglasses:')st.code('''def hello(): print("Hello, Streamlit!")''', language='python')
df = pd.DataFrame( np.random.randn(10, 5), columns=('col %d' % i for i in range(5)))st.table(df)st.dataframe(df)st.json({ 'foo': 'bar', 'baz': 'boz', 'stuff': [ 'stuff 1', 'stuff 2', 'stuff 3', 'stuff 5', ], })
st.write('-----------------------------------------checkbox--------------------------------------------')agree = st.checkbox('I agree')if agree: st.write('Great! You agreed!')st.write('-----------------------------------------selectbox-------------------------------------------')option = st.selectbox( 'Select your model', ('decision tree', 'logistic regression', 'SVM'))st.write('You selected:', option)st.write('-----------------------------------------multiselect-------------------------------------------')options = st.multiselect( 'What are your favorite colors', ['Green', 'Yellow', 'Red', 'Blue'], ['Yellow', 'Red'])st.write('You selected:', options)st.write('-----------------------------------------ratio-------------------------------------------')genre = st.radio( "What's your favorite model", ('linear regression', 'neural network'))if genre == 'linear regression': st.write('You like simple model')else: st.write("You like complex model")st.write('-----------------------------------------slider-------------------------------------------')st.slider('How old are you?', min_value=0, max_value=100, value=20, step=5)
st.write('-----------------------------------------text_input--------------------------------------------')st.text_input('Movie title', 'Life of Brian')st.write('-----------------------------------------number_input-------------------------------------------')st.number_input('Insert a number')st.write('-----------------------------------------text_area-------------------------------------------')txt = st.text_area('Text to analyze', '''It was the best of times, it was the worst of times, it wasthe age of wisdom, it was the age of foolishness, it wasthe epoch of belief, it was the epoch of incredulity, itwas the season of Light, it was the season of Darkness, itwas the spring of hope, it was the winter of despair, (...)''')st.write('-----------------------------------------date_input-------------------------------------------')st.date_input( "When's your birthday", datetime.date(2019, 7, 6))st.write('-----------------------------------------file_uploader-------------------------------------------')uploaded_file = st.file_uploader("Choose a CSV file", type="csv")