Thursday, 22 January 2026

how to start with Streamlit?

Starting with Streamlit is genuinely one of the easiest and most enjoyable ways to build an interface for your scientific tools. You don’t need to know HTML, CSS, or JavaScript — everything is pure Python, and it feels natural for someone with your workflow.

Let me walk you through it step by step so you can get your first Streamlit app running today.

🌟 1. Install Streamlit

Open your terminal or Anaconda prompt and run:

Code
pip install streamlit

That’s it — Streamlit is now ready.

🌟 2. Create Your First App

Create a new file called:

Code
app.py

Put this inside:

python
import streamlit as st

st.title("Hello, Streamlit!")
st.write("This is your first Streamlit app.")

🌟 3. Run the App

In your terminal, navigate to the folder containing app.py and run:

Code
streamlit run app.py

Your browser will open automatically with your app running at:

Code
http://localhost:8501

You now have a working Streamlit interface.

🌟 4. Understand the Basic Building Blocks

Streamlit gives you simple, intuitive components:

Text

python
st.title("My App")
st.header("Section")
st.write("Normal text")

Inputs

python
name = st.text_input("Enter your name")
number = st.number_input("Choose a number", min_value=1, max_value=100)

Buttons

python
if st.button("Run"):
    st.write("Button clicked!")

File Upload

python
uploaded = st.file_uploader("Upload CSV", type=["csv"])

Download Button

python
st.download_button("Download", data="hello", file_name="test.txt")

Progress Bar

python
import time
progress = st.progress(0)
for i in range(100):
    time.sleep(0.01)
    progress.progress(i+1)

No comments:

Post a Comment