File size: 334 Bytes
a6bbf63
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
from transformers import TextClassificationPipeline

class PipelinePreparer:
    @staticmethod
    def prepare_pipeline(tokenizer, model):
        """Create text classification pipeline"""
        return TextClassificationPipeline(
            tokenizer=tokenizer,
            model=model,
            return_all_scores=True
        )