Spaces:
Sleeping
Sleeping
Update app.py
Browse files17 unmodified lines181920212223242526272817 unmodified lines# Load the BERT model fine-tuned on the SQuAD datasetself.qa_pipeline = pipeline("question-answering", model="bert-large-uncased-whole-word-masking-finetuned-squad")def __call__(self, question: str, context: str) -> str:"""Process the question using the BERT model fine-tuned on SQuAD, and return an answer based on the context."""try:# Use the QA pipeline to get an answer based on the context and the questionresult = self.qa_pipeline(question=question, context=context)answer = result["answer"]17 unmodified lines18192021222324252627282917 unmodified lines# Load the BERT model fine-tuned on the SQuAD datasetself.qa_pipeline = pipeline("question-answering", model="bert-large-uncased-whole-word-masking-finetuned-squad")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 questionresult = self.qa_pipeline(question=question, context=context)answer = result["answer"]
app.py+2-1