Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ def analyze_sentence(index, vis_type):
|
|
26 |
if vis_type == VisType.ALL:
|
27 |
plot_data = attn_maps.sum(0)
|
28 |
else:
|
29 |
-
print(
|
30 |
0/0
|
31 |
sns.heatmap(plot_data)
|
32 |
plt.xticks(np.arange(seq_len - 1) + 0.5, tokenized[1:], rotation=90);
|
@@ -44,8 +44,8 @@ with demo:
|
|
44 |
choices=[x.split('</s> ')[1] for x in dataset['text']],
|
45 |
value=0, min_width=500, type='index')
|
46 |
vis_dropdown = gr.Dropdown(label="Visualization", choices=list(VisType),
|
47 |
-
min_width=
|
48 |
-
btn = gr.Button("Run", min_width=
|
49 |
output = gr.Plot(label="Plot", container=True)
|
50 |
metrics = gr.Label("Metrics")
|
51 |
btn.click(analyze_sentence, [sentence_dropdown, vis_dropdown], [output, metrics])
|
|
|
26 |
if vis_type == VisType.ALL:
|
27 |
plot_data = attn_maps.sum(0)
|
28 |
else:
|
29 |
+
print(vis_type)
|
30 |
0/0
|
31 |
sns.heatmap(plot_data)
|
32 |
plt.xticks(np.arange(seq_len - 1) + 0.5, tokenized[1:], rotation=90);
|
|
|
44 |
choices=[x.split('</s> ')[1] for x in dataset['text']],
|
45 |
value=0, min_width=500, type='index')
|
46 |
vis_dropdown = gr.Dropdown(label="Visualization", choices=list(VisType),
|
47 |
+
min_width=150, value=VisType.ALL, type='value')
|
48 |
+
btn = gr.Button("Run", min_width=30)
|
49 |
output = gr.Plot(label="Plot", container=True)
|
50 |
metrics = gr.Label("Metrics")
|
51 |
btn.click(analyze_sentence, [sentence_dropdown, vis_dropdown], [output, metrics])
|