Cover

Using Streamlit To Build Web Applications

Introduction to Streamlit: a tool to create fast and friendly web applications.


Read Article

Using Streamlit To Build Web Applications

What is Streamlit?

Streamlit is an open-source and free Python library for making custom web applications. One can literally build and deploy an app in several minutes - as Streamlit creators say.

Figure below highlights minimum requirements for creating and running a Streamlit application.

Building a Streamlit application in 5 steps.


Slide from my talk on Streamlit at Measurecamp showing how to create a web application in 5 steps. You will need to have Python and Streamlit, for which installations depends on your system. Once set up, create and run simple python file as shown.

Why use Streamlit?

With Streamlit everyone who knows Python can create interactive, fast, visually pleasing and customised web applications. If you already have Python scripts that do data analysis, or create reports or do any kind of calculations or visualisations, following Streamlit documentation you can seamlessly add its components and turn your scripts into interactive web applications.

Example of Streamlit widgets.


Slide from my talk on Streamlit at Measurecamp showing several Streamlit widgets that are controlling data: slider, button, checkbox, radio button, select box and number input.

When to use Streamlit?

I would say: always :)

In reality - I recommend to clients Streamlit when I know that, for example, Looker Studio will not be good enough for their needs and when Looker Studio is slow. Don’t get me wrong, I like Looker Studio - but it is often limited in speed and complexity.

With Streamlit, you can create a tool that:

  • Is built specifically for you;
  • Is tailored to your business questions;
  • Offers in-depth performance analysis;
  • Supports interactive exploration;
  • It is easy and fast to use.
  • How to create and deploy web applications with Streamlit?

    Start from the beginning. Install Streamlit, set up your working space, and create a layout and plan of what you want to create.

    Once you have a working application - even if it’s just the application name and nothing else, you can use the free Streamlit Community Cloud to deploy your application. 5 steps to deploy a Streamlit application are shown on the Figure below.

    Whether you are making a private or public web application - you will need a GitHub account and you will need to keep your code there. Once your application is deployed, you can then share its URL with others (publicly or privately):

  • Public app - just share URL and people can access your app.
  • Private app - you will need to add emails to your Streamlit secrets and then only those people can see your app.
  • Steps to deploy Streamlit app on a Community Cloud.


    Slide from my talk on Streamlit at Measurecamp showing how to deploy Streamlit applications to their Community Cloud. You will need Community Cloud account and your code needs to be on GitHub.

    My personal and public Streamlit applications

    Over time, since getting to know about Streamlit in 2021, I’ve created quite a few applications - some are publicly available and some are private to clients.

    You can access my publicly available web applications here:

  • Distribution Analyser - Explore and fit continuous distribution.
  • Color Extractor - Explore and extract pre-made and custom colormaps for any use, and swatches files for Procreate drawing app.
  • HI-RINGS - Interactively explore a multiwavelength sample of Ring galaxies and their HI content.
  • Distribution Analyser

    Distribution Analyser is a web application that allows you to interactively explore continuous distributions, fit distribution(s) to your data and take home more than just a figure.

    I recommend this app to all people, whether they are new to distributions, or experts, whether they are students or teachers, because:

  • People can get familiar with a particular distribution very quickly and easily through the interaction with distribution parameters.
  • People can quickly see which distributions fit to their data, narrowing down the number of distributions they need to use for their analysis.
  • Components for tracking Sessions and Page Views - real and modelled data.


    Screenshot of one part of the Streamlit web application ‘Distribution Analyser’. UI is set to a left-hand side, while the right side display results.

    Tags:StreamlitPythonWebs Application

    ...

    Robert Dzudzar

    Thanks for reading and I hope you have a wonderful day!