Spaces:
Runtime error
Runtime error
change colors
Browse files
app.py
CHANGED
@@ -44,8 +44,8 @@ def call(sentence, detection_threshold):
|
|
44 |
qasrl_predicates = [pred_info['predicate_idx'] for pred_info in outputs['qasrl']]
|
45 |
qanom_predicates = [pred_info['predicate_idx'] for pred_info in outputs['qanom']]
|
46 |
def color(idx):
|
47 |
-
if idx in qasrl_predicates : return "
|
48 |
-
if idx in qanom_predicates : return "
|
49 |
def word_span(word, idx):
|
50 |
return f'<span style="background-color: {color(idx)}">{word}</span>'
|
51 |
html = '<span>' + ' '.join(word_span(word, idx) for idx, word in enumerate(sentence.split(" "))) + '</span>'
|
|
|
44 |
qasrl_predicates = [pred_info['predicate_idx'] for pred_info in outputs['qasrl']]
|
45 |
qanom_predicates = [pred_info['predicate_idx'] for pred_info in outputs['qanom']]
|
46 |
def color(idx):
|
47 |
+
if idx in qasrl_predicates : return "aquamarine"
|
48 |
+
if idx in qanom_predicates : return "aqua"
|
49 |
def word_span(word, idx):
|
50 |
return f'<span style="background-color: {color(idx)}">{word}</span>'
|
51 |
html = '<span>' + ' '.join(word_span(word, idx) for idx, word in enumerate(sentence.split(" "))) + '</span>'
|