| 43 | } |
| 44 | |
| 45 | function setPredictFunction(predict, testExamples, imageSize) { |
| 46 | const imageInput = document.getElementById('image-input'); |
| 47 | imageInput.addEventListener('keyup', () => { |
| 48 | const result = predict(imageInput.value); |
| 49 | }); |
| 50 | |
| 51 | const testImageSelect = document.getElementById('test-image-select'); |
| 52 | testImageSelect.addEventListener('change', () => { |
| 53 | imageInput.value = |
| 54 | util.imageVectorToText(testExamples[testImageSelect.value], imageSize); |
| 55 | predict(imageInput.value); |
| 56 | }); |
| 57 | } |
| 58 | |
| 59 | function setRetrainFunction(retrain) { |
| 60 | const retrainButton = document.getElementById('retrain'); |