Spaces:
Runtime error
Runtime error
Benjamin Consolvo
commited on
Commit
·
debe187
1
Parent(s):
6da417a
no interface for now
Browse files
app.py
CHANGED
@@ -6,27 +6,29 @@ qa_pipeline = pipeline(task="question-answering",model="Intel/bert-base-uncased-
|
|
6 |
def greet(name):
|
7 |
return "Hello " + name + "!!"
|
8 |
|
9 |
-
def predict(question,context):
|
10 |
|
11 |
-
predictions = qa_pipeline(context=context
|
|
|
12 |
return predictions
|
13 |
|
14 |
md = """
|
15 |
-
|
16 |
|
17 |
-
|
|
|
|
|
18 |
|
19 |
"""
|
20 |
|
21 |
-
|
22 |
-
question = "Which continent is the Amazon rainforest in?"
|
23 |
|
24 |
-
iface = gr.Interface(
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
|
32 |
-
iface.launch()
|
|
|
6 |
def greet(name):
|
7 |
return "Hello " + name + "!!"
|
8 |
|
9 |
+
def predict(question="How many continents are there in the world?",context="There are seven continents in the world."):
|
10 |
|
11 |
+
predictions = qa_pipeline(question=question,context=context)
|
12 |
+
print(f'predictions={predictions}')
|
13 |
return predictions
|
14 |
|
15 |
md = """
|
16 |
+
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.
|
17 |
|
18 |
+
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/)
|
19 |
+
|
20 |
+
Based on the Zafrir et al. (2021) paper: [Prune Once for All: Sparse Pre-Trained Language Models](https://arxiv.org/abs/2111.05754) paper.
|
21 |
|
22 |
"""
|
23 |
|
24 |
+
predict()
|
|
|
25 |
|
26 |
+
# iface = gr.Interface(
|
27 |
+
# fn=predict,
|
28 |
+
# inputs="Input your question.",
|
29 |
+
# outputs="text",
|
30 |
+
# title = "Question & Answer with Sparse BERT using the SQuAD dataset",
|
31 |
+
# description = md
|
32 |
+
# )
|
33 |
|
34 |
+
# iface.launch()
|