Xenova HF staff commited on
Commit
ccfd95d
1 Parent(s): b72c906

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +3 -4
index.js CHANGED
@@ -57,9 +57,8 @@ async function detect(img) {
57
  }
58
 
59
  // Render a bounding box and label on the image
60
- function renderBox([xmin, ymin, xmax, ymax, score, label]) {
61
- console.log([xmin, ymin, xmax, ymax, score, label])
62
- return;
63
  // Generate a random color for the box
64
  const color = '#' + Math.floor(Math.random() * 0xFFFFFF).toString(16).padStart(6, 0);
65
 
@@ -76,7 +75,7 @@ console.log([xmin, ymin, xmax, ymax, score, label])
76
 
77
  // Draw label
78
  const labelElement = document.createElement('span');
79
- labelElement.textContent = label;
80
  labelElement.className = 'bounding-box-label';
81
  labelElement.style.backgroundColor = color;
82
 
 
57
  }
58
 
59
  // Render a bounding box and label on the image
60
+ function renderBox([xmin, ymin, xmax, ymax, score, id]) {
61
+ console.log([xmin, ymin, xmax, ymax, score, label])
 
62
  // Generate a random color for the box
63
  const color = '#' + Math.floor(Math.random() * 0xFFFFFF).toString(16).padStart(6, 0);
64
 
 
75
 
76
  // Draw label
77
  const labelElement = document.createElement('span');
78
+ labelElement.textContent = model.config.id2label[id];
79
  labelElement.className = 'bounding-box-label';
80
  labelElement.style.backgroundColor = color;
81