Views
No views yet
npm i @huggingface/transformersXenova/fastvit_t8.apple_in1k.1import { pipeline } from '@huggingface/transformers';
2
3// Create an image classification pipeline
4const classifier = await pipeline('image-classification', 'Xenova/fastvit_t8.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.6010770201683044 },
14// { label: 'tiger cat', score: 0.16961118578910828 },
15// { label: 'tabby, tabby cat', score: 0.0016111385775730014 },
16// { label: 'loudspeaker, speaker, speaker unit, loudspeaker system, speaker system', score: 0.0011642660247161984 },
17// { label: 'dhole, Cuon alpinus', score: 0.0008378682541660964 }
18// ]onnx).