dar-tau commited on
Commit
ca37660
1 Parent(s): 3f2619b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -65,6 +65,8 @@ def analyze_sentence(index, vis_type, vis_format):
65
  top_values, top_indices = torch.tensor(plot_data).flatten().topk(30)
66
  topk_data = []
67
  for val, ind in zip(top_values, top_indices):
 
 
68
  ind = np.unravel_index(ind, plot_data.shape)
69
  topk_data += [str((tokenized[1+ind[0]], tokenized[1+ind[1]]))]
70
  graph_output = '<div><b>' + text + '</b><br/>' + '<br/>'.join(topk_data) + '</div>'
 
65
  top_values, top_indices = torch.tensor(plot_data).flatten().topk(30)
66
  topk_data = []
67
  for val, ind in zip(top_values, top_indices):
68
+ if val < 0.5:
69
+ break
70
  ind = np.unravel_index(ind, plot_data.shape)
71
  topk_data += [str((tokenized[1+ind[0]], tokenized[1+ind[1]]))]
72
  graph_output = '<div><b>' + text + '</b><br/>' + '<br/>'.join(topk_data) + '</div>'