📘 Introduction

Data scientists and analysts often struggle to share their work interactively. Whether it's model results or beautiful visualizations, the gap between code and a usable interface can be frustrating. That's where Streamlit comes in.

Streamlit is a powerful Python framework that turns your data scripts into shareable web apps with minimal effort. No front-end skills? No problem. In this tutorial, you'll learn how to install Streamlit, write your first app, and run it locally.

✅ Prerequisites

Before we start, make sure you have the following ready:

☑️ Python installed (3.8 or later)

💡
You don’t need any HTML, CSS, or JavaScript — Streamlit handles the UI for you. 🎨

✍️1️⃣ Install Streamlit

Let’s begin by installing Streamlit. Open your terminal and run:

pip install streamlit

To test if everything’s working, run:

streamlit hello

This opens a demo app in your browser and confirms Streamlit is installed correctly. ✅

💻2️⃣ Write Your First Streamlit Code

In your working directory, create a new file named app.py. This file will contain the code for your Streamlit app. Open it in your editor and paste the following code:

import streamlit as st
import pandas as pd
import numpy as np

st.title("My First Streamlit App 🎉")

st.write("Welcome to your first interactive data app!")

# Add a slider
points = st.slider("Select number of points", 10, 100)

# Generate random data
data = pd.DataFrame({
    'x': np.arange(points),
    'y': np.random.randn(points).cumsum()
})

# Show a line chart
st.line_chart(data.set_index('x'))

You can view this post with the tier: Academy Membership

Join academy now to read the post and get access to the full library of premium posts for academy members only.

Join Academy Already have an account? Sign In