Benjamin Consolvo commited on
Commit
debe187
1 Parent(s): 6da417a

no interface for now

Browse files
Files changed (1) hide show
  1. app.py +16 -14
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,question=question)
 
12
  return predictions
13
 
14
  md = """
15
- App coming soon!
16
 
17
- Based on the [Prune Once for All: Sparse Pre-Trained Language Models](https://arxiv.org/abs/2111.05754) paper.
 
 
18
 
19
  """
20
 
21
- context = "The Amazon rainforest, also known in English as Amazonia or the Amazon Jungle, is a moist broadleaf forest that covers most of the Amazon basin of South America. This basin encompasses 7,000,000 square kilometres (2,700,000 sq mi), of which 5,500,000 square kilometres (2,100,000 sq mi) are covered by the rainforest. This region includes territory belonging to nine nations. The majority of the forest is contained within Brazil, with 60% of the rainforest, followed by Peru with 13%, Colombia with 10%, and with minor amounts in Venezuela, Ecuador, Bolivia, Guyana, Suriname and French Guiana. The Amazon represents over half of the planet's remaining rainforests, and comprises the largest and most biodiverse tract of tropical rainforest in the world, with an estimated 390 billion individual trees divided into 16,000 species."
22
- question = "Which continent is the Amazon rainforest in?"
23
 
24
- iface = gr.Interface(
25
- fn=predict,
26
- inputs=[gr.inputs.Textbox(lines=5, default=context, label="Context Paragraph"), gr.inputs.Textbox(lines=2, default=question, label="Question")],
27
- outputs=[gr.outputs.Textbox(label="Answer"), gr.outputs.Textbox(label="Score")],
28
- title = "Question & Answer with Sparse BERT using the SQuAD dataset",
29
- description = md
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()