Views
No views yet
npm i @huggingface/transformersXenova/ast-finetuned-audioset-10-10-0.4593 and return top 4 results.1import { pipeline } from '@huggingface/transformers';
2
3// Create an audio classification pipeline
4const classifier = await pipeline('audio-classification', 'Xenova/ast-finetuned-audioset-10-10-0.4593');
5
6// Predict class
7const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/cat_meow.wav';
8const output = await classifier(url, { top_k: 4 });
9console.log(output);
10// [
11// { label: 'Meow', score: 0.5617874264717102 },
12// { label: 'Cat', score: 0.22365376353263855 },
13// { label: 'Domestic animals, pets', score: 0.1141069084405899 },
14// { label: 'Animal', score: 0.08985692262649536 },
15// ]onnx).