Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
|
@@ -16,7 +16,7 @@ const THRESHOLD = 0.25;
|
|
| 16 |
status.textContent = 'Loading model...';
|
| 17 |
const model_id = 'onnx-community/yolov10s';
|
| 18 |
const processor = await AutoProcessor.from_pretrained(model_id);
|
| 19 |
-
const model = await AutoModel.from_pretrained(model_id
|
| 20 |
status.textContent = 'Ready';
|
| 21 |
|
| 22 |
example.addEventListener('click', (e) => {
|
|
@@ -88,7 +88,7 @@ function renderBox([xmin, ymin, xmax, ymax, score, id], [w, h]) {
|
|
| 88 |
|
| 89 |
// Draw label
|
| 90 |
const labelElement = document.createElement('span');
|
| 91 |
-
labelElement.textContent = model.config.id2label[id]
|
| 92 |
labelElement.className = 'bounding-box-label';
|
| 93 |
labelElement.style.backgroundColor = color;
|
| 94 |
|
|
|
|
| 16 |
status.textContent = 'Loading model...';
|
| 17 |
const model_id = 'onnx-community/yolov10s';
|
| 18 |
const processor = await AutoProcessor.from_pretrained(model_id);
|
| 19 |
+
const model = await AutoModel.from_pretrained(model_id);
|
| 20 |
status.textContent = 'Ready';
|
| 21 |
|
| 22 |
example.addEventListener('click', (e) => {
|
|
|
|
| 88 |
|
| 89 |
// Draw label
|
| 90 |
const labelElement = document.createElement('span');
|
| 91 |
+
labelElement.textContent = `${model.config.id2label[id]} (${score.toFixed(2)}%)`;
|
| 92 |
labelElement.className = 'bounding-box-label';
|
| 93 |
labelElement.style.backgroundColor = color;
|
| 94 |
|