You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Streamlit is an open-source Python framework that turns data scripts into shareable web applications in minutes — with no front-end experience required. It is widely used for building data dashboards, machine learning demos, and interactive reports.
pip install streamlit
Run a Streamlit app:
streamlit run app.py
| Feature | Description |
|---|---|
| Pure Python | No HTML, CSS, or JavaScript required |
| Reactive | The app re-runs from top to bottom on every interaction |
| Fast prototyping | Go from script to web app in minutes |
| Built-in widgets | Sliders, dropdowns, text inputs, file uploaders |
| Chart support | Native support for Matplotlib, Seaborn, Plotly, Altair, and more |
| Deployment | Free deployment via Streamlit Community Cloud |
Create a file called app.py:
import streamlit as st
st.title("Hello, Streamlit!")
st.write("This is my first Streamlit app.")
Run it:
streamlit run app.py
import streamlit as st
st.title("Main Title")
st.header("Section Header")
st.subheader("Sub-section")
st.write("General text — supports **Markdown**.")
st.markdown("Use `st.markdown()` for rich formatting.")
st.caption("Small caption text")
st.code("print('Hello')", language="python")
st.latex(r"E = mc^2")
import streamlit as st
import pandas as pd
import numpy as np
df = pd.DataFrame(
np.random.randn(10, 3),
columns=["A", "B", "C"]
)
st.dataframe(df) # Interactive table
st.table(df.head()) # Static table
st.metric("Revenue", "£1.2M", "+12%")
st.json({"name": "Alice", "score": 95})
import streamlit as st
import pandas as pd
import numpy as np
df = pd.DataFrame(
np.random.randn(20, 3),
columns=["A", "B", "C"]
)
st.line_chart(df)
st.bar_chart(df)
st.area_chart(df)
import streamlit as st
import matplotlib.pyplot as plt
import seaborn as sns
tips = sns.load_dataset("tips")
fig, ax = plt.subplots()
sns.histplot(data=tips, x="total_bill", bins=20, ax=ax)
ax.set_title("Distribution of Total Bill")
st.pyplot(fig)
import streamlit as st
import plotly.express as px
df = px.data.gapminder()
df_2007 = df[df["year"] == 2007]
fig = px.scatter(df_2007, x="gdpPercap", y="lifeExp",
size="pop", color="continent",
hover_name="country", log_x=True,
title="Gapminder 2007")
st.plotly_chart(fig, use_container_width=True)
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.