cooelf commited on
Commit
69bccc2
1 Parent(s): 1561361

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -183,12 +183,14 @@ def inference(context, question, reference):
183
  final_answer = nbest[0]["text"]
184
  return final_answer
185
 
186
- demo = gr.Interface(
187
- fn=inference,
188
- inputs=[gr.inputs.Textbox(label="Context"),
189
- gr.inputs.Textbox(label="Question"),
190
- gr.inputs.Textbox(label="Reference Answer (Optional)")],
191
- outputs=gr.outputs.Textbox(label="Output Answer"),
 
 
192
  examples = [
193
  ["The Norman dynasty had a major political, cultural and military impact on medieval Europe and even the Near East. The Normans were famed for their martial spirit and eventually for their Christian piety, becoming exponents of the Catholic orthodoxy into which they assimilated. They adopted the Gallo-Romance language of the Frankish land they settled, their dialect becoming known as Norman, Normaund or Norman French, an important literary language. The Duchy of Normandy, which they formed by treaty with the French crown, was a great fief of medieval France, and under Richard I of Normandy was forged into a cohesive and formidable principality in feudal tenure. The Normans are noted both for their culture, such as their unique Romanesque architecture and musical traditions, and for their significant military accomplishments and innovations. Norman adventurers founded the Kingdom of Sicily under Roger II after conquering southern Italy on the Saracens and Byzantines, and an expedition on behalf of their duke, William the Conqueror, led to the Norman conquest of England at the Battle of Hastings in 1066. Norman cultural and military influence spread from these new European centres to the Crusader states of the Near East, where their prince Bohemond I founded the Principality of Antioch in the Levant, to Scotland and Wales in Great Britain, to Ireland, and to the coasts of north Africa and the Canary Islands.", "Who was the duke in the battle of Hastings?", "William the Conqueror"],
194
  ["The Norman dynasty had a major political, cultural and military impact on medieval Europe and even the Near East. The Normans were famed for their martial spirit and eventually for their Christian piety, becoming exponents of the Catholic orthodoxy into which they assimilated. They adopted the Gallo-Romance language of the Frankish land they settled, their dialect becoming known as Norman, Normaund or Norman French, an important literary language. The Duchy of Normandy, which they formed by treaty with the French crown, was a great fief of medieval France, and under Richard I of Normandy was forged into a cohesive and formidable principality in feudal tenure. The Normans are noted both for their culture, such as their unique Romanesque architecture and musical traditions, and for their significant military accomplishments and innovations. Norman adventurers founded the Kingdom of Sicily under Roger II after conquering southern Italy on the Saracens and Byzantines, and an expedition on behalf of their duke, William the Conqueror, led to the Norman conquest of England at the Battle of Hastings in 1066. Norman cultural and military influence spread from these new European centres to the Crusader states of the Near East, where their prince Bohemond I founded the Principality of Antioch in the Levant, to Scotland and Wales in Great Britain, to Ireland, and to the coasts of north Africa and the Canary Islands.", "What type of major impact did the Norman dynasty have on modern Europe?", "<No Answer>"],
@@ -197,6 +199,6 @@ demo = gr.Interface(
197
  ],
198
  title="Retrospective Reader for Machine Reading Comprehension",
199
  description=("<div style='text-align: center; margin: 0 auto;'>The model achieved the best performance at the SQuAD2.0 leaderboard. See more details at: <a href='https://aaai.org/papers/14506-retrospective-reader-for-machine-reading-comprehension/'>Paper</a> and <a href='https://github.com/cooelf/AwesomeMRC'>GitHub</a></div>"),
200
- )
201
 
202
- demo.launch(debug=True)
 
 
183
  final_answer = nbest[0]["text"]
184
  return final_answer
185
 
186
+ with gr.Blocks(theme="bethecloud/storj_theme") as demo:
187
+ with gr.Row():
188
+ with gr.Column(scale=1):
189
+ context = gr.inputs.Textbox(label="Context")
190
+ with gr.Column():
191
+ question = gr.inputs.Textbox(label="Question"),
192
+ reference = gr.inputs.Textbox(label="Reference Answer (Optional)")
193
+ outputs = gr.outputs.Textbox(label="Output Answer")
194
  examples = [
195
  ["The Norman dynasty had a major political, cultural and military impact on medieval Europe and even the Near East. The Normans were famed for their martial spirit and eventually for their Christian piety, becoming exponents of the Catholic orthodoxy into which they assimilated. They adopted the Gallo-Romance language of the Frankish land they settled, their dialect becoming known as Norman, Normaund or Norman French, an important literary language. The Duchy of Normandy, which they formed by treaty with the French crown, was a great fief of medieval France, and under Richard I of Normandy was forged into a cohesive and formidable principality in feudal tenure. The Normans are noted both for their culture, such as their unique Romanesque architecture and musical traditions, and for their significant military accomplishments and innovations. Norman adventurers founded the Kingdom of Sicily under Roger II after conquering southern Italy on the Saracens and Byzantines, and an expedition on behalf of their duke, William the Conqueror, led to the Norman conquest of England at the Battle of Hastings in 1066. Norman cultural and military influence spread from these new European centres to the Crusader states of the Near East, where their prince Bohemond I founded the Principality of Antioch in the Levant, to Scotland and Wales in Great Britain, to Ireland, and to the coasts of north Africa and the Canary Islands.", "Who was the duke in the battle of Hastings?", "William the Conqueror"],
196
  ["The Norman dynasty had a major political, cultural and military impact on medieval Europe and even the Near East. The Normans were famed for their martial spirit and eventually for their Christian piety, becoming exponents of the Catholic orthodoxy into which they assimilated. They adopted the Gallo-Romance language of the Frankish land they settled, their dialect becoming known as Norman, Normaund or Norman French, an important literary language. The Duchy of Normandy, which they formed by treaty with the French crown, was a great fief of medieval France, and under Richard I of Normandy was forged into a cohesive and formidable principality in feudal tenure. The Normans are noted both for their culture, such as their unique Romanesque architecture and musical traditions, and for their significant military accomplishments and innovations. Norman adventurers founded the Kingdom of Sicily under Roger II after conquering southern Italy on the Saracens and Byzantines, and an expedition on behalf of their duke, William the Conqueror, led to the Norman conquest of England at the Battle of Hastings in 1066. Norman cultural and military influence spread from these new European centres to the Crusader states of the Near East, where their prince Bohemond I founded the Principality of Antioch in the Levant, to Scotland and Wales in Great Britain, to Ireland, and to the coasts of north Africa and the Canary Islands.", "What type of major impact did the Norman dynasty have on modern Europe?", "<No Answer>"],
 
199
  ],
200
  title="Retrospective Reader for Machine Reading Comprehension",
201
  description=("<div style='text-align: center; margin: 0 auto;'>The model achieved the best performance at the SQuAD2.0 leaderboard. See more details at: <a href='https://aaai.org/papers/14506-retrospective-reader-for-machine-reading-comprehension/'>Paper</a> and <a href='https://github.com/cooelf/AwesomeMRC'>GitHub</a></div>"),
 
202
 
203
+ demo.queue()
204
+ demo.launch()