File size: 922 Bytes
b039265
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import streamlit as st
import numpy as np
import pandas as pd
import time

st.header(body=':red[4]', divider='violet')
st.sidebar.markdown('Page 4 :snowflake:')
if st.checkbox(label='Show DataFrame'):
    chart_data = pd.DataFrame(
        np.random.randn(20,3),
        columns=['a','b','c']
    )
    chart_data

if st.checkbox(label='Show time progess bar'):
    'Starting a long computation'

    # add a placeholder
    latest_iteration = st.empty()
    bar = st.progress(0)

    for i in range(100):
        # Update the progress bar with each iteration
        latest_iteration.text(f"Iteration {i+1}")
        bar.progress(i + 1)
        time.sleep(0.2)

    '.. and now we\'re done!'

if "counter" not in st.session_state:
    st.session_state.counter = 0

st.session_state.counter += 1

st.write(f"This page has run {st.session_state.counter} times.")
st.button("Run it again")