Xenova HF staff commited on
Commit
ff690b0
·
verified ·
1 Parent(s): c1aa0d7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -1
README.md CHANGED
@@ -12,7 +12,35 @@ If you haven't already, you can install the [Transformers.js](https://huggingfac
12
  npm i @huggingface/transformers
13
  ```
14
 
15
- **Example:** Zero-shot object detection with `onnx-community/grounding-dino-tiny-ONNX`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  ```js
17
  import { AutoModelForZeroShotObjectDetection, AutoProcessor, load_image } from "@huggingface/transformers";
18
 
 
12
  npm i @huggingface/transformers
13
  ```
14
 
15
+ **Example:** Zero-shot object detection with `onnx-community/grounding-dino-tiny-ONNX` using the `pipeline` API.
16
+ ```js
17
+ import { pipeline } from "@huggingface/transformers";
18
+
19
+ const detector = await pipeline("zero-shot-object-detection", "onnx-community/grounding-dino-tiny-ONNX");
20
+
21
+ const url = "http://images.cocodataset.org/val2017/000000039769.jpg";
22
+ const candidate_labels = ["a cat."];
23
+ const output = await detector(url, candidate_labels, {
24
+ threshold: 0.3,
25
+ });
26
+ ```
27
+
28
+
29
+ <details>
30
+
31
+ <summary>See example output</summary>
32
+
33
+ ```
34
+ [
35
+ { score: 0.45316222310066223, label: "a cat", box: { xmin: 343, ymin: 23, xmax: 637, ymax: 372 } },
36
+ { score: 0.36190420389175415, label: "a cat", box: { xmin: 12, ymin: 52, xmax: 317, ymax: 472 } },
37
+ ]
38
+ ```
39
+
40
+ </details>
41
+
42
+
43
+ **Example:** Zero-shot object detection with `onnx-community/grounding-dino-tiny-ONNX` using the `AutoModel` API.
44
  ```js
45
  import { AutoModelForZeroShotObjectDetection, AutoProcessor, load_image } from "@huggingface/transformers";
46