radames commited on
Commit
f5c5994
·
1 Parent(s): c4f7f40

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +6 -3
index.html CHANGED
@@ -11,7 +11,7 @@
11
  <body>
12
  <script type="module">
13
  import { HfInference } from 'https://cdn.skypack.dev/@huggingface/inference@1.5.2';
14
- let hf = new HfInference();
15
 
16
  document.querySelector("#tokenBtn").addEventListener("click", (e) => {
17
  const token = document.querySelector("#token").value;
@@ -24,8 +24,11 @@
24
  })
25
  function init() {
26
  const img = document.querySelector("#example-img");
27
- const blob = new Blob([img.src], { type: "image/png" });
28
- detectObjects(blob, img.naturalWidth, img.naturalHeight);
 
 
 
29
  }
30
  async function detectObjects(imgBlob, imgW, imgH) {
31
  try {
 
11
  <body>
12
  <script type="module">
13
  import { HfInference } from 'https://cdn.skypack.dev/@huggingface/inference@1.5.2';
14
+ let hf = new HfInference()
15
 
16
  document.querySelector("#tokenBtn").addEventListener("click", (e) => {
17
  const token = document.querySelector("#token").value;
 
24
  })
25
  function init() {
26
  const img = document.querySelector("#example-img");
27
+ fetch(img.src)
28
+ .then((res) => res.blob())
29
+ .then((blob) => {
30
+ detectObjects(blob, img.naturalWidth, img.naturalHeight);
31
+ })
32
  }
33
  async function detectObjects(imgBlob, imgW, imgH) {
34
  try {