On-Demand Tutorial
Building Interactive Dashboards
with ChatGPT and Streamlit
In this final installment of our series on data analysis with ChatGPT, we’ll turn our Python analysis into a fully interactive web-based data dashboard using Streamlit. Streamlit is an open-source Python framework that makes it easy to build web-based data apps — no front-end experience required. Combined with the Plotly visualization library, we can quickly create dynamic, filterable visualizations that anyone can explore online. To access the files created in this tutorial, click here.
1. From Analysis to App
If you’ve followed the earlier parts of this series, you already have a Python file that performs data analysis on customer, order, and returns data. We’ll use that code as the foundation for our Streamlit dashboard.
Start by prompting ChatGPT with something like:
“I’d like to turn my customer and sales data analysis code into a Streamlit data application. Can you provide the Streamlit code and deployment steps?”
Upload your existing analysis script and data files. ChatGPT will generate a Streamlit app script that:
– Imports Streamlit and pandas
– Loads and analyzes your data
– Displays charts, summaries, and filters in a web-based interface
It will also include a requirements.txt file listing dependencies — typically streamlit, pandas, and any visualization libraries used.
2. Setting Up for Deployment
To publish your app, you’ll need accounts with both GitHub and Streamlit Community Cloud.
- On GitHub:
– Create a new repository (e.g., sales-data-dashboard).
– Upload your Streamlit script, data files, and requirements.txt file.
– Commit your changes. - On Streamlit Community Cloud:
– Sign in at streamlit.io.
– Connect your GitHub account.
– Point Streamlit to your repository and main app file (e.g., sales_dashboard.py).
– Click Deploy.
Your dashboard will be live and viewable in your browser — complete with interactive filters for region, category, and date range.
3. Enhancing the Dashboard
Once deployed, you can easily add new features through ChatGPT. For example:
“In this Streamlit app, can you show a five-row sample of the data, add a summary table like we had in our EDA, and let users choose visualization types?”
ChatGPT can update your Streamlit code to include:
– Data previews and summaries (columns, data types, missing values, unique counts)
– Dynamic chart selection — users can pick from scatter plots, bar plots, or line charts
– Data export options — allowing users to download filtered data as a CSV file
Simply replace your app file in GitHub with the new version, commit the changes, and Streamlit will automatically refresh your deployed app.
4. Adding Interactivity with Plotly
To make your visualizations interactive, ChatGPT can modify your Streamlit script to use Plotly, a modern Python visualization library built for interactivity.
You’ll just need to:
- Add Plotly to your requirements.txt file.
- Import it into your app:
import plotly.express as px - Replace static visualizations with interactive Plotly charts.
With this update, users can hover, filter, and zoom directly within the dashboard — no reloading required.
5. Sharing Your Dashboard
When your app looks the way you want, you can share it instantly:
– Click Share in the top-right corner of the Streamlit app.
– Choose whether to make it public or invite specific collaborators.
– Copy the link and send it to your team or audience.
Your dashboard is now a live, interactive window into your data — accessible from any browser.
By Brandon Krakowsky, Director, Data Science and Research, Wharton AI & Analytics Initiative
Pro Tips for Streamlit Success
Keep your dashboard simple and responsive with these quick tips:
- Keep dependencies minimal — Streamlit loads faster when you limit libraries.
- Add default filters — Users appreciate a clean, pre-filtered view.
- Use Plotly for performance — It’s faster and more interactive than Matplotlib or Seaborn for dashboard visuals.
- Let ChatGPT write your helper code — Prompts like “Add a download CSV button” or “Add date filters in the sidebar” save tons of time.
