Building UI using Streamlit

Learn how to build a classifier UI using Streamlit.

Add UI components

Firstly, we’ll add a title and description for the interface.

import streamlit as st
# Title
st.title("Classifiers in Action")
# Description
st.text("Choose a Dataset and a Classifier in the sidebar. Input your values and get a prediction.")

Add the sidebar

Let’s add a sidebar to display the sliders on the Streamlit web interface.

#sidebar
sideBar = st.sidebar
dataset = sideBar.selectbox('Which Dataset do you want to use?',('Wine' , 'Breast Cancer' , 'Iris'))
classifier = sideBar.selectbox('Which Classifier do you want to use?',('SVM' , 'KNN' , 'Random Forest'))

We use Streamlit’s selectbox component to create a drop-down menu for the user to select the dataset and the model.

Let’s run the code below.

Get hands-on with 1200+ tech skills courses.