Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,11 +18,12 @@ class BasicAgent:
|
|
| 18 |
# Load the BERT model fine-tuned on the SQuAD dataset
|
| 19 |
self.qa_pipeline = pipeline("question-answering", model="bert-large-uncased-whole-word-masking-finetuned-squad")
|
| 20 |
|
| 21 |
-
def __call__(self, question: str
|
| 22 |
"""
|
| 23 |
Process the question using the BERT model fine-tuned on SQuAD, and return an answer based on the context.
|
| 24 |
"""
|
| 25 |
try:
|
|
|
|
| 26 |
# Use the QA pipeline to get an answer based on the context and the question
|
| 27 |
result = self.qa_pipeline(question=question, context=context)
|
| 28 |
answer = result["answer"]
|
|
|
|
| 18 |
# Load the BERT model fine-tuned on the SQuAD dataset
|
| 19 |
self.qa_pipeline = pipeline("question-answering", model="bert-large-uncased-whole-word-masking-finetuned-squad")
|
| 20 |
|
| 21 |
+
def __call__(self, question: str) -> str:
|
| 22 |
"""
|
| 23 |
Process the question using the BERT model fine-tuned on SQuAD, and return an answer based on the context.
|
| 24 |
"""
|
| 25 |
try:
|
| 26 |
+
context = f"answer the following question as briefly as possible{question}"
|
| 27 |
# Use the QA pipeline to get an answer based on the context and the question
|
| 28 |
result = self.qa_pipeline(question=question, context=context)
|
| 29 |
answer = result["answer"]
|