Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,10 @@ from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
|
2 |
import gradio as grad
|
3 |
import ast
|
4 |
mdl_name = "deepset/roberta-base-squad2"
|
5 |
-
my_pipeline = pipeline('question-answering', model=mdl_name,
|
6 |
-
tokenizer=mdl_name)
|
7 |
def answer_question(question,context):
|
8 |
text= "{"+"'question': '"+question+"','context':'"+context+"'}"
|
9 |
di=ast.literal_eval(text)
|
10 |
response = my_pipeline(di)
|
11 |
return response
|
12 |
-
grad.Interface(answer_question, inputs=["text","text"],
|
13 |
-
outputs="text").launch()
|
|
|
2 |
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 |
text= "{"+"'question': '"+question+"','context':'"+context+"'}"
|
8 |
di=ast.literal_eval(text)
|
9 |
response = my_pipeline(di)
|
10 |
return response
|
11 |
+
grad.Interface(answer_question, inputs=["text","text"],outputs="text").launch()
|
|