Spaces:
Running
Running
Update index.html
Browse files- 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 |
-
|
28 |
-
|
|
|
|
|
|
|
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 {
|