Spaces:
Runtime error
Runtime error
Update app.py
Browse filesTry same paragraph and question on a different model: distilbert-base-cased-distilled-squad.
app.py
CHANGED
|
@@ -2,9 +2,13 @@ from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
|
| 2 |
import gradio as grad
|
| 3 |
import ast
|
| 4 |
|
| 5 |
-
#
|
| 6 |
# It’s been trained on question-answer pairs, including unanswerable questions, for the task of question and answering.
|
| 7 |
-
mdl_name = "deepset/roberta-base-squad2"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
my_pipeline = pipeline('question-answering', model=mdl_name, tokenizer=mdl_name)
|
| 9 |
|
| 10 |
def answer_question(question,context):
|
|
|
|
| 2 |
import gradio as grad
|
| 3 |
import ast
|
| 4 |
|
| 5 |
+
# 1. The RoBERTa base model is used, fine-tuned using the SQuAD 2.0 dataset.
|
| 6 |
# It’s been trained on question-answer pairs, including unanswerable questions, for the task of question and answering.
|
| 7 |
+
# mdl_name = "deepset/roberta-base-squad2"
|
| 8 |
+
# my_pipeline = pipeline('question-answering', model=mdl_name, tokenizer=mdl_name)
|
| 9 |
+
|
| 10 |
+
# 2. Different model.
|
| 11 |
+
mdl_name = "distilbert-base-cased-distilled-squad"
|
| 12 |
my_pipeline = pipeline('question-answering', model=mdl_name, tokenizer=mdl_name)
|
| 13 |
|
| 14 |
def answer_question(question,context):
|