Views
No views yet
npm i @huggingface/transformerspipeline API.1import { pipeline } from '@huggingface/transformers';
2
3const classifier = await pipeline('zero-shot-image-classification', 'Xenova/clip-vit-base-patch32');
4const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg';
5const output = await classifier(url, ['tiger', 'horse', 'dog']);
6// [
7// { score: 0.9993917942047119, label: 'tiger' },
8// { score: 0.0003519294841680676, label: 'horse' },
9// { score: 0.0002562698791734874, label: 'dog' }
10// ]onnx).