kleinay commited on
Commit
12bbf89
β€’
1 Parent(s): 25f131f
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -53,8 +53,8 @@ def call(sentence, layers, detection_threshold):
53
  pretty_qa_output = "\n".join(all_qas)
54
 
55
  # also present highlighted predicates
56
- qasrl_predicates = [pred_info['predicate_idx'] for pred_info in outputs['qasrl']]
57
- qanom_predicates = [pred_info['predicate_idx'] for pred_info in outputs['qanom']]
58
  def color(idx):
59
  if idx in qasrl_predicates : return "aquamarine"
60
  if idx in qanom_predicates : return "aqua"
 
53
  pretty_qa_output = "\n".join(all_qas)
54
 
55
  # also present highlighted predicates
56
+ qasrl_predicates = [] if 'qasrl' not in outputs else [pred_info['predicate_idx'] for pred_info in outputs['qasrl']]
57
+ qanom_predicates = [] if 'qanom' not in outputs else [pred_info['predicate_idx'] for pred_info in outputs['qanom']]
58
  def color(idx):
59
  if idx in qasrl_predicates : return "aquamarine"
60
  if idx in qanom_predicates : return "aqua"