DEV Community

Cover image for Streamlit Intro, features and components
Raman Bansal
Raman Bansal

Posted on

Streamlit Intro, features and components

Introduction

In this article, i have discussed about streamlit, its features and its component. The article is designed for those who wants to learn to deploy their machine learning on internet.

What is Streamlit and How Does it Work?

Streamlit is an open-source development tool that simplifies the process of creating data science apps and web apps.It allows developers to quickly develop interactive, dynamic, and powerful applications without having to write a lot of code.

Streamlit provides a library of components that can be used to create data visualizations, dashboards, and other types of apps. Streamlit also has features such as automatic reloading of code changes and built-in support for Python libraries like NumPy, Pandas, Scikit-learn, and Matplotlib. With Streamlit's easy-to-use interface and powerful features, developers can create amazing applications with minimal effort.

How Streamlit Can Help You Create Amazing Data Science Apps in Minutes

Streamlit provides a wide range of features that help developers create amazing data science apps in minutes. It allows users to easily upload files, visualize data, and embed custom components such as charts and maps. Streamlit also supports popular Python libraries like NumPy, Pandas, Scikit-Learn and TensorFlow which makes it easier for developers to build powerful machine learning models into their applications. With Streamlit, you can quickly develop powerful web apps without having any prior experience in web app development.

Streamlit vs. Flask

We can compare streamlit and flask by creating hello world program using both of technologies

Hello world in Flask

Here is the basic hello world program in flask

from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
    return "Hello, world"
if __name__=="__main__":
    app.run(debug=True)
Enter fullscreen mode Exit fullscreen mode

For hello world program flask takes 7 lines of code and the code is very complex. Due to which beginners mostly prefer streamlit.

Hello world in streamlit

Here is the basic hello world program in streamlit

import streamlit as st
st.write("Hello, World!")
Enter fullscreen mode Exit fullscreen mode

It takes only two lines of code for streamlit. So, streamlit can be a better option for programmers.

Streamlit Components for web development

Streamlit comes with wide range of components. Here, I will show you the list of that components that you can use for making web apps.

1. Text Input and Output

Components for inputing and outputting text data.

2. Buttons

Components for creating clickable buttons that perform an action.

3. Sliders

Components for selecting numerical values by sliding a slider handle.

4. Select Boxes

Components for selecting an option from a list of options.

5. Checkboxes

Components for selecting one or more options from a list of options.

6. Radio Buttons

Components for selecting one option from a list of options.

7. Date Pickers

Components for selecting a date from a calendar.

8. File Upload

Components for uploading files to the application.

9. Plotting and Visualization

Components for creating interactive plots, charts, and graphs.

10. Layouts

Components for organizing the application layout, such as columns, rows, and tabs.

11. Session State

Components for storing data across user sessions.

12. Forms

Components for creating forms to input data.

Conclusion

Streamlit can be a best framework for you if you are beginner in web development but if you are already inthe field of web development you can switch to the framework that you want to learn.

Read the full article
CHECK IT OUT

Top comments (0)