python streamlit - ghdrako/doc_snipets GitHub Wiki
tags:
- programming
- python
Python streamlit
pip install streamlit
streamlit hello
mkdir plotting_app
cd plotting_app
touch plot_demo.py
import time
import numpy as np
import streamlit as st
progress_bar = st.sidebar.progress(0)
status_text = st.sidebar.empty()
last_rows = np.random.randn(1, 1)
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()
st.button("Re-run")
streamlit run plot_demo.py