-
Notifications
You must be signed in to change notification settings - Fork 4
/
flask_app.py
99 lines (83 loc) · 3.57 KB
/
flask_app.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import os
from flask import Flask, render_template, url_for
import json
app = Flask(__name__)
language_to_flag = {
"Dutch" : '<span class="flag-icon flag-icon-nl"></span>',
"French" : '<span class="flag-icon flag-icon-fr"></span>',
"German" : '<span class="flag-icon flag-icon-de"></span>',
"Chinese" : '<span class="flag-icon flag-icon-cn"></span>',
"Japanese" : '<span class="flag-icon flag-icon-jp"></span>',
"Italian" : '<span class="flag-icon flag-icon-it"></span>',
"Russian" : '<span class="flag-icon flag-icon-ru"></span>',
"Finnish" : '<span class="flag-icon flag-icon-fi"></span>',
"Turkish" : '<span class="flag-icon flag-icon-tr"></span>',
"Arabic" : '<span class="flag-icon flag-icon-sa"></span>',
"Spanish" : '<span class="flag-icon flag-icon-es"></span>',
"English" : '<span class="flag-icon flag-icon-us"></span>',
"Portuguese" : '<span class="flag-icon flag-icon-br"></span>',
"Mongolian" : '<span class="flag-icon flag-icon-mn"></span>',
"Korean" : '<span class="flag-icon flag-icon-kr"></span>',
"Thai" : '<span class="flag-icon flag-icon-th"></span>',
"Yorùbá" : '<span class="flag-icon flag-icon-ng"></span>',
"Philipino": '<span class="flag-icon flag-icon-ph"></span>'
}
acronyms = {
"POS": "Part of Speech Tagging",
"DP": "Dependency Parsing",
"NER": "Named Entity Recognition",
"NLI": "Natural Language Inference",
"PP": "Paraphrase",
"WSD": "Word Sense Disambiguation" ,
"TC": "Text Classification" ,
"CP": "Constituency Parsing" ,
"SA": "Sentiment Analysis",
"SRL": "Semantic Role Labeling",
"STR": "Spatio-Temporal Relation",
"LPR": "Linguistic Properties Recognition",
"OLI": "Offensive Language Identification",
"BPE" :"Byte Pair Encoding",
"DP-UAS": "Unlabeled Attachment Score" ,
"DP-LAS": "Labeled Attachment Score",
"VSD" : "Verb Sense Disambiguation",
"NSD" : "Noun Sense Disambiguation",
"SC" : "Subjectivity Classification",
"ID" : "Irony Detection",
"DDD" : "Die/Dat Disambiguation",
"MRC" : "Machine Reading Comprehension",
"SPM" : "Sentence Pair Matching",
"POS (C)" : "Part of Speech Tagging (Coarse)",
"POS (FG)" : "Part of Speech Tagging (Fine Grained)",
"LA" : "Linguistic Acceptability",
"TER" :"Textual Entailment Recognition",
"QA" : "Question Answering",
"CI" : "Commonsense Inference",
"RC" : "Reading Comprehension"
}
@app.route("/")
def index():
with open('static/data/data_example.json') as json_file:
json_data = json.load(json_file)
number_of_models = list(map(lambda x: x["name"], json_data))
number_of_models = len(set(number_of_models))
number_of_languages = list(map(lambda x: x["language"], json_data))
number_of_languages = len(set(number_of_languages))
tasks = []
entries = 0
for model in json_data:
for task in model["tasks"]:
entries = entries+1
tasks.append(task["name"])
number_of_tasks = len(set(tasks))
stats = {"number_of_models" : number_of_models,
"number_of_languages" : number_of_languages,
"number_of_tasks" : number_of_tasks,
"number_of_entries" : entries}
number_of_models = list(map(lambda x: x["name"], json_data))
number_of_models = len(set(number_of_models))
return render_template("./index.html", json_data=json_data, lang_to_flag = language_to_flag, acronyms=acronyms, stats=stats)
@app.route("/about")
def about():
return render_template("./about.html")
if __name__ == "__main__":
app.run(host='0.0.0.0', port=8000)