Xenova HF staff commited on
Commit
b72c906
1 Parent(s): b8a9903

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +3 -1
index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { env, AutoProcessor, AutoModel } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
2
 
3
  // Since we will download the model from the Hugging Face Hub, we can skip the local model check
4
  env.allowLocalModels = false;
@@ -46,6 +46,8 @@ async function detect(img) {
46
 
47
  status.textContent = 'Analysing...';
48
 
 
 
49
  const { pixel_values } = await processor(image);
50
 
51
  const { outputs } = await model({images: pixel_values});
 
1
+ import { env, AutoProcessor, AutoModel, RawImage } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
2
 
3
  // Since we will download the model from the Hugging Face Hub, we can skip the local model check
4
  env.allowLocalModels = false;
 
46
 
47
  status.textContent = 'Analysing...';
48
 
49
+ const image = await RawImage.fromURL(img);
50
+
51
  const { pixel_values } = await processor(image);
52
 
53
  const { outputs } = await model({images: pixel_values});