Last active
September 9, 2021 19:30
-
-
Save J3698/f1c79874dbcd01a0048b2312d1623005 to your computer and use it in GitHub Desktop.
Request predictions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addClassifyRequestInterval() { | |
setInterval(function() { | |
if (!shouldUpdate) { | |
return | |
} | |
shouldUpdate = false; | |
var xhttp = new XMLHttpRequest(); | |
xhttp.onreadystatechange = function() { | |
if (xhttp.readyState == 4 && xhttp.status == 200) { | |
let jsonResponse = JSON.parse(xhttp.responseText); | |
let top5 = jsonResponse['top5']; | |
updatePredictionsHTML(top5); | |
} | |
}; | |
data = encodeURIComponent(JSON.stringify({"data": points})) | |
xhttp.open("GET", "http://localhost/classify?points=" + data, true); | |
xhttp.send(null); | |
}, 150); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment