Update README.md
Browse files
README.md
CHANGED
@@ -15,19 +15,19 @@ npm i @xenova/transformers
|
|
15 |
**Example:** Perform mask generation with `Xenova/sam-vit-large`.
|
16 |
|
17 |
```js
|
18 |
-
import { SamModel, AutoProcessor, RawImage } from
|
19 |
|
20 |
// Load model and processor
|
21 |
-
const model = await SamModel.from_pretrained(
|
22 |
-
const processor = await AutoProcessor.from_pretrained(
|
23 |
|
24 |
// Prepare image and input points
|
25 |
-
const img_url =
|
26 |
const raw_image = await RawImage.read(img_url);
|
27 |
-
const input_points = [[[340, 250]]];
|
28 |
|
29 |
// Process inputs and perform mask generation
|
30 |
-
const inputs = await processor(raw_image, input_points);
|
31 |
const outputs = await model(inputs);
|
32 |
|
33 |
// Post-process masks
|
|
|
15 |
**Example:** Perform mask generation with `Xenova/sam-vit-large`.
|
16 |
|
17 |
```js
|
18 |
+
import { SamModel, AutoProcessor, RawImage } from "@huggingface/transformers";
|
19 |
|
20 |
// Load model and processor
|
21 |
+
const model = await SamModel.from_pretrained("Xenova/sam-vit-large");
|
22 |
+
const processor = await AutoProcessor.from_pretrained("Xenova/sam-vit-large");
|
23 |
|
24 |
// Prepare image and input points
|
25 |
+
const img_url = "https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/corgi.jpg";
|
26 |
const raw_image = await RawImage.read(img_url);
|
27 |
+
const input_points = [[[340, 250]]];
|
28 |
|
29 |
// Process inputs and perform mask generation
|
30 |
+
const inputs = await processor(raw_image, { input_points });
|
31 |
const outputs = await model(inputs);
|
32 |
|
33 |
// Post-process masks
|