Spaces:
Runtime error
Runtime error
Commit
•
e8e065a
1
Parent(s):
c1d65b6
Update app.py
Browse files
app.py
CHANGED
@@ -3,9 +3,8 @@ import gradio as grad
|
|
3 |
import ast
|
4 |
mdl_name = "deepset/roberta-base-squad2"
|
5 |
my_pipeline = pipeline('question-answering', model=mdl_name, tokenizer=mdl_name)
|
6 |
-
def answer_question(question,context):
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
return response
|
11 |
grad.Interface(answer_question, inputs=["text","text"], outputs="text").launch()
|
|
|
3 |
import ast
|
4 |
mdl_name = "deepset/roberta-base-squad2"
|
5 |
my_pipeline = pipeline('question-answering', model=mdl_name, tokenizer=mdl_name)
|
6 |
+
def answer_question(question, context):
|
7 |
+
di = {'question': question, 'context': context}
|
8 |
+
response = my_pipeline(di)
|
9 |
+
return response['answer']
|
|
|
10 |
grad.Interface(answer_question, inputs=["text","text"], outputs="text").launch()
|