Streamlit – Introduction and Setup
Streamlit is an open source app framework in python language. It helps us create beautiful web-apps for data science and machine learning in a little time. It is compatible with major python libraries such as scikit-learn, keras, pytorch, latex, numpy, pandas, matplotlib, etc.. Syntax for installing this library is shown below.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Install StreamLit –
In the command-prompt type
pip install streamlit
Creating a Simple application (Hello World) –
The 'hello, world!' script in Streamlit: streamlit hello # to run your python script streamlit run myFirstStreamlitApp.py
You can stop running your app any time using Ctrl + C.
Advantages:
1. It embraces python-scripting.
2. Less code is needed to create amazing web-apps.
3. No callbacks are needed since widgets are treated as variables.
4. Data caching simplifies and speeds up computation pipelines.
Disadvantages:
1. Streamlit’s Data caching cannot keep track of changes to the data happening outside the function body.
Some of its basic functions are described here.
1. Adding a Title
# myFirstStreamlitApp.py #import the libraryimport streamlit as stl # add title to your appstl.title("Geeks for Geeks") |
Output:

2. Adding some text
# myFirstStreamlitApp.py #import the libraryimport streamlit as stl # add title to your appstl.title("Geeks for Geeks") #adding text to your appstl.write("A Computer Science portal for Geeks") |
Output:

Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.


