Spaces:
Running
Running
Update index.js
Browse files
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,
|
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 =
|
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 |
|