Update to Transformers.js v3
Browse files
README.md
CHANGED
|
@@ -16,18 +16,18 @@ For more information, check out the official [repository](https://github.com/ZHK
|
|
| 16 |
|
| 17 |
## Usage (Transformers.js)
|
| 18 |
|
| 19 |
-
If you haven't already, you can install the [Transformers.js](https://huggingface.co/docs/transformers.js) JavaScript library from [NPM](https://www.npmjs.com/package/@
|
| 20 |
```bash
|
| 21 |
-
npm i @
|
| 22 |
```
|
| 23 |
|
| 24 |
You can then use the model for portrait matting, as follows:
|
| 25 |
|
| 26 |
```js
|
| 27 |
-
import { AutoModel, AutoProcessor, RawImage } from '@
|
| 28 |
|
| 29 |
// Load model and processor
|
| 30 |
-
const model = await AutoModel.from_pretrained('Xenova/modnet', {
|
| 31 |
const processor = await AutoProcessor.from_pretrained('Xenova/modnet');
|
| 32 |
|
| 33 |
// Load image from URL
|
|
|
|
| 16 |
|
| 17 |
## Usage (Transformers.js)
|
| 18 |
|
| 19 |
+
If you haven't already, you can install the [Transformers.js](https://huggingface.co/docs/transformers.js) JavaScript library from [NPM](https://www.npmjs.com/package/@huggingface/transformers) using:
|
| 20 |
```bash
|
| 21 |
+
npm i @huggingface/transformers
|
| 22 |
```
|
| 23 |
|
| 24 |
You can then use the model for portrait matting, as follows:
|
| 25 |
|
| 26 |
```js
|
| 27 |
+
import { AutoModel, AutoProcessor, RawImage } from '@huggingface/transformers';
|
| 28 |
|
| 29 |
// Load model and processor
|
| 30 |
+
const model = await AutoModel.from_pretrained('Xenova/modnet', { dtype: "fp32" });
|
| 31 |
const processor = await AutoProcessor.from_pretrained('Xenova/modnet');
|
| 32 |
|
| 33 |
// Load image from URL
|