Update app.py
Browse files
app.py
CHANGED
|
@@ -56,62 +56,65 @@ description = """
|
|
| 56 |
</div>
|
| 57 |
"""
|
| 58 |
|
| 59 |
-
text = """1
|
| 60 |
-
2
|
| 61 |
-
3
|
| 62 |
-
4
|
| 63 |
-
5
|
| 64 |
-
6
|
| 65 |
-
7
|
| 66 |
-
8
|
| 67 |
-
9
|
| 68 |
-
10
|
| 69 |
-
11
|
| 70 |
-
12
|
| 71 |
-
13
|
| 72 |
-
14
|
| 73 |
-
15
|
| 74 |
-
16
|
| 75 |
-
17
|
| 76 |
-
18
|
| 77 |
-
19
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
forms = [
|
| 80 |
line.split("\t")[1]
|
| 81 |
for line in text.split("\n")
|
| 82 |
if line and not line.startswith("#")
|
| 83 |
]
|
| 84 |
-
|
| 85 |
lemmas = [
|
| 86 |
line.split("\t")[2]
|
| 87 |
for line in text.split("\n")
|
| 88 |
if line and not line.startswith("#")
|
| 89 |
]
|
| 90 |
-
|
| 91 |
upos = [
|
| 92 |
line.split("\t")[3]
|
| 93 |
for line in text.split("\n")
|
| 94 |
if line and not line.startswith("#")
|
| 95 |
]
|
| 96 |
-
|
| 97 |
xpos = [
|
| 98 |
line.split("\t")[4]
|
| 99 |
for line in text.split("\n")
|
| 100 |
if line and not line.startswith("#")
|
| 101 |
]
|
| 102 |
-
|
| 103 |
feats = [
|
| 104 |
line.split("\t")[5]
|
| 105 |
for line in text.split("\n")
|
| 106 |
if line and not line.startswith("#")
|
| 107 |
]
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
line.split("\t")[9]
|
| 111 |
for line in text.split("\n")
|
| 112 |
if line and not line.startswith("#")
|
| 113 |
]
|
| 114 |
-
|
| 115 |
edges = [
|
| 116 |
int(line.split("\t")[6])
|
| 117 |
for line in text.split("\n")
|
|
@@ -177,7 +180,7 @@ with gr.Blocks(theme='sudeepshouche/minimalist', css=custom_css) as demo:
|
|
| 177 |
]
|
| 178 |
)
|
| 179 |
|
| 180 |
-
table = gr.DataFrame(**render_table(forms, lemmas, upos, xpos, feats,
|
| 181 |
dependency_plot = gr.Plot(render_dependency_tree(forms, edges, edge_labels), container=False)
|
| 182 |
|
| 183 |
source.submit(
|
|
|
|
| 56 |
</div>
|
| 57 |
"""
|
| 58 |
|
| 59 |
+
text = """1 Forretten forrett NOUN _ Definite=Def|Gender=Masc|Number=Sing 2 nsubj _ name=O
|
| 60 |
+
2 lyder lyde VERB _ Mood=Ind|Tense=Pres|VerbForm=Fin 0 root _ name=O
|
| 61 |
+
3 navnet navn NOUN _ Definite=Def|Gender=Neut|Number=Sing 5 nmod _ name=O
|
| 62 |
+
4 " $" PUNCT _ _ 5 punct _ SpaceAfter=No|name=O
|
| 63 |
+
5 Coquilles Coquilles PROPN _ _ 2 obj _ name=B-PROD
|
| 64 |
+
6 St. St. PROPN _ _ 5 flat:name _ name=I-PROD
|
| 65 |
+
7 Jacques Jacques PROPN _ _ 5 flat:name _ name=I-PROD
|
| 66 |
+
8 Prince Prince PROPN _ _ 5 flat:name _ name=I-PROD
|
| 67 |
+
9 de de X _ _ 5 flat:name _ name=I-PROD
|
| 68 |
+
10 Norvege Norvege PROPN _ _ 5 flat:name _ SpaceAfter=No|name=I-PROD
|
| 69 |
+
11 " $" PUNCT _ _ 5 punct _ SpaceAfter=No|name=O
|
| 70 |
+
12 , $, PUNCT _ _ 5 punct _ name=O
|
| 71 |
+
13 som som PRON _ PronType=Rel 16 nsubj _ name=O
|
| 72 |
+
14 er være AUX _ Mood=Ind|Tense=Pres|VerbForm=Fin 16 cop _ name=O
|
| 73 |
+
15 grillet grille ADJ _ Definite=Ind|Gender=Neut|Number=Sing|VerbForm=Part 16 amod _ name=O
|
| 74 |
+
16 kamskjell kamskjell NOUN _ Definite=Ind|Gender=Neut|Number=Sing 5 acl:relcl _ name=O
|
| 75 |
+
17 på på ADP _ _ 19 case _ name=O
|
| 76 |
+
18 norsk norsk ADJ _ Definite=Ind|Degree=Pos|Number=Sing 19 amod _ name=O
|
| 77 |
+
19 spekeskinke spekeskinke NOUN _ Definite=Ind|Gender=Fem|Number=Sing 16 nmod _ name=O
|
| 78 |
+
20 - $- PUNCT _ _ 16 punct _ name=O
|
| 79 |
+
21 med med ADP _ _ 22 case _ name=O
|
| 80 |
+
22 trøffelhonningvinaigrette trøffelhonningvinaigrette NOUN _ Definite=Ind|Gender=Masc|Number=Sing 16 nmod _ SpaceAfter=No|name=O
|
| 81 |
+
23 , $, PUNCT _ _ 22 punct _ name=O
|
| 82 |
+
24 ruccolasalat ruccolasalat NOUN _ Definite=Ind|Gender=Masc|Number=Sing 22 conj _ name=O
|
| 83 |
+
25 og og CCONJ _ _ 27 cc _ name=O
|
| 84 |
+
26 ristede riste ADJ _ Number=Plur|VerbForm=Part 27 amod _ name=O
|
| 85 |
+
27 gresskarkjerner gresskarkjerne NOUN _ Definite=Ind|Gender=Fem|Number=Plur 22 conj _ SpaceAfter=No|name=O
|
| 86 |
+
28 . $. PUNCT _ _ 2 punct _ name=O"""
|
| 87 |
|
| 88 |
forms = [
|
| 89 |
line.split("\t")[1]
|
| 90 |
for line in text.split("\n")
|
| 91 |
if line and not line.startswith("#")
|
| 92 |
]
|
|
|
|
| 93 |
lemmas = [
|
| 94 |
line.split("\t")[2]
|
| 95 |
for line in text.split("\n")
|
| 96 |
if line and not line.startswith("#")
|
| 97 |
]
|
|
|
|
| 98 |
upos = [
|
| 99 |
line.split("\t")[3]
|
| 100 |
for line in text.split("\n")
|
| 101 |
if line and not line.startswith("#")
|
| 102 |
]
|
|
|
|
| 103 |
xpos = [
|
| 104 |
line.split("\t")[4]
|
| 105 |
for line in text.split("\n")
|
| 106 |
if line and not line.startswith("#")
|
| 107 |
]
|
|
|
|
| 108 |
feats = [
|
| 109 |
line.split("\t")[5]
|
| 110 |
for line in text.split("\n")
|
| 111 |
if line and not line.startswith("#")
|
| 112 |
]
|
| 113 |
+
ne = [
|
| 114 |
+
line.split("\t")[9].split('|')[-1]
|
|
|
|
| 115 |
for line in text.split("\n")
|
| 116 |
if line and not line.startswith("#")
|
| 117 |
]
|
|
|
|
| 118 |
edges = [
|
| 119 |
int(line.split("\t")[6])
|
| 120 |
for line in text.split("\n")
|
|
|
|
| 180 |
]
|
| 181 |
)
|
| 182 |
|
| 183 |
+
table = gr.DataFrame(**render_table(forms, lemmas, upos, xpos, feats, ne), interactive=False, datatype="markdown")
|
| 184 |
dependency_plot = gr.Plot(render_dependency_tree(forms, edges, edge_labels), container=False)
|
| 185 |
|
| 186 |
source.submit(
|