Web-apps using Streamlit

Snekhasuresh
featurepreneur
Published in
2 min readOct 8, 2022

Streamlit is an open-source Python library that makes it easy to build beautiful custom web-apps for machine learning and data science.

Installation:

Prerequisites:

You need to install

  1. Python (Versions 3.7.x — 3.9.x)
  2. PIP

Install Streamlit by running a simple command:

pip install streamlit

And for verification run this command:

streamlit hello

A web page in your default browser will be opened if the installation is successful. The following output will be displayed:

Streamlit widgets:

There are many features in Streamlit out of which a few are given below:

Displaying text in Streamlit:

1. Title

The title of a document is defined using:

st.title("Document Title")

2. Header

A header in Streamlit takes the format: st.header(body, anchor=None) where body is the text to display.

st.header("Article header")

3. Markdown

To get a markdown just type in the following code

st.markdown('text **textinbold**')

4. Text

The text format in Streamlit can be obtained by:

st.text("text")

Other widgets can be generated using:

  • st.balloons for displaying celebratory balloons.
  • st.warning for warning messages.
  • st.info to display general information.
  • st.success for showing success messages.
  • st.exception for printing exception errors.
  • st.error to communicate errors.

Run Streamlit applications on the command prompt

Assuming you have created your application and saved it as a script in a file named yourfile.py, the application can be executed as shown below.

Using your command prompt:

streamlit run yourfile.py

Hope you have fun deploying your script on Streamlit!

--

--