This project was created as part of the Tools for Data Scientist course, which is part of the DSAIB master's program at HEC Paris and École Polytechnique. The objective of the project was to take an existing data science project, create a Streamlit app, and containerize it using Docker.
For this project, I have chosen to work with one of the most classic datasets in data science: the digits dataset from scikit-learn. The handling of this dataset is based on the approach by Gaël Varoquaux, founder of scikit-learn.
The Streamlit app presents a simple exploration and prediction model using the digits dataset, which consists of 8x8 pixel images of handwritten digits. The app allows users to explore the dataset and see predictions made using a Support Vector Machine (SVM) classifier.
- Streamlit is used to display the data and results interactively.
- Docker is used to containerize the application for easy distribution and deployment.
- Docker: Ensure you have Docker installed on your machine to run the containerized app.
-
Clone this Github repositery
-
Build the docker image:
docker build -t streamlit-app
-
Run the Docker container:
docker run -p 8501:8501 streamlit-app
-
Open your browser and go to http://localhost:8501 to see the app.
To run the Streamlit app using Docker, follow these steps:
-
Pull the Docker image
In your terminal, run the following command to pull the Docker image from DockerHub:docker pull benjamincerf/streamlit-app
-
Run the Docker container
After the image is pulled, use the following command to start the container and run the Streamlit app on port 8501:docker run -p 8501:8501 benjamincerf/streamlit-app
-
Access the Streamlit app
Open your browser and go to http://localhost:8501. You should see the Streamlit interface of the app, where you can explore the digits dataset and see predictions.
If you wish to remove the container and image from your machine after use, you can do the following:
- Stop the running container:
Find the container's ID by running:Then stop the container by running:docker ps
docker stop [CONTAINER_ID]
- Remove the Docker image:
To remove the image from your machine, run:This will free up the space used by the image.docker rmi benjamincerf/streamlit-app