Spaces:
Runtime error
Runtime error
import gradio as gr | |
from qbigbird import QBigBird | |
qbb = QBigBird() | |
def guess_and_buzz(question): | |
return qbb.guess_and_buzz(question) | |
import json | |
with open('/Users/yusuf/qbigbird/data/qanta.dev.2018.04.18.json') as f: | |
data = json.load(f) | |
data = data['questions'] | |
idxs = [214, 333] | |
examples = [data[i]['text'] for i in idxs] | |
example = 'The speaker of one poem by this author asks, "Does my haughtiness offend you?" after opening that poem ' \ | |
'with the concession "you may write me down in history / with your bitter, twisted lies." This author insisted ' \ | |
'in another poem that "you, created only a little lower / than the angels, have crouched too long in / ' \ | |
'the bruising darkness." This author of "Still I Rise" opened a third poem with the phrase ' \ | |
'"A Rock, A River, A Tree" and recorded that she stopped speaking for years after her mother\'s ' \ | |
'boyfriend raped her when she was eight. For 10 points, name this poet who read "On the Pulse of Morning" ' \ | |
'at Bill Clinton\'s inauguration and also wrote the autobiography I Know Why the Caged Bird Sings.' | |
interface = gr.Interface( | |
fn=guess_and_buzz, | |
inputs=gr.inputs.Textbox(lines=10, placeholder="Enter Quiz Bowl question..."), | |
outputs=[gr.outputs.Textbox(label="guess"), gr.outputs.Textbox(label="buzz")], | |
title="Quiz Bowl QA", | |
examples=[[example]], | |
description='''Open-Domain Question Answering model for Quiz Bowl questions using custom feature extraction and | |
Wikipedia as the Information Retrieval system and ELECTRA as the Question Answering model. Given | |
a question, the model outputs its guess and whether it would buzz in with that guess or not.''', | |
theme='grass' | |
).launch(enable_queue=True) | |