Spaces:
Sleeping
Sleeping
File size: 2,243 Bytes
6209161 f3b9ddb 1a6d3a6 6209161 134360c 6209161 746d998 1a6d3a6 746d998 1a6d3a6 746d998 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
---
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](https://yann.lecun.com/exdb/mnist/).
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](https://autokeras.com/image_classifier/).
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](https://github.com/onnx/models/blob/main/validated/vision/classification/mnist/README.md).
The application allows you to:
1. Select which model you want to use for predicting a handwritten digit
2. Select your stroke width of the digit you draw
3. 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:
```shell
pip install -r requirements.txt
```
|