File size: 643 Bytes
2a2c864
b8db52d
 
 
2a2c864
 
 
 
b8db52d
 
 
 
8cea305
 
 
 
 
 
 
 
b8db52d
8cea305
 
 
 
 
b8db52d
2a2c864
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gradio as gr
from transformers import pipeline

pipeline = pipeline(task="question-answering",model="Intel/bert-base-uncased-squadv1.1-sparse-80-1x4-block-pruneofa")

def greet(name):
    return "Hello " + name + "!!"

def predict(text):
    predictions = pipeline(text)
    return predictions

md = """
App coming soon! 

Based on the [Prune Once for All: Sparse Pre-Trained Language Models](https://arxiv.org/abs/2111.05754) paper.

"""

iface = gr.Interface(
    fn=predict, 
    inputs="text", 
    outputs="text",
    title = "Question & Answer with Sparse BERT using the SQuAD dataset",
    description = md
    )

iface.launch()