Tobias Cornille commited on
Commit
500ed37
1 Parent(s): ed29a46

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +3 -2
index.js CHANGED
@@ -9,7 +9,7 @@ const fileUpload = document.getElementById('upload');
9
  const imageContainer = document.getElementById('container');
10
  const example = document.getElementById('example');
11
 
12
- const EXAMPLE_URL = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/city-streets.jpg';
13
 
14
  // Create a new object detection pipeline
15
  status.textContent = 'Loading model...';
@@ -42,7 +42,8 @@ async function detect(img) {
42
  imageContainer.style.backgroundImage = `url(${img})`;
43
 
44
  status.textContent = 'Analysing...';
45
- const output = await detector(img, ["street", "car"]);
 
46
  status.textContent = '';
47
  output.forEach(renderBox);
48
  }
 
9
  const imageContainer = document.getElementById('container');
10
  const example = document.getElementById('example');
11
 
12
+ const EXAMPLE_URL = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/astronaut.png';
13
 
14
  // Create a new object detection pipeline
15
  status.textContent = 'Loading model...';
 
42
  imageContainer.style.backgroundImage = `url(${img})`;
43
 
44
  status.textContent = 'Analysing...';
45
+ const candidate_labels = ['human face', 'rocket', 'helmet', 'american flag'];
46
+ const output = await detector('https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/astronaut.png', candidate_labels);
47
  status.textContent = '';
48
  output.forEach(renderBox);
49
  }