nathantablang's picture
Upload DemoQAPipeline
fe0d4cd verified
raw
history blame contribute delete
No virus
360 Bytes
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']}