Top Related Projects
Data Apps & Dashboards for Python. No JavaScript Required.
Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
Panel: The powerful data exploration & web app framework for Python
Voilà turns Jupyter notebooks into standalone web applications
Interactive Data Visualization in the browser, from Python
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
Quick Overview
Streamlit is an open-source Python library for creating web applications with minimal effort. It allows data scientists and machine learning engineers to quickly build interactive, data-driven apps and dashboards without requiring extensive web development knowledge.
Pros
- Rapid prototyping and development of data apps
- Simple and intuitive API for creating interactive elements
- Automatic UI updates when data changes
- Built-in support for popular data science libraries (e.g., Pandas, Matplotlib, Plotly)
Cons
- Limited customization options compared to full-fledged web frameworks
- Performance can be slower for large datasets or complex computations
- Not ideal for production-grade applications with high traffic
- Steeper learning curve for developers familiar with traditional web frameworks
Code Examples
- Creating a simple app with a slider and a plot:
import streamlit as st
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 10, 100)
st.slider("Frequency", 1, 10, 2, key="freq")
y = np.sin(st.session_state.freq * x)
fig, ax = plt.subplots()
ax.plot(x, y)
st.pyplot(fig)
- Displaying a dataframe with filtering:
import streamlit as st
import pandas as pd
df = pd.DataFrame({
'A': [1, 2, 3, 4],
'B': [10, 20, 30, 40]
})
st.dataframe(df)
column = st.selectbox("Select column", df.columns)
value = st.number_input("Enter value")
filtered_df = df[df[column] > value]
st.write("Filtered dataframe:")
st.dataframe(filtered_df)
- Creating a simple form with file upload:
import streamlit as st
with st.form("my_form"):
st.write("Enter your information")
name = st.text_input("Name")
age = st.number_input("Age", min_value=0, max_value=120)
file = st.file_uploader("Upload a file")
submitted = st.form_submit_button("Submit")
if submitted:
st.write(f"Name: {name}, Age: {age}")
if file:
st.write(f"File uploaded: {file.name}")
Getting Started
To get started with Streamlit, follow these steps:
- Install Streamlit:
pip install streamlit
-
Create a new Python file (e.g.,
app.py
) and add your Streamlit code. -
Run the Streamlit app:
streamlit run app.py
- Open your web browser and navigate to the URL provided in the terminal (usually
http://localhost:8501
).
Competitor Comparisons
Data Apps & Dashboards for Python. No JavaScript Required.
Pros of Dash
- More customizable and flexible for complex layouts
- Better performance for large datasets and real-time updates
- Supports more advanced interactive visualizations
Cons of Dash
- Steeper learning curve, especially for beginners
- Requires more boilerplate code
- Less intuitive for rapid prototyping
Code Comparison
Streamlit:
import streamlit as st
import pandas as pd
df = pd.read_csv("data.csv")
st.line_chart(df)
Dash:
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import pandas as pd
app = dash.Dash(__name__)
df = pd.read_csv("data.csv")
app.layout = html.Div([
dcc.Graph(id='line-chart')
])
@app.callback(Output('line-chart', 'figure'),
Input('line-chart', 'relayoutData'))
def update_graph(relayoutData):
return {'data': [{'x': df.index, 'y': df['value'], 'type': 'line'}]}
if __name__ == '__main__':
app.run_server(debug=True)
Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
Pros of Gradio
- Easier to create machine learning model interfaces
- Better support for audio and image processing tasks
- More flexible layout options for complex interfaces
Cons of Gradio
- Smaller community and ecosystem compared to Streamlit
- Less extensive documentation and tutorials
- Fewer built-in components for data visualization
Code Comparison
Streamlit example:
import streamlit as st
def greet(name):
return f"Hello, {name}!"
name = st.text_input("Enter your name")
if st.button("Greet"):
st.write(greet(name))
Gradio example:
import gradio as gr
def greet(name):
return f"Hello, {name}!"
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()
Both Streamlit and Gradio are popular choices for creating web interfaces for machine learning models and data applications. Streamlit offers a more comprehensive ecosystem and is better suited for data visualization tasks, while Gradio excels in creating interfaces for machine learning models, especially those involving audio and image processing. The code comparison shows that both libraries provide simple ways to create interactive interfaces, with Gradio requiring slightly less code for basic functionality.
Panel: The powerful data exploration & web app framework for Python
Pros of Panel
- More flexible layout options and customization capabilities
- Better integration with data visualization libraries like Bokeh and HoloViews
- Supports both server-side and client-side rendering for improved performance
Cons of Panel
- Steeper learning curve compared to Streamlit's simplicity
- Less extensive documentation and smaller community
- Requires more boilerplate code for basic applications
Code Comparison
Streamlit example:
import streamlit as st
st.title("Hello World")
name = st.text_input("Enter your name")
st.write(f"Hello, {name}!")
Panel example:
import panel as pn
def greet(name):
return f"Hello, {name}!"
pn.extension()
name_input = pn.widgets.TextInput(name="name", placeholder="Enter your name")
greeting = pn.bind(greet, name_input)
pn.Column("# Hello World", name_input, greeting).servable()
Both Streamlit and Panel are powerful tools for creating interactive web applications with Python. Streamlit excels in simplicity and rapid prototyping, while Panel offers more flexibility and integration with data visualization libraries. The choice between them depends on the specific requirements of your project and your familiarity with the respective ecosystems.
Voilà turns Jupyter notebooks into standalone web applications
Pros of Voila
- Seamless integration with Jupyter notebooks, allowing direct conversion of notebooks to web applications
- Supports custom widgets and interactive visualizations from the Jupyter ecosystem
- Allows for more fine-grained control over the layout and styling of the dashboard
Cons of Voila
- Steeper learning curve, especially for those not familiar with Jupyter notebooks
- Less streamlined development process compared to Streamlit's single-file approach
- More complex deployment and hosting requirements
Code Comparison
Voila (in a Jupyter notebook):
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
@interact(x=widgets.IntSlider(min=-10, max=30, step=1, value=10))
def g(x):
return x * x
Streamlit:
import streamlit as st
x = st.slider('Select a value', -10, 30, 10)
st.write(f"The square of {x} is {x * x}")
Both Streamlit and Voila offer powerful tools for creating interactive dashboards and web applications from Python code. Streamlit provides a more straightforward, script-based approach, while Voila leverages the flexibility and rich ecosystem of Jupyter notebooks. The choice between them depends on your specific needs, existing workflow, and familiarity with Jupyter notebooks.
Interactive Data Visualization in the browser, from Python
Pros of Bokeh
- More flexible and customizable for complex visualizations
- Better performance for large datasets and real-time updates
- Supports server-side rendering for handling big data
Cons of Bokeh
- Steeper learning curve and more verbose code
- Less integrated with Python data science ecosystem
- Requires more setup and configuration for web deployment
Code Comparison
Streamlit:
import streamlit as st
import pandas as pd
df = pd.read_csv("data.csv")
st.line_chart(df)
Bokeh:
from bokeh.plotting import figure, show
from bokeh.io import output_file
import pandas as pd
df = pd.read_csv("data.csv")
p = figure()
p.line(df['x'], df['y'])
show(p)
Streamlit offers a more concise and intuitive API for creating interactive visualizations, while Bokeh provides greater control and customization options at the cost of increased complexity. Streamlit is better suited for rapid prototyping and simple data apps, whereas Bokeh excels in creating sophisticated, interactive visualizations for web applications.
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
Pros of Playwright
- Cross-browser automation support (Chrome, Firefox, Safari, Edge)
- Powerful API for end-to-end testing and web scraping
- Auto-wait functionality for improved test reliability
Cons of Playwright
- Steeper learning curve for beginners
- Primarily focused on testing, not building user interfaces
- Requires more setup and configuration compared to Streamlit
Code Comparison
Playwright (JavaScript):
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
await browser.close();
})();
Streamlit (Python):
import streamlit as st
st.title("Hello, Streamlit!")
user_input = st.text_input("Enter your name")
st.write(f"Welcome, {user_input}!")
Playwright focuses on browser automation and testing, while Streamlit is designed for creating data applications with minimal code. Playwright offers more flexibility for web interactions, but Streamlit excels in rapidly building interactive dashboards and visualizations.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Welcome to Streamlit ð
A faster way to build and share data apps.
What is Streamlit?
Streamlit lets you transform Python scripts into interactive web apps in minutes, instead of weeks. Build dashboards, generate reports, or create chat apps. Once youâve created an app, you can use our Community Cloud platform to deploy, manage, and share your app.
Why choose Streamlit?
- Simple and Pythonic: Write beautiful, easy-to-read code.
- Fast, interactive prototyping: Let others interact with your data and provide feedback quickly.
- Live editing: See your app update instantly as you edit your script.
- Open-source and free: Join a vibrant community and contribute to Streamlit's future.
Installation
Open a terminal and run:
$ pip install streamlit
$ streamlit hello
If this opens our sweet Streamlit Hello app in your browser, you're all set! If not, head over to our docs for specific installs.
The app features a bunch of examples of what you can do with Streamlit. Jump to the quickstart section to understand how that all works.
Quickstart
A little example
Create a new file streamlit_app.py
with the following code:
import streamlit as st
x = st.slider("Select a value")
st.write(x, "squared is", x * x)
Now run it to open the app!
$ streamlit run streamlit_app.py
Give me more!
Streamlit comes in with a ton of additional powerful elements to spice up your data apps and delight your viewers. Some examples:
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Input widgets | Dataframes | Charts | Layout | Multi-page apps | Fun |
Our vibrant creators community also extends Streamlit capabilities using  𧩠Streamlit Components.
Get inspired
There's so much you can build with Streamlit:
- ð¤Â  LLMs & chatbot apps
- ð§¬Â  Science & technology apps
- ð¬Â  NLP & language apps
- ð¦Â  Finance & business apps
- ðºÂ  Geography & society apps
- and more!
Check out our gallery! ð
Community Cloud
Deploy, manage and share your apps for free using our Community Cloud! Sign-up here.
Resources
- Explore our docs to learn how Streamlit works.
- Ask questions and get help in our community forum.
- Read our blog for tips from developers and creators.
- Extend Streamlit's capabilities by installing or creating your own Streamlit Components.
- Help others find and play with your app by using the Streamlit GitHub badge in your repository:
[](URL_TO_YOUR_APP)
Contribute
ð Thanks for your interest in helping improve Streamlit! ð
Before contributing, please read our guidelines here: https://github.com/streamlit/streamlit/wiki/Contributing
License
Streamlit is completely free and open-source and licensed under the Apache 2.0 license.
Top Related Projects
Data Apps & Dashboards for Python. No JavaScript Required.
Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
Panel: The powerful data exploration & web app framework for Python
Voilà turns Jupyter notebooks into standalone web applications
Interactive Data Visualization in the browser, from Python
Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot