Streamlit Tutorial
If you want to convert your Python scripts into interactive web applications without the need for HTML, CSS, or JavaScript, Streamlit is the perfect solution. This open-source Python library makes web app development simple and efficient, making it a top choice among data scientists and machine learning engineers.
What you will learn from Streamlit:
- What Streamlit is and its useful
- How to install and set up Streamlit
- Building your first Streamlit app
- Key features and components of Streamlit
What is Streamlit?
Streamlit is a Python-based framework that allows developers to create interactive web applications with minimal effort. It’s particularly useful for data-driven applications, enabling seamless integration with popular libraries like Pandas, NumPy, and Matplotlib. With Streamlit, you can quickly build and share data apps without needing extensive web development experience.
Why Choose Streamlit
Easy to Use - Convert Python scripts into web apps with minimal effort.
No Front-End Skills Required - No need to learn HTML, CSS, or JavaScript.
Rapid Development - Build and deploy interactive apps in minutes.
Seamless Integration - Works with major Python libraries for real-time data visualization.
Open-Source & Free - Backed by a vibrant developer community.
Cross-Platform - Works on Windows, macOS, and Linux.
Scalability - Easily deploy apps on cloud services for broader reach.
Use Cases of Streamlit
- Data Visualization: Create real-time interactive dashboards.
- Machine Learning: Deploy models with interactive UI.
- Business Analytics: Build reporting dashboards with data insights.
- Prototyping: Rapidly develop and test ideas without web development expertise.
- Education: Create interactive learning tools and simulations.
- Automated Reporting: Generate auto-updating reports with a user-friendly interface.
Key Features of Streamlit:
Fast & Simple: No need for additional web technologies, just Python.
Interactive Widgets: Use sliders, buttons, text inputs, and more for user interaction.
Live Code Updates: The UI auto-refreshes when the script changes.
Performance Optimization: Speed up apps with built-in caching
@st.cache_data
.Data Visualization Support: Supports Matplotlib, Plotly, Seaborn, Altair, and more.
Easy Deployment: Deploy instantly via Streamlit Cloud, AWS, GCP, or Azure.
API Integration: Easily integrate with RESTful APIs, databases, and cloud storage.
Customization: Use themes and CSS modifications to enhance the UI.
How to Install Streamlit
To start building apps with Streamlit, install it via pip:
pip install streamlit
Create Your First Streamlit App in 2 Minutes
Let’s build a simple interactive app. Open a new Python script (app.py
) and add:
import streamlit as st
st.title("Streamlit Application")
st.header("Welcome to real time app")
st.subheader("Welcome to subheader")
st.write("this is testing **Streamlit** capabilits")
st.markdown("### check this markdown")
Run it with:
streamlit run app.py
Your browser will open the Streamlit app instantly. That’s it!

Essential Streamlit Components
Text & Formatting
st.title("My Streamlit App")
st.header("Header Example")
st.subheader("Subheader Example")
st.text("This is a simple text.")
st.markdown("**Bold Text** and _Italic Text_")
User Input Widgets
name_input = st.text_input("Enter your name", "type here ....")
if st.button("Submit"):
st.write("hello welcome",name_input.title())
Displaying Data
import pandas as pd
import numpy as np
sample_df = pd.DataFrame({
"random Integers": np.random.randint(0,100,10),
"random Floats": np.random.rand(10)
})
st.write("this is sample dataframe")
st.dataframe(sample_df)
Visualizing Data
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.plot(x, y)
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
st.pyplot(plt)
Frequently Asked Questions(FAQS)
1. Is Streamlit free to use?
Yes, Streamlit is open-source and completely free!
2. Can I use Streamlit for machine learning apps?
Absolutely! Streamlit supports ML libraries like TensorFlow, PyTorch, and Scikit-learn for building interactive ML models.
3. How do I deploy a Streamlit app? Can I use Streamlit for machine learning apps?
You can deploy your Streamlit app using:
- Streamlit Community Cloud (Free for personal projects)
- Cloud Providers (AWS, GCP, Azure)
- Docker Containers (For scalable deployment)
4. Can I use Streamlit with a Database?
Yes, Streamlit supports MySQL, PostgreSQL, Firebase, MongoDB, and other databases via Python connectors.
5. Is Streamlit good for large-scale applications?
While Streamlit is excellent for prototyping and small-to-medium applications, for large-scale production systems, additional optimizations or frameworks might be necessary.
Conclusion:
Streamlit offers a user-friendly and powerful way to build interactive web applications for data science and machine learning. Its ease of use, seamless Python integration, and real-time interactivity make it an excellent tool for developers, analysts, and data scientists alike. Whether you’re creating data visualizations, machine learning models, or business applications, Streamlit enables you to bring your ideas to life quickly and effectively.
Start building with Streamlit today and experience the power of interactive data apps!
For more hands on tutorials on streamlit follow the below link:
Should you encounter any issues, our team is readily available to provide guidance and support with a prompt response. Please do not hesitate to reach out to us at any time contact@accentfuture.com