tbold/cli-ml-tools
1
1import { pipeline } from '@xenova/transformers';2 3export default class ClassificationPipeline {4 static task = 'text-classification';5 static model = 'Xenova/distilbert-base-uncased-finetuned-sst-2-english';6 static instance = null;7 8 static async getInstance(progress_callback = null) {9 if (this.instance === null) {10 this.instance = pipeline(this.task, this.model, { progress_callback });11 }12 13 return this.instance;14 }15}