Streamlit: Data Apps Without Frontend Skills
Streamlit turns Python scripts into interactive web apps. No HTML, no CSS, no JavaScript. Write Python, get a beautiful dashboard. Used by data scientists, ML engineers, and analysts worldwide.
Why Streamlit
- Pure Python — no frontend knowledge needed
- Instant reload — save file, app updates
- Widgets — sliders, buttons, file uploads, charts
- Data-friendly — native pandas, plotly, matplotlib support
- Free hosting — Streamlit Community Cloud
The Free API
import streamlit as st
import pandas as pd
import plotly.express as px
st.title("Sales Dashboard")
# File upload
file = st.file_uploader("Upload CSV", type="csv")
if file:
df = pd.read_csv(file)
# Filters
col = st.selectbox("Group by", df.columns)
metric = st.selectbox("Metric", df.select_dtypes("number").columns)
# Chart
fig = px.bar(df.groupby(col)[metric].sum().reset_index(), x=col, y=metric)
st.plotly_chart(fig)
# Metrics
col1, col2, col3 = st.columns(3)
col1.metric("Total", f"${df[metric].sum():,.0f}")
col2.metric("Average", f"${df[metric].mean():,.0f}")
col3.metric("Count", len(df))
# Data table
st.dataframe(df)
ML Model Demo
import streamlit as st
from transformers import pipeline
@st.cache_resource
def load_model():
return pipeline("sentiment-analysis")
model = load_model()
text = st.text_area("Enter text for sentiment analysis")
if st.button("Analyze"):
result = model(text)
st.write(f"Sentiment: {result[0][label]}")
st.progress(result[0]["score"])
Chat Interface
import streamlit as st
if "messages" not in st.session_state:
st.session_state.messages = []
for msg in st.session_state.messages:
st.chat_message(msg["role"]).write(msg["content"])
if prompt := st.chat_input("Ask something"):
st.session_state.messages.append({"role": "user", "content": prompt})
response = get_ai_response(prompt) # Your LLM call
st.session_state.messages.append({"role": "assistant", "content": response})
st.chat_message("assistant").write(response)
Real-World Use Case
A data analyst built sales reports in Excel. Manager wanted interactive dashboards. Streamlit: 50 lines of Python, deployed to Community Cloud. Interactive filters, real-time charts, CSV export. Manager uses it daily.
Quick Start
pip install streamlit
streamlit hello # Demo app
streamlit run app.py # Your app
Resources
Need data for your dashboards? Check out my scraping tools on Apify or email spinov001@gmail.com for custom data solutions.
Top comments (0)