Spaces:
Sleeping
Sleeping
tooltip: left of cursor + add mean attention; rename to Visual Tree
Browse files- README.md +1 -1
- app.py +1 -1
- tree_widget.html +2 -2
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
emoji: 🌳
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: indigo
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Visual Tree
|
| 3 |
emoji: 🌳
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: indigo
|
app.py
CHANGED
|
@@ -108,7 +108,7 @@ def process(image):
|
|
| 108 |
|
| 109 |
if gr is not None:
|
| 110 |
with gr.Blocks(title="DINO Hierarchies", theme=gr.themes.Base()) as demo:
|
| 111 |
-
gr.Markdown("# 🌳
|
| 112 |
"and the **reveal animation** (best-first by CLS attention). Runs DINOv3 ViT-L/16.")
|
| 113 |
with gr.Row():
|
| 114 |
inp = gr.Image(type="pil", label="Upload an image", height=300)
|
|
|
|
| 108 |
|
| 109 |
if gr is not None:
|
| 110 |
with gr.Blocks(title="DINO Hierarchies", theme=gr.themes.Base()) as demo:
|
| 111 |
+
gr.Markdown("# 🌳 Visual Tree\nUpload an image → get its **condensed tree** (hover a node) "
|
| 112 |
"and the **reveal animation** (best-first by CLS attention). Runs DINOv3 ViT-L/16.")
|
| 113 |
with gr.Row():
|
| 114 |
inp = gr.Image(type="pil", label="Upload an image", height=300)
|
tree_widget.html
CHANGED
|
@@ -89,10 +89,10 @@ function drawTree(){
|
|
| 89 |
circles.forEach(el=>{
|
| 90 |
const n=NODES[+el.dataset.id];
|
| 91 |
el.addEventListener('mouseenter',e=>{ highlight(n);
|
| 92 |
-
tip.style.opacity=1; tip.innerHTML=`level ${n.depth} · ${n.n} patches · ${n.att}% attn`+(n.tau!=null?` · splits at τ=${n.tau}`:' · leaf');
|
| 93 |
});
|
| 94 |
el.addEventListener('mousemove',e=>{ const b=right.getBoundingClientRect();
|
| 95 |
-
tip.style.left=(e.clientX-b.left
|
| 96 |
el.addEventListener('mouseleave',()=>{ clearHL(); tip.style.opacity=0; });
|
| 97 |
});
|
| 98 |
}
|
|
|
|
| 89 |
circles.forEach(el=>{
|
| 90 |
const n=NODES[+el.dataset.id];
|
| 91 |
el.addEventListener('mouseenter',e=>{ highlight(n);
|
| 92 |
+
tip.style.opacity=1; tip.innerHTML=`level ${n.depth} · ${n.n} patches · ${n.att}% attn · ${n.attm}%/patch mean`+(n.tau!=null?` · splits at τ=${n.tau}`:' · leaf');
|
| 93 |
});
|
| 94 |
el.addEventListener('mousemove',e=>{ const b=right.getBoundingClientRect();
|
| 95 |
+
tip.style.left=(e.clientX-b.left-tip.offsetWidth-12)+'px'; tip.style.top=(e.clientY-b.top+12)+'px'; });
|
| 96 |
el.addEventListener('mouseleave',()=>{ clearHL(); tip.style.opacity=0; });
|
| 97 |
});
|
| 98 |
}
|