function getPredictionHtmlPrettyPrint()

in src/js/app.js [286:311]


function getPredictionHtmlPrettyPrint() {

  // Loop through all element in predictions and round to 4 places.
  let response = [];
  let classVal, classLabel = "", confidence = "", color = "";
  for (let i = 0; i < predictions.length; i++) {

    // Set the class label as per Class Map if user entered a matching vakue
    classVal = parseInt(predictions[i][0]);

    // Prediction confidence as human readable %
    confidence = `${Math.round(predictions[i][1] * 10000) / 100} %`;

    // Get the prediction color to be dicplayed for this label
    color = colorArray[classVal];

    // Get the class label.
    classLabel = getPredictionLabel(classVal);

    // Now append to response
    response.push(`<p style="color: ${color}">${i + 1} - ${classLabel} - Confidence: ${confidence}</p>`);

  }

  return response.join("");
}