Spaces:
Running
Running
Tobias Cornille
commited on
Commit
·
dab9cb2
1
Parent(s):
7cb924a
Update index.js
Browse files
index.js
CHANGED
@@ -13,7 +13,7 @@ const EXAMPLE_URL = 'https://huggingface.co/datasets/Xenova/transformers.js-docs
|
|
13 |
|
14 |
// Create a new object detection pipeline
|
15 |
status.textContent = 'Loading model...';
|
16 |
-
const detector = await pipeline('zero-shot-object-detection', 'Xenova/owlvit-base-patch32'
|
17 |
status.textContent = 'Ready';
|
18 |
|
19 |
example.addEventListener('click', (e) => {
|
@@ -44,7 +44,7 @@ async function detect(img) {
|
|
44 |
status.textContent = 'Analysing...';
|
45 |
|
46 |
const candidate_labels = ['human face', 'rocket', 'helmet', 'american flag'];
|
47 |
-
const output = await detector(img, candidate_labels);
|
48 |
status.textContent = '';
|
49 |
output.forEach(renderBox);
|
50 |
|
|
|
13 |
|
14 |
// Create a new object detection pipeline
|
15 |
status.textContent = 'Loading model...';
|
16 |
+
const detector = await pipeline('zero-shot-object-detection', 'Xenova/owlvit-base-patch32');
|
17 |
status.textContent = 'Ready';
|
18 |
|
19 |
example.addEventListener('click', (e) => {
|
|
|
44 |
status.textContent = 'Analysing...';
|
45 |
|
46 |
const candidate_labels = ['human face', 'rocket', 'helmet', 'american flag'];
|
47 |
+
const output = await detector(img, candidate_labels, { percentage: true });
|
48 |
status.textContent = '';
|
49 |
output.forEach(renderBox);
|
50 |
|