... streamlit.

Sometimes you'd like to show a demo of working code without a jupyter notebook around it. The code is useful, but it might scare some stakeholders away. For those moments streamlit can be a great option.


This is the app.py that we end up with at the end of the video;

import streamlit as st
import numpy as np
import matplotlib.pylab as plt

st.write("Here is our super important simulation")

st.sidebar.markdown("## Controls")
st.sidebar.markdown("You can **change** the values to change the *chart*.")
x = st.sidebar.slider('Slope', min_value=0.01, max_value=0.10, step=0.01)
y = st.sidebar.slider('Noise', min_value=0.01, max_value=0.10, step=0.01)

st.write(f"x={x} y={y}")
values = np.cumsum(1 + np.random.normal(x, y, (100, 10)), axis=0)

for i in range(values.shape[1]):
    plt.plot(values[:, i])


Note that we run this app from the command line by running;

streamlit run app.py

Feedback? See an issue? Something unclear? Feel free to mention it here.

If you want to be kept up to date, consider getting the newsletter.