Repository containing the code for the ONNX 101 tutorial at the PyData Skopje - November 2023 Meetup
- Example for training a simple classifier using PyTorch for digit recognition on the MNIST dataset and exporting the model to ONNX.
- Using the ONNX model with ONNX runtime for inference with a simple Express.js server. ort-web-api
Pre-requisites:
Prepare the environment
poetry shell
poetry install
Obtain the dataset and train the model
python -m onnx_workshop.mnist
Inference with ONNX runtime
python -m onnx_workshop.inference
Pre-requisites:
Start the server
cd ort-web-api
npm install
node index.js
Make a request
curl --request POST \
--url http://localhost:3000/classify-digit \
--header 'Content-Type: multipart/form-data' \
--form digit=examples/3.png