File size: 286 Bytes
33ec463
 
 
 
 
 
 
1
2
3
4
5
6
7
from transformers import QuestionAnsweringPipeline

class ExtractiveQAPipeline(QuestionAnsweringPipeline):
    def postprocess(self, model_outputs):
        answers = super().postprocess(model_outputs)
        
        return {'guess': answers['answer'], 'confidence': answers['score']}