Update app.py
Browse files17 unmodified lines1819202121222324252627282917 unmodified lines # Load the BERT model fine-tuned on the SQuAD dataset self.qa_pipeline = pipeline("question-answering", model="bert-large-uncased-whole-word-masking-finetuned-squad") def __call__(self, question: str, context: str) -> str: def __call__(self, question: str) -> str: """ Process the question using the BERT model fine-tuned on SQuAD, and return an answer based on the context. """ try: context = f"answer the following question as briefly as possible{question}" # Use the QA pipeline to get an answer based on the context and the question result = self.qa_pipeline(question=question, context=context) answer = result["answer"]app.py+2-1