added attention vizualization and qa model
Browse files
app.py
CHANGED
@@ -13,9 +13,9 @@ nltk.download('popular')
|
|
13 |
# Constants
|
14 |
#############################
|
15 |
|
16 |
-
examples = [["What's the meaning of life?", "eli5", "constraint"],
|
17 |
-
["boat, water, bird", "commongen", "constraint"],
|
18 |
-
["What flows under a bridge?", "commonsense_qa", "constraint"]]
|
19 |
|
20 |
commongen_bart = RelationsInference(
|
21 |
model_path='MrVicente/commonsense_bart_commongen',
|
@@ -108,7 +108,7 @@ with app:
|
|
108 |
vis_btn = gr.Button(value="See Attention Scores")
|
109 |
model_btn.click(fn=infer_bart, inputs=[context_input, task_type_choice, decoding_type_choice],
|
110 |
outputs=[model_result_output])
|
111 |
-
vis_btn.click(fn=plot_attention, inputs=[layer, head], outputs=[plot_output])
|
112 |
|
113 |
if __name__ == '__main__':
|
114 |
app.launch()
|
|
|
13 |
# Constants
|
14 |
#############################
|
15 |
|
16 |
+
#examples = [["What's the meaning of life?", "eli5", "constraint"],
|
17 |
+
# ["boat, water, bird", "commongen", "constraint"],
|
18 |
+
# ["What flows under a bridge?", "commonsense_qa", "constraint"]]
|
19 |
|
20 |
commongen_bart = RelationsInference(
|
21 |
model_path='MrVicente/commonsense_bart_commongen',
|
|
|
108 |
vis_btn = gr.Button(value="See Attention Scores")
|
109 |
model_btn.click(fn=infer_bart, inputs=[context_input, task_type_choice, decoding_type_choice],
|
110 |
outputs=[model_result_output])
|
111 |
+
vis_btn.click(fn=plot_attention, inputs=[context_input, task_type_choice, layer, head], outputs=[plot_output])
|
112 |
|
113 |
if __name__ == '__main__':
|
114 |
app.launch()
|