Streamlit is an open-source Python library that can create web applications for data science concepts including machine learning.
%% Cell type:markdown id: tags:
#### How to install Streamlit on your computer:
In your terminal, type and enter:
_pip install streamlit_
To check if this worked properly, run:
_streamlit hello_
This command should open the Streamlit Hello application in your browser.
%% Cell type:markdown id: tags:
```bash
streamlit run streamlit_tutorial.py
```
%% Cell type:markdown id: tags:
Or run the cell below
%% Cell type:code id: tags:
``` python
!streamlitrunstreamlit_tutorial.py
```
%% Output
^C
%% Cell type:markdown id: tags:
#### About the code
%% Cell type:markdown id: tags:
- Streamlit web app that uses a random forest to predict the class of an iris flower based on its sepal and petal lengths.
- Loads the data from scikit, then trains a random forest model, and defines widgets for the user to change values for sepal length, sepal width, petal length, and petal width.
- Defines a function to make predictions based on the user's inputs.
- When "Get Prediction" button is clicked, the app uses the prediction function and displays the predicted class of the iris flower as well as the estimates for each class.