File size: 1,583 Bytes
6fa87dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ab846c8
6fa87dd
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
30
31
32
import gradio as gr

from qbigbird import QBigBird

qbb = QBigBird()


def guess_and_buzz(question):
    return qbb.guess_and_buzz(question)


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='huggingface'
).launch(enable_queue=True)