Skip to content

asehmi/introduction-to-streamlit-and-streamlit-components

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 

Repository files navigation

Auth0 Guest Authors Logo

This article is published in full on the Auth0 developer blog

Introduction to Streamlit and Streamlit Components

TL;DR: Streamlit is an open-source app framework for Machine Learning and Data Science teams. You can create beautiful data apps in hours. All in pure Python. Streamlit was released in October 2019 and was recently acquired by Snowflake. There's huge excitement about it in the Data Science community. It's not just for Data Science though. With its component extensibility architecture, you can build and integrate most kinds of web frontends into Streamlit apps. This article will show you how to build Streamlit apps and custom Streamlit Components, with the end goal of implementing Auth0 authentication of Streamlit apps using Streamlit Components. My experience with Streamlit can be verified on the official page of Streamlit Creators.

Don't take my word for it that Streamlit is extremely popular and worth taking a serious look at. Here's a chart I found showing the extremely rapid adoption rate of Streamlit compared to other similar tools.

Streamlit Rapid Adoption Rate

Why is that so?

Streamlit focuses on simplicity

"How can we make a machine learning script and convert it into an app as simple as possible, so that it basically feels like a scripting exercise?", Inventor of Streamlit, Adrien Treuille (PhD)

Streamlit is a single Python package that you install through pip, that gives you a set of functions which:

  • Can be interleaved into an existing ML code script
  • Essentially making the ML code parameterizable
  • Does a little bit of layout, and
  • Magically turns your ML code into a beautiful app

Inspiration is drawn from Jupyter, ipywidgets, R-Shiny, Voila, React, etc., but more as a guiding light than a software architecture. There are significant technical differences in the implementation of Streamlit, which is based on a declarative data flow model, not wiring callbacks.

Python frameworks such as scikit-learn, spaCy, Pandas, and various visualization frameworks such as Altair, Plotly and Matplotlib all work seamlessly with Streamlit.

Streamlit supports many uses

  • Every single data analysis team needs to create apps. They're a focal point - like the bonfire of the team. It’s where team members get together and communicate.
  • Apps are a crucial part of the ML (data analysis) workflow, especially in a non-trivial project.
  • This applies not only to internal apps. Machine learning researchers and data scientists need to build apps for external consumption too. Other teams need to consume models in various different ways, and it ought to be much easier to build the required but different application layers to do that.

I'm a big fan of Streamlit and use it extensively for serious work and play. In a previous job I had developed several in-house apps that I needed to share externally with clients and colleagues, so adding security and authentication features was imperative. As you'll see in this article Streamlit's embedded components extensibility architecture and native session state management will help realize this security objective.

Here is the GitHub repository for this article.

Read the full article...

About

Introduction to Streamlit and Streamlit Components

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published