in website/src/MapPage/map.js [192:224]
function populateImageSeeds(paintingIds){
const imageToSeedUrl = "https://mmlsparkdemo.blob.core.windows.net/met/inverted/biggan1/seeds/";
var prealloc = [];
paintingIds.forEach(function (id, i) {
prealloc[i] = { latents: [], labels: [] };
prealloc[i].latents = new Array(140).fill(0);
prealloc[i].labels = new Array(1000).fill(0);
stateHolder.setState({ images: prealloc });
});
paintingIds.forEach(function (id, i) {
const Http = new XMLHttpRequest();
Http.open("GET", imageToSeedUrl + id + ".json");
Http.send();
Http.onreadystatechange = (e) => {
if (Http.readyState === 4) {
try {
const response = JSON.parse(Http.responseText);
const imagesString = JSON.stringify(stateHolder.state.images);
const imagesCopy = JSON.parse(imagesString);
imagesCopy[i] = { latents: [], labels: [] };
imagesCopy[i].latents = response.latents;
imagesCopy[i].labels = response.labels;
stateHolder.setState({ images: imagesCopy });
} catch {
console.log('malformed request:' + Http.responseText);
}
}
}
})
}