Views
No views yet
npm i @huggingface/transformersXenova/fastvit_sa36.apple_in1k.1import { pipeline } from '@huggingface/transformers';
2
3// Create an image classification pipeline
4const classifier = await pipeline('image-classification', 'Xenova/fastvit_sa36.apple_in1k');
5
6// Classify an image
7const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg';
8const output = await classifier(url, { top_k: 5 });
9console.log(output);
10// [
11// { label: 'tiger, Panthera tigris', score: 0.6733373403549194 },
12// { label: 'tiger cat', score: 0.09628139436244965 },
13// { label: 'jaguar, panther, Panthera onca, Felis onca', score: 0.0017674138071015477 },
14// { label: 'lynx, catamount', score: 0.0017662938917055726 },
15// { label: 'tabby, tabby cat', score: 0.0013090027496218681 }
16// ]onnx).