MCPcopy Create free account
hub / github.com/tensorflow/tfjs-examples / setPredictFunction

Function setPredictFunction

mnist-transfer-cnn/ui.js:45–57  ·  view source on GitHub ↗
(predict, testExamples, imageSize)

Source from the content-addressed store, hash-verified

43}
44
45function 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
59function setRetrainFunction(retrain) {
60 const retrainButton = document.getElementById('retrain');

Callers 1

prepUIFunction · 0.70

Calls 1

predictFunction · 0.50

Tested by

no test coverage detected