This workshop is (stream)LIT! 🔥

This repository was created to accompany a Pyladies workshop. It serves as a playground to learn how to use streamlit to build web apps. Please find the complementary presentation here.

Requirements

  • Python 3.8
  • Virtual environment manager, example venv, or devcontainer plugin for VS Code
  • Github account and github CLI

⚡️ Get started

Open a terminal window and clone this repository:

git clone git@github.com:thaisbendixen/pyladies_streamlit_workshop.git

cd pyladies_streamlit_workshop

Create a virtual environment or use the devcontainer. Please ask mentors at the workshop if you need help.

Next install requirements:

pip install -r requirements.txt

🤸‍♀️ Streamlit playground

First we start by exploring the streamlit capabilities, by building a few small web apps. To create your app please use my_first_app.py.

To build your first app add the following lines to the file mentioned above:

import streamlit as st

st.write("This is my first web app! YAY")

To start and run your app in the terminal write:

streamlit run streamlit_playground/my_first_app.py

The above command will open a window in your browser with your web app. You can edit the my_first_app.py file and rerun your app on the browser to see your most current changes.

To add functionalities to your streamlit app please refer to the streamlit documentation.

🤖 Digit classification app

After you have explored streamlit for this workshop we prepared a machine learning project that classifies handwritten digits in a web app. See example here. We provide the solution here. If you are new to machine learning we recommend looking at the google colab file.

To create and train machine learning model run:

python handwritten_number_classification/digit_classifier_model/digit_classifier_model.py 

Run streamlit app:

streamlit run handwritten_number_classification/digit_classification_app.py

Resources

A lot of this code is recycled from the following resources and was combined to create this workshop: