Instructions to use onnx-community/modnet-webnn with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use onnx-community/modnet-webnn with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-segmentation', 'onnx-community/modnet-webnn');
Update README.md
Browse files
README.md
CHANGED
|
@@ -28,7 +28,7 @@ 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');
|
| 33 |
// You can also use `output[0].toCanvas()` or `await output[0].toBlob()` if you would like to access the output without saving.
|
| 34 |
```
|
|
|
|
| 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');
|
| 33 |
// You can also use `output[0].toCanvas()` or `await output[0].toBlob()` if you would like to access the output without saving.
|
| 34 |
```
|