Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
title = 'Easy QA with Roberta'
|
4 |
+
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."
|
5 |
+
question1 = "How do you win tic tac toe?"
|
6 |
+
question2 = "How many Xs do you need to win?"
|
7 |
+
question3 = "What is the name of the game?"
|
8 |
+
|
9 |
+
model_name = "deepset/roberta-base-squad2"
|
10 |
+
|
11 |
+
question_answerer = pipeline("question-answering", model=model_name, tokenizer=model_name)
|
12 |
+
|
13 |
+
interface = gr.Interface.from_pipeline(question_answerer,
|
14 |
+
title = title,
|
15 |
+
theme = "peach",
|
16 |
+
examples = [[context, question1],[context, question2],[context, question3]]).launch()
|