Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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>'
|