Views
No views yet
npm i @huggingface/transformers1import { pipeline } from '@huggingface/transformers';
2
3const segmenter = await pipeline('background-removal', 'onnx-community/ormbg-ONNX');
4const url = 'https://images.pexels.com/photos/5965592/pexels-photo-5965592.jpeg?auto=compress&cs=tinysrgb&w=1024';
5const output = await segmenter([url]);
6output[0].save('mask.png');
7// You can also use `output[0].toCanvas()` or `await output[0].toBlob()` if you would like to access the output without saving.