(imageText)
| 95 | |
| 96 | // Perform prediction on the input image using the loaded model. |
| 97 | predict(imageText) { |
| 98 | tf.tidy(() => { |
| 99 | try { |
| 100 | const image = util.textToImageArray(imageText, this.imageSize); |
| 101 | const predictOut = this.model.predict(image); |
| 102 | const winner = predictOut.argMax(1); |
| 103 | |
| 104 | ui.setPredictResults(predictOut.dataSync(), winner.dataSync()[0] + 5); |
| 105 | } catch (e) { |
| 106 | ui.setPredictError(e.message); |
| 107 | } |
| 108 | }); |
| 109 | } |
| 110 | |
| 111 | // Perform retraining on the loaded model. |
| 112 | async retrainModel() { |
no outgoing calls