File size: 360 Bytes
fe0d4cd |
1 2 3 4 5 6 |
from transformers import QuestionAnsweringPipeline, pipeline, AutoModelForQuestionAnswering, TFAutoModelForQuestionAnswering, AutoTokenizer
class DemoQAPipeline(QuestionAnsweringPipeline):
def postprocess(self, model_outputs):
answers = super().postprocess(model_outputs)
return {'guess': answers['answer'], 'confidence': answers['score']} |