Benjamin Consolvo commited on
Commit
b8db52d
1 Parent(s): 8cea305

testing prediction

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -1,8 +1,15 @@
1
  import gradio as gr
 
 
 
2
 
3
  def greet(name):
4
  return "Hello " + name + "!!"
5
 
 
 
 
 
6
  md = """
7
  App coming soon!
8
 
@@ -11,10 +18,11 @@ Based on the [Prune Once for All: Sparse Pre-Trained Language Models](https://ar
11
  """
12
 
13
  iface = gr.Interface(
14
- fn=greet,
15
  inputs="text",
16
  outputs="text",
17
  title = "Question & Answer with Sparse BERT using the SQuAD dataset",
18
  description = md
19
  )
 
20
  iface.launch()
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipeline = pipeline(task="question-answering",model="Intel/bert-base-uncased-squadv1.1-sparse-80-1x4-block-pruneofa")
5
 
6
  def greet(name):
7
  return "Hello " + name + "!!"
8
 
9
+ def predict(text):
10
+ predictions = pipeline(text)
11
+ return predictions
12
+
13
  md = """
14
  App coming soon!
15
 
 
18
  """
19
 
20
  iface = gr.Interface(
21
+ fn=predict,
22
  inputs="text",
23
  outputs="text",
24
  title = "Question & Answer with Sparse BERT using the SQuAD dataset",
25
  description = md
26
  )
27
+
28
  iface.launch()