Exploring Streamlit or Dash to build specific Interactive Web Applications
As a PO, I am not wondering anymore if the Python/AI/ML revolution is a new fad or a real trend? That’s both of it! Like anyone who start something new like I do now with Python and IA, I am currently in the “enthusiastic phase” that tend to transmogrify me as an overzealous supporter like cucumbers are ultimately transmogrified into pickles!
You can find the code on my github account:
- Exploring Streamlit: build_interactive_webapps_python_scripts_using_streamlit
- Exploring Dash: build_interactive_webapps_python_scripts_using_dash
You can also watch the videos:
- Part 1 – Exploring Streamlit or Dash to build specific Interactive Web Applications
- Part 2 – Exploring Streamlit or Dash to build specific Interactive Web Applications
Anyway, this learning process is not without consequences, it definitely calls into question my PO’s practices, habits and skills. Am I a conservative with a fixed mindset ? Or do I accept changes as necessary and essential even though it may say leaving my comfort zone to a more exploratory area! It is almost a cliché dilemma!
I know that all technologies are doomed to disappear or to be replaced. Regarding Python’s potential, the question has
become more and more acute “Will I be, from 1 or 2 years from now, an has-been P.O, knowing only deprecated technology if I do not tackle right now the Python/AI/ML revolution?”. I guess I will answer YES.
By experience, I know also that it is not a direct threat but a progressive one. I heard that meanwhile Python is
steadily progressing, PHP for instance remains popular mostly
due to the 2 killer apps named WordPress and Drupal, legacy! Even though, there are some smoke screen effects due to local exceptions e.g. French development labour market dominated
by Symfony for instance or the worldwide Laravel spectacular breakthrough.
I do not know if It can be considered as a forerunner sign for the actual or future Python hegemony but just google for instance the result number on
Manichean comparisons such as “PHP vs Python”, you’ll be surprised!
Lastly, here is 2 videos, that are addressing this concern on this future trend. The first video is in brazilian, a quite personal testimony but it remains interesting both for practising brazilian and hearing few arguments. The second video gives a very macro vision and quite technical but with a huge historical depth and that’s quite interesting even though a bit technical.
- PHP vale a pena? (minha opinião sincera) https://www.youtube.com/watch?v=H43fXodv6WY
- Why Isn’t Functional Programming the Norm? – Richard Feldman https://www.youtube.com/watch?v=QyJZzq0v7Z4
After, the few thoughts, let’s get down to earth!
Professionally, I am a bit utilitarian. Learning something new like Python and IA has to “payback” somehow. I always try to figure out what can I gain from this experience and how can I apply this knowledge on a daily basis before starting up. Sometimes it even turns ridiculous! I must also confess that I didn’t go that far as the guy behind keypressingmonkey*.
See Everything I Automated In 2020 To Save Me Hours Of Time by https://keypressingmonkey.medium.com/. There is also this very truthful testimony about learning coding in I Learned Coding Mostly From Porn
In the meantime, I always deal with these 2 safeguards: obsolescence and time-to-market.These 2 concepts can be sumarized with 1 question: “Is there a purpose to learn something that will be soon deprecated?”. Despite all this questioning, I preserve to learn Python/AI/ML. As a conclusion, what I am looking for in term of feature may require to drop PHP as the only main programming language and turn my known developing paradigm upside down.
So, that is the reason why I have explored especially the ability with Python to build-up quickly applications, leveraging on these 2 python libraries :
- Streamlit https://streamlit.io/
- Plotly Dash
This post is my feedback on this experience. Enough conceptual bullshit! Let’s get straight to the point with examples.
My idea is to build a Dashboard in Python, quickly and on-demand, with an existing framework such as Plotly Dash or Streamlit to address a specific need. So, it suppose that you are able to quickly perform the following tasks:
- Leveraging intensively on a low-code with library like Streamlit or Plotly Dash
- Quickly and gently retrieving and consolidating heterogeneous data from different sources : mysql dump, csv, pickle, static json file, WP API…
- Focusing on a very SPA (Single Page Application) approach, respecting the single idea rule: one need, one feature, one screen, one application.
In this exploratory phase, shoddy work is even acceptable so you can focus on feature and value and not on development! But by choosing such a library, it is also picking a great foundation on which you can build any of your application with a relative good manufacturing quality.
Let’s browse some examples.
It is truly the ultimate Plug and Play tool for forging an application in data science. Once the installation is done! Creating an app is almost immediate and you obtain a rather conclusive result especially liked with few other libraries (Pandas, Spacy).
You can check the files from my github account.
In comment, in each file, how to launch the python script and the source.
#!/usr/bin/python # -*- coding: utf-8 -*- """ [path] cd /Users/brunoflaven/Documents/01_work/blog_articles/build_interactive_webapps_python_scripts_using_streamlit/02_interactive_webapps_streamlit/ [file] streamlit run 001_interactive_webapps_streamlit_pandas.py # more on infos and apps on https://streamlit.io/ https://streamlit.io/gallery https://docs.streamlit.io/en/stable/ """ # Source :: ! ARTICLE_1 How to write Web apps using simple Python for Data Scientists? Check https://mlwhiz.com/blog/2019/12/07/streamlit/
1.1 Streamlit and Pandas
It requires csv files that are in
/datas/. We have gather few csv that gather on one file countries, capital and continent from different sources.
001_interactive_webapps_streamlit_pandas.py 002_interactive_webapps_streamlit_pandas.py 003_interactive_webapps_streamlit_pandas.py 003a_interactive_webapps_streamlit_pandas.py 003b_interactive_webapps_streamlit_pandas.py 003c_interactive_webapps_streamlit_pandas.py 004d_interactive_webapps_streamlit_pandas.py 006_interactive_webapps_streamlit_pandas.py 007_interactive_webapps_streamlit_pandas.py data
Source for the countries and some other infos about countries:
1.2 Streamlit and Spacy
002_streamlit_for_nlp_projects_streamlit_spacy.py 003_streamlit_for_nlp_projects_text_summarization.py bf_sample_text_1.txt capture_1_003_streamlit_for_nlp_projects_text_summarization.png capture_2_003_streamlit_for_nlp_projects_text_summarization.png capture_streamlit_for_nlp_projects_streamlit_spacy.png cowboy_silhouette_2.png
To me, Dash is closer to Flask. So, it is closer to a small, lightweight Python web framework to create a website. Still, I have gathered few examples that enable a comparison with Streamlit. There are very convincing examples if you need to prototype quickly a web application.
Definitely, Dash enables you to make great things but the learning curb is much steep and it sounds more like learning a way to create real websites with all the issues, especially nice UX for your IHM.
Nevertheless, I selected 2 impressive projects that show Dash extraordinary potential. It is sure that it can be a strong alternative to a PHP framework like Symfony or Laravel to create an in-house CMS like the one I am dealing with for instance as it integrates like a charm Data Science features.
Files examples from my github account
001_plotly_interactive_webapps_dash.py 002_plotly_interactive_webapps_dash.py 003_interactive_webapps_dash.py 003_plotly_interactive_webapps_dash.py 004_interactive_webapps_dash.py 005_interactive_webapps_dash.py 006_interactive_webapps_dash.py 007_interactive_webapps_dash.py 008_interactive_webapps_dash.py 009_interactive_webapps_dash.py
The 2 great projects that leverage on Dash:
- Project #1: NLP visualizations for clear, immediate insights into text data and outputs
- Project #2: NLP visualizations for clear, immediate insights into text data and outputs
Regarding what I was looking for, I’d rather go with Streamlit. That is great tool to extend life to some of my python scripts transforming them into an application that is sharable with anyone including customers. The existence of a Framework like Streamlit greatly facilitates the design and creation of a web application. It makes a serious alternative to all frameworks and already appeals to more than one team or PO. Obviously, this is not just a fad as it might have been in its days RoR for instance.
- Streamlit – The fastest way to build and share data apps
- Streamlit – Gallery
- Streamlit – Documentation
- Streamlitopedia :: Collection of tools, code snippets when making streamlit apps.
- (Simple and Efficient) Building Web Applications with Streamlit for NLP Projects
- nomodulenamed. – I’ve installed the package using pip, but I got “ImportError: No Module Named [x]”
- jonathanreadshaw – streamlit-twitter-stream
- BERT For Measuring Text Similarity
- Summaryman; Text Summarization using Gensim and FastAPI
- Building A Natural Language Processing App with Streamlit,SpaCy and Python
- Build A Text Summarization App Using Streamlit in 30 Minutes
- Text Summarization using a Wordcloud & Deployed on Streamlit
- Generating Fake Dating Profiles for Data Science
- Using NLP Machine Learning on Dating Profiles
- How to Use Machine Learning and AI to Make a Dating App
- Github from mdipietro09
- Text Analysis & Feature Engineering with NLP
- Building a Live Tweet Dashboard using Tweepy, MySQL and Streamlit
- Using Streamlit and Firestore to create a serverless web app with persistent data, written entirely in Python!
- Building Multi Page Web App Using Streamlit
- Build a Simple CRUD Blog with Streamlit and Python
- Streamlit Python Tutorial(Crash Course)
- Streamlit Themes – How to Customize Your Streamlit Apps
- A Beginners Guide To Streamlit
- imadelh – Bigquery-Streamlit
- changing anything in CSV – csvkit is a suite of command-line tools for converting to and working with CSV, the king of tabular file formats.
- Tutorials for Python and SEO by importsem
- Auto-SEO forecasting with StreamProphet! 🚀
- Using Streamlit to create interactive WebApps from simple Python scripts
- Data Science Apps Using Streamlit
- How to Use Streamlit to Make a Website
- How to Make a Website with Python and AWS
- Python_For_SEO (seo python)
- Google Keyword Ranking Check with Python
- Data Science Apps Using Streamlit Ressources
- Deploy Code With Streamlit
- How to write Web apps using simple Python for Data Scientists?
- Using Streamlit to create interactive WebApps from simple Python scripts
- A Guide to Streamlit — Frontend for Data Science Made Simpler
- 6 Jobs You Can Land If You Learn Python
- Create a data explorer app
- A HANDS-ON INTRODUCTION TO STREAMLIT COMPONENTS
- Streamlit with Image Processing Techniques and Object Detection Algorithms
- Automatically Find SEO Interlinking Opportunities with Python
- Interactive Web App with Streamlit and Scikit-learn
- Step by step – first streamlit web app using python with conda distribution
- A Beginners Guide To Streamlit – Convert Python Code Into An App
- Building a Bioinformatics Web App in Python | Streamlit #7
- Create a Streamlit Component
- How to build a Streamlit component – Part 1: Setup and Architecture
- NLP visualizations for clear, immediate insights into text data and outputs
- plotly – dash-sample-apps
- Search “streamlit nlp” on duckduckgo.com
- Performance on dash.plotly.com
- dashdub – Convert speech to text with Dash & Python
- Dash AV Video Detection
- Dash Enterprise – The premier low-code platform for ML & data science apps.
- Plotly Dash Development Tips by Mátyás Budavári
- Excellent article – Dash for Beginners – Derrick Mwiti
- Excellent – greatest documentation ever – Cheat Sheets
- How To Build A Dashboard In Python – Step-by-Step Tutorial
- Gary Snyder
Articles Serie from Marco Santos