yu3ufff commited on
Commit
6fa87dd
1 Parent(s): 7bed1aa

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -0
app.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from qbigbird import QBigBird
4
+
5
+ qbb = QBigBird()
6
+
7
+
8
+ def guess_and_buzz(question):
9
+ return qbb.guess_and_buzz(question)
10
+
11
+
12
+ import json
13
+ with open('/Users/yusuf/qbigbird/data/qanta.dev.2018.04.18.json') as f:
14
+ data = json.load(f)
15
+ data = data['questions']
16
+
17
+ idxs = [214, 333]
18
+ examples = [data[i]['text'] for i in idxs]
19
+
20
+ example = 'The speaker of one poem by this author asks, "Does my haughtiness offend you?" after opening that poem ' \
21
+ 'with the concession "you may write me down in history / with your bitter, twisted lies." This author insisted ' \
22
+ 'in another poem that "you, created only a little lower / than the angels, have crouched too long in / ' \
23
+ 'the bruising darkness." This author of "Still I Rise" opened a third poem with the phrase ' \
24
+ '"A Rock, A River, A Tree" and recorded that she stopped speaking for years after her mother\'s ' \
25
+ 'boyfriend raped her when she was eight. For 10 points, name this poet who read "On the Pulse of Morning" ' \
26
+ 'at Bill Clinton\'s inauguration and also wrote the autobiography I Know Why the Caged Bird Sings.'
27
+
28
+
29
+ interface = gr.Interface(
30
+ fn=guess_and_buzz,
31
+ inputs=gr.inputs.Textbox(lines=10, placeholder="Enter Quiz Bowl question..."),
32
+ outputs=[gr.outputs.Textbox(label="guess"), gr.outputs.Textbox(label="buzz")],
33
+ title="Quiz Bowl QA",
34
+ examples=[[example]],
35
+ description='''Open-Domain Question Answering model for Quiz Bowl questions using custom feature extraction and
36
+ Wikipedia as the Information Retrieval system and ELECTRA as the Question Answering model. Given
37
+ a question, the model outputs its guess and whether it would buzz in with that guess or not.''',
38
+ theme='grass'
39
+ ).launch(enable_queue=True)