Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -45,12 +45,11 @@ def analyze_sentence(index, vis_type, vis_format):
|
|
45 |
else:
|
46 |
ex = [{
|
47 |
"words": [{"text": x, "tag": ""} for x in tokenized[1:]],
|
48 |
-
"arcs": [{"start": j, "end": i, "label": "",
|
49 |
-
|
50 |
-
for i in range(len(tokenized)-1) for j in range(i) if plot_data[i, j] > 0.5
|
51 |
]
|
52 |
}]
|
53 |
-
graph_output = displacy.render(ex, style="dep", jupyter=False, manual=True)
|
54 |
graph_output = ("<div style='max-width:100%; max-height:360px; overflow:auto'>"
|
55 |
+ graph_output +
|
56 |
"</div>"
|
|
|
45 |
else:
|
46 |
ex = [{
|
47 |
"words": [{"text": x, "tag": ""} for x in tokenized[1:]],
|
48 |
+
"arcs": [{"start": j, "end": i, "label": "", "dir": "right"}
|
49 |
+
for i in range(len(tokenized) - 1) for j in range(i) if plot_data[i, j] > 0.5
|
|
|
50 |
]
|
51 |
}]
|
52 |
+
graph_output = displacy.render(ex, style="dep", jupyter=False, compact=True, manual=True)
|
53 |
graph_output = ("<div style='max-width:100%; max-height:360px; overflow:auto'>"
|
54 |
+ graph_output +
|
55 |
"</div>"
|