Introduction to Streamlit

Introdution Streamlit Feature

Streamlit is an open-source app framework for ML & Data Science visualization. It allows the user to create and share beautiful data apps in a matter of hours if not weeks. In the data science life cycle, it comes into the picture where model deployment and exploratory data analysis are required. As a general rule, it can be used in any part of the cycle wherever UI is required.

Data Visualisation Streamlit 1

Apart from providing the fastest way to build data apps it also has a fast-rising community improving the product day by day. Backed by some of the big investors like Sequoia capital, it is rapidly increasing its user base and is one of the key skills a data scientist or analyst must have to deliver impactful data apps.

Streamlit is an open-source tool with 15.7K GitHub stars and 1.4K GitHub forks. It works seamlessly with TensorFlow, Keras, PyTorch, Pandas, Numpy, Matplotlib, Seaborn, Altair, Plotly, Bokeh, Vega-Lite, and more.

Installing Streamlit

Installing streamlit is simple. The only prerequisite is that it requires Python 3.6+ installed. Check your python version:

python --version

If it’s below 3.6 install one that is above. You can set the newly installed one as the default python version (if a downgraded version already exists) in Mac / Linux as:-

sudo ln -s -f /usr/local/bin/python3.9 /usr/local/bin/python

Install streamlit using pip

pip install streamlit

Alternately, if you are working in a virtual environment like conda, pyenv, etc. You can download using:- 

<virtual_environment> install streamlit

Check your installation

After installing streamlit we check whether installed library is running alright or not.

In the terminal type

streamlit hello
Image 271

The instance is launched on the default browser. Alternatively, you can type the local or network URL to navigate to the page. You would be able to run some demos in the browser and it also contains links to documentation, forums, and the website

Image 272

Next, we will see how we can display text, data frames, and tables by running a basic script.