Spaces:
Runtime error
Runtime error
Benjamin Consolvo
commited on
Commit
·
08009f0
1
Parent(s):
cc29eef
bigger context box
Browse files
app.py
CHANGED
@@ -16,27 +16,29 @@ def predict(context="There are seven continents in the world.",question="How man
|
|
16 |
print(f'predictions={predictions}')
|
17 |
score = predictions['score']
|
18 |
answer = predictions['answer']
|
19 |
-
|
|
|
|
|
20 |
|
21 |
md = """
|
22 |
If you came looking for chatGPT, sorry to disappoint, but this is different. This prediction model is designed to answer a question about a text. It is designed to do reading comprehension. The model does not just answer questions in general -- it only works from the text that you provide. However, accomplishing accurate reading comprehension can be a very valuable task, especially if you are attempting to get quick answers from a large (and maybe boring!) document.
|
23 |
|
|
|
24 |
Training dataset: SQuADv1.1, based on the Rajpurkar et al. (2016) paper: [SQuAD: 100,000+ Questions for Machine Comprehension of Text](https://aclanthology.org/D16-1264/)
|
25 |
|
26 |
-
Based on the Zafrir et al. (2021) paper: [Prune Once for All: Sparse Pre-Trained Language Models](https://arxiv.org/abs/2111.05754) paper.
|
27 |
-
|
28 |
"""
|
29 |
|
30 |
# predict()
|
31 |
-
context=gr.Text(label="Context")
|
32 |
question=gr.Text(label="Question")
|
33 |
score=gr.Text(label="Score")
|
|
|
34 |
answer=gr.Text(label="Answer")
|
35 |
|
36 |
iface = gr.Interface(
|
37 |
fn=predict,
|
38 |
inputs=[context,question],
|
39 |
-
outputs=[score,answer],
|
40 |
title = "Question & Answer with Sparse BERT using the SQuAD dataset",
|
41 |
description = md
|
42 |
)
|
|
|
16 |
print(f'predictions={predictions}')
|
17 |
score = predictions['score']
|
18 |
answer = predictions['answer']
|
19 |
+
start = predictions['start']
|
20 |
+
end = predictions['end']
|
21 |
+
return score,answer,start
|
22 |
|
23 |
md = """
|
24 |
If you came looking for chatGPT, sorry to disappoint, but this is different. This prediction model is designed to answer a question about a text. It is designed to do reading comprehension. The model does not just answer questions in general -- it only works from the text that you provide. However, accomplishing accurate reading comprehension can be a very valuable task, especially if you are attempting to get quick answers from a large (and maybe boring!) document.
|
25 |
|
26 |
+
The model is based on the Zafrir et al. (2021) paper: [Prune Once for All: Sparse Pre-Trained Language Models](https://arxiv.org/abs/2111.05754) paper.
|
27 |
Training dataset: SQuADv1.1, based on the Rajpurkar et al. (2016) paper: [SQuAD: 100,000+ Questions for Machine Comprehension of Text](https://aclanthology.org/D16-1264/)
|
28 |
|
|
|
|
|
29 |
"""
|
30 |
|
31 |
# predict()
|
32 |
+
context=gr.Text(lines=10,label="Context")
|
33 |
question=gr.Text(label="Question")
|
34 |
score=gr.Text(label="Score")
|
35 |
+
start=gr.Text(label="Answer found at character")
|
36 |
answer=gr.Text(label="Answer")
|
37 |
|
38 |
iface = gr.Interface(
|
39 |
fn=predict,
|
40 |
inputs=[context,question],
|
41 |
+
outputs=[score,start,answer],
|
42 |
title = "Question & Answer with Sparse BERT using the SQuAD dataset",
|
43 |
description = md
|
44 |
)
|