Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ dataset = load_dataset('dar-tau/grammar-attention-maps-opt-350m')['train']
|
|
17 |
tokenizer = AutoTokenizer.from_pretrained('facebook/opt-350m', add_prefix_space=True)
|
18 |
|
19 |
|
20 |
-
def analyze_sentence(index, vis_type):
|
21 |
row = dataset[index]
|
22 |
text = row['text']
|
23 |
tokenized = tokenizer.batch_decode(tokenizer.encode(text, add_special_tokens=False))
|
@@ -55,7 +55,8 @@ with demo:
|
|
55 |
btn = gr.Button("Run", min_width=30)
|
56 |
output = gr.Plot(label="Plot", container=True)
|
57 |
metrics = gr.Label("Metrics")
|
58 |
-
|
|
|
59 |
|
60 |
|
61 |
if __name__ == "__main__":
|
|
|
17 |
tokenizer = AutoTokenizer.from_pretrained('facebook/opt-350m', add_prefix_space=True)
|
18 |
|
19 |
|
20 |
+
def analyze_sentence(index, vis_type, vis_format):
|
21 |
row = dataset[index]
|
22 |
text = row['text']
|
23 |
tokenized = tokenizer.batch_decode(tokenizer.encode(text, add_special_tokens=False))
|
|
|
55 |
btn = gr.Button("Run", min_width=30)
|
56 |
output = gr.Plot(label="Plot", container=True)
|
57 |
metrics = gr.Label("Metrics")
|
58 |
+
vis_format_checkbox = gr.Radio(['Plot', 'Graph'])
|
59 |
+
btn.click(analyze_sentence, [sentence_dropdown, vis_dropdown, vis_format_checkbox], [output, metrics])
|
60 |
|
61 |
|
62 |
if __name__ == "__main__":
|