Views
No views yet
npm i @huggingface/transformersXenova/fastvit_t12.apple_dist_in1k.1import { pipeline } from '@huggingface/transformers';
2
3// Create an image classification pipeline
4const classifier = await pipeline('image-classification', 'Xenova/fastvit_t12.apple_dist_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.7830049991607666 },
14// { label: 'tiger cat', score: 0.08560094237327576 },
15// { label: 'lynx, catamount', score: 0.0005580639117397368 },
16// { label: 'Bernese mountain dog', score: 0.0005574578535743058 },
17// { label: 'Appenzeller', score: 0.0005380114307627082 }
18// ]onnx).