Spaces:
Sleeping
Sleeping
Allow to put context as well
Browse files
app.py
CHANGED
@@ -8,7 +8,8 @@ onnx_qa = pipeline("question-answering", model=model, tokenizer=tokenizer)
|
|
8 |
|
9 |
# question = "What's my name??"
|
10 |
# context = "My name is Philipp and I live in Nuremberg."
|
11 |
-
def get_answer(question):
|
|
|
12 |
pred = onnx_qa(question, context)['answer']
|
13 |
return pred
|
14 |
|
@@ -21,7 +22,7 @@ with demo:
|
|
21 |
question = gr.Textbox(label='Question', lines= 3)
|
22 |
b1 = gr.Button('Get Answer')
|
23 |
answer = gr.Textbox(label='Answer', lines=4)
|
24 |
-
b1.click(fn = get_answer, inputs=question, outputs=answer)
|
25 |
|
26 |
demo.launch()
|
27 |
|
|
|
8 |
|
9 |
# question = "What's my name??"
|
10 |
# context = "My name is Philipp and I live in Nuremberg."
|
11 |
+
def get_answer(question, context):
|
12 |
+
# question, context = inputs
|
13 |
pred = onnx_qa(question, context)['answer']
|
14 |
return pred
|
15 |
|
|
|
22 |
question = gr.Textbox(label='Question', lines= 3)
|
23 |
b1 = gr.Button('Get Answer')
|
24 |
answer = gr.Textbox(label='Answer', lines=4)
|
25 |
+
b1.click(fn = get_answer, inputs=[question,context], outputs=answer)
|
26 |
|
27 |
demo.launch()
|
28 |
|