This REST API exposes a classifier neural network that can predict hand-written digits. The classifier needs to be trained first with the MNIST dataset before it can make any useful predictions.
curl / -X GET
/predict
Field name | Data type |
---|---|
answer | int |
confidence | float |
groundTruth | int |
answerIsRight | bool |
curl /api/mnist/predict -X POST \
-H "Content-Type: application/json" \
-d "@./test_data/test-digit-7.json"
{
"answer": 7,
"confidence": 98.40227284559472,
"groundTruth": null,
"answerIsRight": null
}
/train
Field name | Data type |
---|---|
epochs (optional) | int |
learningRate (optional) | float |
Field name | Data type |
---|---|
totalTrained | int |
status | string |
timeElapsedInSeconds | float |
curl /api/mnist/train -X POST \
-H "Content-Type: application/json" \
-d "{\"epochs\": 5}"
{
"totalTrained": 300000,
"status": "Done",
"timeElapsedInSeconds": 756.719
}
/test
Field name | Data type |
---|---|
testLength (optional) | int |
Field name | Data type |
---|---|
totalTested | int |
totalCorrectAnswers | int |
totalWrongAnswers | int |
accuracy | float |
curl /api/mnist/test -X POST \
-H "Content-Type: application/json"
{
"totalTested": 10000,
"totalCorrectAnswers": 8153,
"totalWrongAnswers": 1847,
"accuracy": 81.53
}
- Clone the repo
npm install
npm run build
npm run start