Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,23 +36,25 @@ def app(text, model):
|
|
| 36 |
interface = gr.Interface(
|
| 37 |
fn=app,
|
| 38 |
inputs=[
|
| 39 |
-
gr.Textbox(label="Input Text", placeholder="Enter a sentence
|
| 40 |
gr.Dropdown(
|
| 41 |
-
label="
|
| 42 |
choices=["bert-base-uncased", "distilbert-base-uncased", "roberta-base"],
|
| 43 |
value=DEFAULT_MODEL
|
| 44 |
)
|
| 45 |
],
|
| 46 |
outputs=gr.Plot(label="Attention Map"),
|
| 47 |
-
title="
|
| 48 |
-
description="
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
This tool
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
| 56 |
"""
|
| 57 |
)
|
| 58 |
|
|
|
|
| 36 |
interface = gr.Interface(
|
| 37 |
fn=app,
|
| 38 |
inputs=[
|
| 39 |
+
gr.Textbox(label="Input Text", placeholder="Enter a sentence"),
|
| 40 |
gr.Dropdown(
|
| 41 |
+
label="Model",
|
| 42 |
choices=["bert-base-uncased", "distilbert-base-uncased", "roberta-base"],
|
| 43 |
value=DEFAULT_MODEL
|
| 44 |
)
|
| 45 |
],
|
| 46 |
outputs=gr.Plot(label="Attention Map"),
|
| 47 |
+
title="Transformer Attention Visualizer",
|
| 48 |
+
description="""
|
| 49 |
+
Understand how transformer models interpret text through self-attention.
|
| 50 |
+
|
| 51 |
+
🧠 This tool extracts attention weights from the **last layer** and **first attention head** of popular transformer models.
|
| 52 |
+
|
| 53 |
+
🔍 The attention map shows how each token focuses on others during processing.
|
| 54 |
+
|
| 55 |
+
📚 Try different models and sentences to compare how they handle language and context.
|
| 56 |
+
|
| 57 |
+
Ideal for NLP learners, researchers, and anyone curious about how transformers "pay attention".
|
| 58 |
"""
|
| 59 |
)
|
| 60 |
|