Views
No views yet
npm i @huggingface/transformersXenova/fastvit_t12.apple_in1k.1import { pipeline } from '@huggingface/transformers';
2
3// Create an image classification pipeline
4const classifier = await pipeline('image-classification', 'Xenova/fastvit_t12.apple_in1k', {
5 dtype: "fp32"
6});
7
8// Classify an image
9const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg';
10const output = await classifier(url, { top_k: 5 });
11console.log(output);
12// [
13// { label: 'tiger, Panthera tigris', score: 0.6649345755577087 },
14// { label: 'tiger cat', score: 0.12454754114151001 },
15// { label: 'lynx, catamount', score: 0.0010689536575227976 },
16// { label: 'dhole, Cuon alpinus', score: 0.0010422508930787444 },
17// { label: 'silky terrier, Sydney silky', score: 0.0009548701345920563 }
18// ]onnx).