Useful tools for Machine Learning Engineers : How to get started with Streamlit ?

Useful tools for Machine Learning Engineers : How to get started with Streamlit ?

As a beginner in the field of data science, you will probably wonder if there is a way to build applications interfaces that can display the analysis made on a dataset. Fortunately, there are many ways to build data-driven web applications using some powerful tools. This article is about one of them: Streamlit. It will cover aspects such as the different features, advantages and the installation of Streamlit.

A new tool to build web applications: What is Streamlit?

Streamlit is a software company that owns an open-source platform used by Data Scientists and Machine Learning Engineers teams to build python based web applications. Progressively, the platform takes the company's name and is commonly known now as Streamlit. So, Streamlit has been built by Adrien Treuille , Amanda Kelly and Thiago Teixeira in 2018.

To learn more about the history of Streamlit, watch these series of videos from their founder. From data analysis to web applications, Streamlit has made it easy. It's an awesome tool that is used by both Machine Learning Engineers and Data Scientists to build highly interactive web applications.

What are the basic features of Streamlit?

Streamlit has many amazing features that make the tool itself very easy to learn and use. The platform relies on Python Scripting, APIs, a diversity of widgets, instant deployment, application management solutions and collaborative tools to offer the engineers the great opportunity to build Python-based applications. Furthermore, Streamlit is compatible with a lot of Python frameworks and libraries like Pandas, the well-known library for exploratory data analysis, NumPy, Matplotlib, Seaborn, OpenCV, Pytorch, TensorFlow, Keras and many more.

What are the advantages offered by Streamlit?

Streamlit is known as one of the fastest ways to build web applications around Machine Learning and Data Science.

This is a summary of what Treuille thinks about Streamlit according to this article.

Streamlit is a flexible solution that serves multiple requirements, depending on the type of data with which the engineer is working. By so doing, Streamlit is more than a one-size-fits-all tool that helps Machine Learning Engineers quickly build web applications with their usual programming tools. With Streamlit, they can build interactive web applications that make sense based on the type of data on which the work is done.

A simple way to implement it is to create a set of sliders that interact with data. According to Treuille, Streamlit is a toolset that "has the potential to dramatically transform the way Machine Learning Engineers work with the data in their models."

  • It is an open-source platform
  • Streamlit helps developers (Machine Learning Engineers) to save time
  • This tool turns data scripts into shareable web applications
  • No need to have a strong frontend experience
  • Widgets are easily accessible
  • Easy deployment on platforms like Heroku

How to set up / install Streamlit?

To install Streamlit, make sure you have Python or Anaconda distribution installed. Then, open a command line interface and type the following command:

pip install -U streamlit

Once the installation is successful, open the code editor that makes you comfortable (Visual Studio Code, Pycharm or whatever) and create a python script named "HelloWorld.py". Inside the file, type the following lines of code :

# This is a basic web application built with streamlit

import streamlit as st

# Displaying your content
st.write(
    """
    # Hello World ! 
    Welcome to my first app.
    """
)

After that, save the file and run it in your terminal with the command :

streamlit run HelloWorld.py

You will probably be redirected on your web browser with an interface like this :

image.png

Congratulations ! You've created your first Streamlit application.

References