Spaces:
Running
Running
Commit ·
78bb537
1
Parent(s): d2086cb
Replace edge hover info with tooltip bubbles on visualization
Browse files- app.py +0 -16
- todo.md +5 -1
- utils/__pycache__/__init__.cpython-311.pyc +0 -0
- utils/model_patterns.py +1 -0
app.py
CHANGED
|
@@ -617,21 +617,5 @@ def show_layer_analysis(node_data, activation_data):
|
|
| 617 |
except Exception as e:
|
| 618 |
return html.P(f"Error loading analysis: {str(e)}", className="placeholder-text")
|
| 619 |
|
| 620 |
-
# Edge hover callback for token information
|
| 621 |
-
@app.callback(
|
| 622 |
-
Output('model-status', 'children'),
|
| 623 |
-
[Input('model-flow-graph', 'mouseoverEdgeData')]
|
| 624 |
-
)
|
| 625 |
-
def show_edge_info(hover_data):
|
| 626 |
-
"""Show token and probability info when hovering over edges."""
|
| 627 |
-
if hover_data and 'token' in hover_data:
|
| 628 |
-
token = hover_data['token']
|
| 629 |
-
prob = hover_data['probability']
|
| 630 |
-
return html.Div([
|
| 631 |
-
html.Span(f"Token: {token} | Probability: {prob:.3f}",
|
| 632 |
-
style={'font-size': '14px', 'color': '#495057'})
|
| 633 |
-
])
|
| 634 |
-
return None
|
| 635 |
-
|
| 636 |
if __name__ == '__main__':
|
| 637 |
app.run(debug=True, port=8050)
|
|
|
|
| 617 |
except Exception as e:
|
| 618 |
return html.P(f"Error loading analysis: {str(e)}", className="placeholder-text")
|
| 619 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 620 |
if __name__ == '__main__':
|
| 621 |
app.run(debug=True, port=8050)
|
todo.md
CHANGED
|
@@ -84,4 +84,8 @@ Steps:
|
|
| 84 |
[x] 3. Update run_analysis callback to NOT compute head categorization automatically
|
| 85 |
[x] 4. Update node click callback to compute layer-specific categorization and show in Analysis Results
|
| 86 |
[x] 5. Add categorize_single_layer_heads to utils/__init__.py exports
|
| 87 |
-
[ ] 6. Test: Click node, verify categorization appears in Analysis Results section
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
[x] 3. Update run_analysis callback to NOT compute head categorization automatically
|
| 85 |
[x] 4. Update node click callback to compute layer-specific categorization and show in Analysis Results
|
| 86 |
[x] 5. Add categorize_single_layer_heads to utils/__init__.py exports
|
| 87 |
+
[ ] 6. Test: Click node, verify categorization appears in Analysis Results section
|
| 88 |
+
|
| 89 |
+
## Feature Updates:
|
| 90 |
+
[x] Replace edge hover info (displayed above visualization) with tooltip bubbles on edges
|
| 91 |
+
✅ Update complete!
|
utils/__pycache__/__init__.cpython-311.pyc
CHANGED
|
Binary files a/utils/__pycache__/__init__.cpython-311.pyc and b/utils/__pycache__/__init__.cpython-311.pyc differ
|
|
|
utils/model_patterns.py
CHANGED
|
@@ -419,6 +419,7 @@ def _create_edge(src_layer: int, tgt_layer: int, token: str, prob: float, rank:
|
|
| 419 |
'target': f'layer_{tgt_layer}' if isinstance(tgt_layer, int) else tgt_layer,
|
| 420 |
'token': token,
|
| 421 |
'probability': prob,
|
|
|
|
| 422 |
'width': max(2, prob * 10),
|
| 423 |
'opacity': max(0.3, prob),
|
| 424 |
'color': token_to_color(token)
|
|
|
|
| 419 |
'target': f'layer_{tgt_layer}' if isinstance(tgt_layer, int) else tgt_layer,
|
| 420 |
'token': token,
|
| 421 |
'probability': prob,
|
| 422 |
+
'label': f"{token} | {prob:.3f}", # Tooltip on hover
|
| 423 |
'width': max(2, prob * 10),
|
| 424 |
'opacity': max(0.3, prob),
|
| 425 |
'color': token_to_color(token)
|