qa_sparse_bert / app.py
Benjamin Consolvo
testing prediction
b8db52d
raw
history blame
643 Bytes
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()