ormbg-ONNX / README.md
Xenova's picture
Xenova HF Staff
Update README.md
7663b1e verified
|
raw
history blame
930 Bytes
metadata
license: apache-2.0
base_model:
  - schirrmacher/ormbg
pipeline_tag: image-segmentation
library_name: transformers.js
tags:
  - background-removal

Usage (Transformers.js)

If you haven't already, you can install the Transformers.js JavaScript library from NPM using:

npm i @huggingface/transformers

Example: Remove background of an image

import { pipeline } from '@huggingface/transformers';

const segmenter = await pipeline('background-removal', 'onnx-community/ormbg-ONNX');
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/woman-with-afro_medium.jpg';
const output = await segmenter(url);
output[0].save('mask.png');
// You can also use `output[0].toCanvas()` or `await output[0].toBlob()` if you would like to access the output without saving.