How to get started with Streamlit?

Prakash R
featurepreneur
Published in
2 min readAug 25, 2021

Streamlit is a Python library that helps us develop UIs for our models without HTML/CSS/JS. Most models die inside a Jupyter notebook and are not appealing. But, using Streamlit, you can create a clean UI for your model and showcase it to others. Building a UI lets users use your model in a more user-friendly format.

Why Streamlit is useful?

  • You don’t need to deal with HTML/CSS/JSS.
  • It supports markdown.
  • It has many prebuilt widgets available, further reducing the time you spend on building the UI.
  • Builds a responsive UI.
  • Easy to deploy Streamlit apps using Streamlit sharing.
  • It’s open-source, and you can create your widgets if needed.’

Installing Streamlit:

pip install streamlit

Importing necessary libraries:

import streamlit as st
import pandas as pd
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt

To Load a data frame:

streamlit_df = pd.read_csv("streamlit.csv")
print(streamlit_df.head()

To run a Streamlit:

streamlit run app.py

This is all about getting started with Streamlit.

--

--