Update README.md
Browse files
README.md
CHANGED
|
@@ -26,7 +26,7 @@ You can then use the model for portrait matting, as follows:
|
|
| 26 |
```js
|
| 27 |
import { pipeline } from '@huggingface/transformers';
|
| 28 |
|
| 29 |
-
const segmenter = await pipeline('background-removal', '
|
| 30 |
const url = 'https://images.pexels.com/photos/5965592/pexels-photo-5965592.jpeg?auto=compress&cs=tinysrgb&w=1024';
|
| 31 |
const output = await segmenter(url);
|
| 32 |
output[0].save('mask.png');
|
|
@@ -39,8 +39,8 @@ Or with the `AutoModel` and `AutoProcessor` APIs:
|
|
| 39 |
import { AutoModel, AutoProcessor, RawImage } from '@huggingface/transformers';
|
| 40 |
|
| 41 |
// Load model and processor
|
| 42 |
-
const model = await AutoModel.from_pretrained('
|
| 43 |
-
const processor = await AutoProcessor.from_pretrained('
|
| 44 |
|
| 45 |
// Load image from URL
|
| 46 |
const url = 'https://images.pexels.com/photos/5965592/pexels-photo-5965592.jpeg?auto=compress&cs=tinysrgb&w=1024';
|
|
|
|
| 26 |
```js
|
| 27 |
import { pipeline } from '@huggingface/transformers';
|
| 28 |
|
| 29 |
+
const segmenter = await pipeline('background-removal', 'onnx-community/modnet-webnn', { dtype: 'fp32' });
|
| 30 |
const url = 'https://images.pexels.com/photos/5965592/pexels-photo-5965592.jpeg?auto=compress&cs=tinysrgb&w=1024';
|
| 31 |
const output = await segmenter(url);
|
| 32 |
output[0].save('mask.png');
|
|
|
|
| 39 |
import { AutoModel, AutoProcessor, RawImage } from '@huggingface/transformers';
|
| 40 |
|
| 41 |
// Load model and processor
|
| 42 |
+
const model = await AutoModel.from_pretrained('onnx-community/modnet-webnn', { dtype: 'fp32' });
|
| 43 |
+
const processor = await AutoProcessor.from_pretrained('onnx-community/modnet-webnn');
|
| 44 |
|
| 45 |
// Load image from URL
|
| 46 |
const url = 'https://images.pexels.com/photos/5965592/pexels-photo-5965592.jpeg?auto=compress&cs=tinysrgb&w=1024';
|