Spaces:
Running
Running
File size: 317 Bytes
47b5f0c |
1 2 3 4 5 6 7 8 9 10 11 |
from transformers import pipeline
class QuestionAnswering:
def __init__(self, qa_pipeline: pipeline):
self.qa_pipeline = qa_pipeline
def answer_question(self, question: str, context: str) -> str:
result = self.qa_pipeline(question=question, context=context)
return result["answer"]
|