Spaces:
Running
Running
Tobias Cornille
commited on
Commit
·
9fa49bb
1
Parent(s):
bf3b2d9
Update index.js
Browse files
index.js
CHANGED
@@ -35,7 +35,7 @@ fileUpload.addEventListener('change', function (e) {
|
|
35 |
// Set up a callback when the file is loaded
|
36 |
reader.onload = e2 => {
|
37 |
img = e2.target.result;
|
38 |
-
detect(
|
39 |
}
|
40 |
|
41 |
reader.readAsDataURL(file);
|
@@ -52,14 +52,14 @@ labels.addEventListener('blur', (e) => {
|
|
52 |
});
|
53 |
|
54 |
// Detect objects in the image
|
55 |
-
async function detect(img
|
56 |
console.warn(candidate_labels);
|
57 |
imageContainer.innerHTML = '';
|
58 |
imageContainer.style.backgroundImage = `url(${img})`;
|
59 |
|
60 |
status.textContent = 'Analysing...';
|
61 |
|
62 |
-
const output = await detector(img,
|
63 |
console.warn(output);
|
64 |
status.textContent = '';
|
65 |
output.forEach(renderBox);
|
|
|
35 |
// Set up a callback when the file is loaded
|
36 |
reader.onload = e2 => {
|
37 |
img = e2.target.result;
|
38 |
+
detect(e2.target.result);
|
39 |
}
|
40 |
|
41 |
reader.readAsDataURL(file);
|
|
|
52 |
});
|
53 |
|
54 |
// Detect objects in the image
|
55 |
+
async function detect(img) {
|
56 |
console.warn(candidate_labels);
|
57 |
imageContainer.innerHTML = '';
|
58 |
imageContainer.style.backgroundImage = `url(${img})`;
|
59 |
|
60 |
status.textContent = 'Analysing...';
|
61 |
|
62 |
+
const output = await detector(img, parsedLabels, { percentage: true });
|
63 |
console.warn(output);
|
64 |
status.textContent = '';
|
65 |
output.forEach(renderBox);
|