File size: 720 Bytes
14dd37c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import gradio as gr
from transformers import pipeline
title = 'Easy QA with Roberta'
context = "There is a game called Tic Tac Toe where players take turns writing an X or O into a 3x3 grid.  The object of the game is to get three Xs or three Os in a row to win."
question1 = "How do you win tic tac toe?"
question2 = "How many Xs do you need to win?"
question3 = "What is the name of the game?"

model_name = "deepset/roberta-base-squad2"

question_answerer = pipeline("question-answering", model=model_name, tokenizer=model_name)

interface = gr.Interface.from_pipeline(question_answerer,
    title = title,
    theme = "peach",
    examples = [[context, question1],[context, question2],[context, question3]]).launch()