Spaces:
Sleeping
A newer version of the Streamlit SDK is available:
1.40.1
title: Neural Net Comparison on MNIST
emoji: π
colorFrom: yellow
colorTo: red
sdk: streamlit
sdk_version: 1.37.0
app_file: app.py
pinned: false
license: mit
tags:
- MNIST
- Onnx
- Keras
MNIST Streamlit
This is a simple Streamlit app that demonstrates the differences between neural nets trained on the MNIST dataset.
There are three models saved locally available in the models
directory:
autokeras_model.keras
mnist_12.onnx
mnist_model.keras
The mnist_model.keras
is a simple 300x300 neural net trained over 35 epochs.
The autokeras_model.keras
is a more complex model generated by running the Autokeras image classifier class.
Meanwhile, the mnist_12.onnx
model is a pre-trained model from theOnnx model zoo. Onnx provides detailed information about how the model was created in the repository on GitHub.
The application allows you to:
- Select which model you want to use for predicting a handwritten digit
- Select your stroke width of the digit you draw
- Draw a specific digit within a canvas
Once you draw a digit, the model will be loaded, asked to make a prediction on your input, and provide:
- The name of the model used to make the prediction
- A prediction (the top prediction from it's probability distribution)
- The time the model took to predict
- The time it took to load the model
- The probability distribution of predictions as a bar chart and table
If you change your selected model after drawing the digit, that same drawing will be used with the newly selected model.
To clear your "hand" drawn digit, click the trashcan icon under the drawing canvas.
Usage
To run the Streamlit app locally using Poetry, clone the repository, cd
into the created directory, and run the following commands:
poetry shell
poetry install
streamlit run app.py
If you don't have Poetry installed, never fear! There is a requirements.txt
file that you may use to install the necessary packages with Pip. Simply create a new virtual environment and run:
pip install -r requirements.txt