Create data visualizations declaratively for ML and Data Science on a Mac, powered by Python
Overview
Streamlit (open sourced at https://github.com/streamlit/streamlit) is by Dominik Moritz, who is a visualization god (UW PhD, CMU) at Apple, Microsoft, etc. and developed a grammar of visualizations (Draco).
NOTE: Content here are my personal opinions, and not intended to represent any employer (past or present). “PROTIP:” here highlight information I haven’t seen elsewhere on the internet because it is hard-won, little-know but significant facts based on my personal research and experience.
Streamlit’s marketing page at streamlit.io describes itself as “the first app framework specifically for Machine Learning and Data Science teams.”
Streamlit’s documentation is at https://streamlit.io/docs/
Install locally
In a Terminal:
-
Run Streamlit visualizations of your own within Docker locally. Start with a “hello world” by running my streamlit-docker.sh Shell file at this repo:
https://github.com/wilsonmar/DevSecOps/tree/master/Streamlit1
The script builds and runs the Dockerfile to display “hello-world” as described in this blog and its repo. It stops the container if it’s already running.
The script installs what it needs (Streamlit, Docker, etc.).
The use of Docker isolates dependencies, just as virtualenv does.
Alternately, install Streamlit globally (at the risk of conflicts with dependencies shared by other apps):
pip install --upgrade streamlit streamlit version</pip> The output should end with something like this:
Streamlit, version 0.52.2
### Run it live -
Use your Mac’s Folder app or Terminal commands to create a containing folder and cd to it.
-
In Termianl, see a visualization of Uber driver pickup points at each hour of the day pop-up on your default browser with one command:
streamlit run https://raw.githubusercontent.com/streamlit/demo-uber-nyc-pickups/master/app.py
Drag your mouse to pan across. Notice the viz at 7am shows red spikes at airports and Upper West Side.
See https://github.com/streamlit/demo-uber-nyc-pickups
-
Add the OpenCV image recognition library:
pip install --upgrade opencv-python</pip>
-
See how self-driving cars recognize street signs and other objects (after several minutes loading):
streamlit run https://raw.githubusercontent.com/streamlit/demo-self-driving/master/app.py
The app uses YOLO (You Only Look Once) real-time object detection which recognizes dozens of objects at a time in videos. The app downloads files yolov3.cfg and yolov3.weights.
Build your own app
-
VIDEO: Specifications in Streamlit’s declarative language Oct 19, 2019
-
View YouTube tutorials by Adrien Treuille, CEO of Streamlit and Jesse E.Agbe at JCharisTech & J-Secur1ty (GitHub)
-
Join the discussion community at
## More about Streamlit
-
https://towardsdatascience.com/streamlit-101-an-in-depth-introduction-fc8aad9492f2
-
https://medium.com/@ansjin/how-to-create-and-deploy-data-exploration-web-app-easily-using-python-a03c4b8a1f3e
-
View JMeter results, by NaveenKumar Namachivayam: https://qainsights.com/apache-jmeter-with-streamlit-for-machine-learning/
Press mentions
- TechCrunch: Streamlit launches open-source machine learning application development framework October 1, 2019
More about Python
This is one of a series about Python:
- Python install on MacOS
- Python install on MacOS using Pyenv
- Python tutorials
- Python Examples
- Python coding notes
- Pulumi controls cloud using Python, etc.
- Test Python using Pytest BDD Selenium framework
- Test Python using Robot testing framework
- Python REST API programming using the Flask library
- Python coding for AWS Lambda Serverless programming
- Streamlit visualization framework powered by Python
- Web scraping using Scrapy, powered by Python
- Neo4j graph databases accessed from Python