Views
No views yet
npm i @huggingface/transformersonnx-community/hiera-tiny-224-in1k-hf1import { pipeline } from '@huggingface/transformers';
2
3// Create an image classification pipeline
4const classifier = await pipeline('image-classification', 'onnx-community/hiera-tiny-224-in1k-hf');
5
6// Classify an image
7const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg';
8const output = await classifier(url);
9console.log(output);
10// [
11// { label: 'tiger, Panthera tigris', score: 0.759323239326477 },
12// { label: 'tiger cat', score: 0.08907650411128998 },
13// { label: 'lynx, catamount', score: 0.0008640264859423041 },
14// { label: 'jaguar, panther, Panthera onca, Felis onca', score: 0.0007982379174791276 },
15// { label: 'leopard, Panthera pardus', score: 0.00041627752943895757 }
16// ]onnx).