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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Multimodal-Edge-Comparator</title>
|
| 7 |
+
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&display=swap" rel="stylesheet">
|
| 8 |
+
<style>
|
| 9 |
+
:root {
|
| 10 |
+
--bg: #0d0d0f;
|
| 11 |
+
--grid: #1a1a1f;
|
| 12 |
+
--node-bg: #13131a;
|
| 13 |
+
--node-header: #1c1c26;
|
| 14 |
+
--node-border: #2a2a3a;
|
| 15 |
+
--accent: #7c6af7;
|
| 16 |
+
--accent2: #4ecdc4;
|
| 17 |
+
--accent3: #ff6b6b;
|
| 18 |
+
--text: #e8e8f0;
|
| 19 |
+
--muted: #6b6b8a;
|
| 20 |
+
--port: #4ecdc4;
|
| 21 |
+
--wire: #2a2a4a;
|
| 22 |
+
--wire-active: #7c6af7;
|
| 23 |
+
}
|
| 24 |
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
| 25 |
+
html, body {
|
| 26 |
+
min-height: 100%; background: var(--bg);
|
| 27 |
+
color: var(--text); font-family: 'JetBrains Mono', monospace;
|
| 28 |
+
}
|
| 29 |
+
body {
|
| 30 |
+
background-image:
|
| 31 |
+
radial-gradient(circle at 20% 50%, rgba(124,106,247,0.04) 0%, transparent 50%),
|
| 32 |
+
radial-gradient(circle at 80% 20%, rgba(78,205,196,0.04) 0%, transparent 50%),
|
| 33 |
+
linear-gradient(var(--grid) 1px, transparent 1px),
|
| 34 |
+
linear-gradient(90deg, var(--grid) 1px, transparent 1px);
|
| 35 |
+
background-size: 100% 100%, 100% 100%, 24px 24px, 24px 24px;
|
| 36 |
+
overflow-x: auto; overflow-y: auto;
|
| 37 |
+
}
|
| 38 |
+
/* ββ Top Bar ββ */
|
| 39 |
+
.top-bar {
|
| 40 |
+
position: sticky; top: 0; left: 0; right: 0; height: 42px;
|
| 41 |
+
background: rgba(13,13,15,0.95); border-bottom: 1px solid var(--node-border);
|
| 42 |
+
display: flex; align-items: center; padding: 0 20px;
|
| 43 |
+
gap: 12px; z-index: 1000; backdrop-filter: blur(12px);
|
| 44 |
+
}
|
| 45 |
+
.top-bar .logo { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 0.05em; }
|
| 46 |
+
.top-bar .sep { color: var(--node-border); }
|
| 47 |
+
.top-bar .sub { font-size: 11px; color: var(--muted); }
|
| 48 |
+
.top-bar .badge {
|
| 49 |
+
margin-left: auto; background: rgba(124,106,247,0.15);
|
| 50 |
+
border: 1px solid rgba(124,106,247,0.3); padding: 3px 10px;
|
| 51 |
+
border-radius: 20px; font-size: 10px; color: var(--accent);
|
| 52 |
+
}
|
| 53 |
+
/* ββ Canvas ββ */
|
| 54 |
+
#canvas {
|
| 55 |
+
position: relative; width: 1360px;
|
| 56 |
+
min-height: calc(100vh - 42px); height: 900px; margin: 0 auto;
|
| 57 |
+
}
|
| 58 |
+
svg.wires {
|
| 59 |
+
position: absolute; top: 0; left: 0; width: 100%; height: 100%;
|
| 60 |
+
pointer-events: none; z-index: 2; overflow: visible;
|
| 61 |
+
}
|
| 62 |
+
path.wire { fill: none; stroke: var(--wire); stroke-width: 2.5; stroke-linecap: round; }
|
| 63 |
+
path.wire.active {
|
| 64 |
+
stroke: var(--wire-active); stroke-width: 3;
|
| 65 |
+
stroke-dasharray: 8 4; animation: flow 0.6s linear infinite;
|
| 66 |
+
}
|
| 67 |
+
@keyframes flow { to { stroke-dashoffset: -24; } }
|
| 68 |
+
/* ββ Nodes ββ */
|
| 69 |
+
.node {
|
| 70 |
+
position: absolute; width: 295px;
|
| 71 |
+
background: var(--node-bg); border: 1px solid var(--node-border);
|
| 72 |
+
border-radius: 9px; box-shadow: 0 8px 28px rgba(0,0,0,0.5);
|
| 73 |
+
z-index: 10; display: flex; flex-direction: column; transition: box-shadow 0.2s;
|
| 74 |
+
}
|
| 75 |
+
.node:hover { box-shadow: 0 8px 28px rgba(0,0,0,0.5), 0 0 0 1px rgba(124,106,247,0.3); }
|
| 76 |
+
.node.fixed-height { height: 340px; }
|
| 77 |
+
.node-header {
|
| 78 |
+
background: var(--node-header); padding: 7px 12px;
|
| 79 |
+
border-bottom: 1px solid var(--node-border); border-radius: 9px 9px 0 0;
|
| 80 |
+
font-size: 11px; font-weight: 700; cursor: grab;
|
| 81 |
+
display: flex; justify-content: space-between; align-items: center;
|
| 82 |
+
flex-shrink: 0; user-select: none;
|
| 83 |
+
}
|
| 84 |
+
.node-header:active { cursor: grabbing; }
|
| 85 |
+
.node-header .id {
|
| 86 |
+
font-size: 10px; color: var(--muted);
|
| 87 |
+
background: rgba(255,255,255,0.04); padding: 2px 7px; border-radius: 4px;
|
| 88 |
+
}
|
| 89 |
+
.node-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; overflow: hidden; }
|
| 90 |
+
/* ββ Ports ββ */
|
| 91 |
+
.port {
|
| 92 |
+
position: absolute; width: 11px; height: 11px;
|
| 93 |
+
background: var(--node-bg); border: 2px solid var(--port);
|
| 94 |
+
border-radius: 50%; z-index: 30;
|
| 95 |
+
}
|
| 96 |
+
.port.out { right: -6px; }
|
| 97 |
+
.port.in { left: -6px; }
|
| 98 |
+
/* ββ Labels ββ */
|
| 99 |
+
label {
|
| 100 |
+
font-size: 10px; color: var(--muted); font-weight: 600;
|
| 101 |
+
display: block; margin-bottom: 3px; letter-spacing: 0.07em; text-transform: uppercase;
|
| 102 |
+
}
|
| 103 |
+
input[type="file"] { display: none; }
|
| 104 |
+
/* ββ Upload Zone ββ */
|
| 105 |
+
.file-upload {
|
| 106 |
+
border: 1.5px dashed var(--node-border); border-radius: 7px; padding: 12px 10px;
|
| 107 |
+
text-align: center; cursor: pointer; font-size: 11px; color: var(--muted);
|
| 108 |
+
transition: border-color 0.2s, background 0.2s; background: rgba(255,255,255,0.01);
|
| 109 |
+
display: flex; flex-direction: column; align-items: center; gap: 5px;
|
| 110 |
+
}
|
| 111 |
+
.file-upload:hover { border-color: var(--accent); background: rgba(124,106,247,0.04); }
|
| 112 |
+
.file-upload svg { opacity: 0.5; transition: opacity 0.2s; }
|
| 113 |
+
.file-upload:hover svg { opacity: 0.9; }
|
| 114 |
+
/* ββ Preview wrapper ββ */
|
| 115 |
+
.preview-wrap {
|
| 116 |
+
display: none; position: relative; border-radius: 7px;
|
| 117 |
+
overflow: hidden; border: 1px solid var(--node-border); background: #000;
|
| 118 |
+
}
|
| 119 |
+
.preview-wrap.visible { display: block; }
|
| 120 |
+
.img-preview { width: 100%; height: 170px; object-fit: contain; display: block; }
|
| 121 |
+
/* ββ Clear button ββ */
|
| 122 |
+
.clear-btn {
|
| 123 |
+
position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
|
| 124 |
+
border-radius: 50%; background: rgba(13,13,15,0.80);
|
| 125 |
+
border: 1px solid var(--node-border); color: var(--accent3); cursor: pointer;
|
| 126 |
+
display: flex; align-items: center; justify-content: center;
|
| 127 |
+
transition: background 0.18s, border-color 0.18s, transform 0.12s;
|
| 128 |
+
z-index: 20; backdrop-filter: blur(6px);
|
| 129 |
+
}
|
| 130 |
+
.clear-btn:hover { background: rgba(255,107,107,0.18); border-color: var(--accent3); transform: scale(1.08); }
|
| 131 |
+
.clear-btn:active { transform: scale(0.95); }
|
| 132 |
+
.clear-btn svg { pointer-events: none; }
|
| 133 |
+
/* ββ Filename chip ββ */
|
| 134 |
+
.img-chip {
|
| 135 |
+
display: none; align-items: center; gap: 6px;
|
| 136 |
+
background: rgba(124,106,247,0.08); border: 1px solid rgba(124,106,247,0.22);
|
| 137 |
+
border-radius: 5px; padding: 4px 8px; font-size: 9px; color: var(--muted); overflow: hidden;
|
| 138 |
+
}
|
| 139 |
+
.img-chip.visible { display: flex; }
|
| 140 |
+
.img-chip .chip-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent2); flex-shrink: 0; box-shadow: 0 0 4px var(--accent2); }
|
| 141 |
+
.img-chip .chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; color: var(--text); font-size: 9px; }
|
| 142 |
+
.img-chip .chip-size { color: var(--muted); flex-shrink: 0; font-size: 9px; }
|
| 143 |
+
select, textarea {
|
| 144 |
+
width: 100%; background: rgba(0,0,0,0.3); border: 1px solid var(--node-border);
|
| 145 |
+
color: var(--text); padding: 7px 9px; border-radius: 5px; outline: none;
|
| 146 |
+
font-size: 11px; font-family: 'JetBrains Mono', monospace;
|
| 147 |
+
resize: none; transition: border-color 0.2s;
|
| 148 |
+
}
|
| 149 |
+
select:focus, textarea:focus { border-color: var(--accent); }
|
| 150 |
+
select option { background: #1c1c26; }
|
| 151 |
+
button.run-btn {
|
| 152 |
+
background: linear-gradient(135deg, var(--accent), #9b59b6);
|
| 153 |
+
color: #fff; border: none; padding: 8px; border-radius: 6px;
|
| 154 |
+
font-weight: 700; font-size: 11px; font-family: 'JetBrains Mono', monospace;
|
| 155 |
+
cursor: pointer; transition: opacity 0.2s, transform 0.1s;
|
| 156 |
+
display: flex; justify-content: center; align-items: center; gap: 8px;
|
| 157 |
+
letter-spacing: 0.04em; flex-shrink: 0;
|
| 158 |
+
}
|
| 159 |
+
button.run-btn:hover { opacity: 0.9; }
|
| 160 |
+
button.run-btn:active { transform: scale(0.98); }
|
| 161 |
+
button.run-btn:disabled { background: var(--node-border); cursor: not-allowed; color: #555; }
|
| 162 |
+
/* ββ Output node ββ */
|
| 163 |
+
.output-node-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; overflow: hidden; }
|
| 164 |
+
.output-header-row { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
|
| 165 |
+
/* ββ Icon buttons ββ */
|
| 166 |
+
.icon-btn {
|
| 167 |
+
display: flex; align-items: center; gap: 5px;
|
| 168 |
+
background: rgba(124,106,247,0.10); border: 1px solid rgba(124,106,247,0.25);
|
| 169 |
+
border-radius: 5px; padding: 3px 8px; font-size: 9px; font-weight: 700;
|
| 170 |
+
font-family: 'JetBrains Mono', monospace; color: var(--accent); cursor: pointer;
|
| 171 |
+
letter-spacing: 0.05em; transition: background 0.18s, border-color 0.18s, transform 0.1s;
|
| 172 |
+
flex-shrink: 0; text-decoration: none;
|
| 173 |
+
}
|
| 174 |
+
.icon-btn:hover { background: rgba(124,106,247,0.22); border-color: var(--accent); }
|
| 175 |
+
.icon-btn:active { transform: scale(0.95); }
|
| 176 |
+
.icon-btn.teal { background: rgba(78,205,196,0.10); border-color: rgba(78,205,196,0.25); color: var(--accent2); }
|
| 177 |
+
.icon-btn.teal:hover { background: rgba(78,205,196,0.22); border-color: var(--accent2); }
|
| 178 |
+
.icon-btn.copied { background: rgba(78,205,196,0.15); border-color: var(--accent2); color: var(--accent2); }
|
| 179 |
+
.icon-btn svg { pointer-events: none; flex-shrink: 0; }
|
| 180 |
+
.output-box {
|
| 181 |
+
background: rgba(0,0,0,0.4); border: 1px solid var(--node-border);
|
| 182 |
+
border-radius: 5px; padding: 10px; flex: 1; overflow-y: auto;
|
| 183 |
+
font-size: 11px; line-height: 1.6; color: #c8c8e0; white-space: pre-wrap;
|
| 184 |
+
user-select: text; font-family: 'JetBrains Mono', monospace; min-height: 0;
|
| 185 |
+
}
|
| 186 |
+
/* ββ Grounding node ββ */
|
| 187 |
+
.ground-node-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; overflow: hidden; }
|
| 188 |
+
.ground-header-row { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
|
| 189 |
+
.ground-img-wrap {
|
| 190 |
+
position: relative; flex: 1; border: 1px solid var(--node-border);
|
| 191 |
+
border-radius: 5px; overflow: hidden; background: #111; min-height: 0;
|
| 192 |
+
display: flex; align-items: center; justify-content: center;
|
| 193 |
+
}
|
| 194 |
+
.ground-img-wrap img.overlay-img {
|
| 195 |
+
max-width: 100%; max-height: 100%;
|
| 196 |
+
object-fit: contain; display: block;
|
| 197 |
+
}
|
| 198 |
+
.ground-placeholder {
|
| 199 |
+
position: absolute; inset: 0; display: flex; align-items: center;
|
| 200 |
+
justify-content: center; font-size: 11px; color: var(--muted);
|
| 201 |
+
text-align: center; padding: 10px; pointer-events: none; z-index: 5;
|
| 202 |
+
}
|
| 203 |
+
.loader {
|
| 204 |
+
width: 11px; height: 11px; border: 2px solid rgba(255,255,255,0.3);
|
| 205 |
+
border-top-color: #fff; border-radius: 50%;
|
| 206 |
+
animation: spin 0.7s linear infinite; display: none;
|
| 207 |
+
}
|
| 208 |
+
@keyframes spin { to { transform: rotate(360deg); } }
|
| 209 |
+
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: inline-block; margin-right: 6px; }
|
| 210 |
+
.status-dot.active { background: var(--accent2); box-shadow: 0 0 5px var(--accent2); }
|
| 211 |
+
/* ββ Model badges ββ */
|
| 212 |
+
.model-badge {
|
| 213 |
+
display: inline-block; padding: 2px 7px; border-radius: 4px;
|
| 214 |
+
font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
|
| 215 |
+
}
|
| 216 |
+
.model-badge.qvl2b { background: rgba(255,150,50,0.15); color: #ff9632; border: 1px solid rgba(255,150,50,0.35); }
|
| 217 |
+
.model-badge.qvl4b { background: rgba(255,100,80,0.15); color: #ff6450; border: 1px solid rgba(255,100,80,0.35); }
|
| 218 |
+
.model-badge.q4bunred { background: rgba(255,80,80,0.18); color: #ff5050; border: 1px solid rgba(255,80,80,0.40); }
|
| 219 |
+
.model-badge.q4b { background: rgba(255,200,80,0.15); color: #ffc850; border: 1px solid rgba(255,200,80,0.35); }
|
| 220 |
+
.model-badge.q2b { background: rgba(124,106,247,0.2); color: var(--accent); border: 1px solid rgba(124,106,247,0.3); }
|
| 221 |
+
.model-badge.lfm450 { background: rgba(78,205,196,0.15); color: var(--accent2); border: 1px solid rgba(78,205,196,0.3); }
|
| 222 |
+
.model-badge.g4e2b { background: rgba(66,197,107,0.15); color: #42c56b; border: 1px solid rgba(66,197,107,0.35); }
|
| 223 |
+
.model-badge.lfm16 { background: rgba(107,203,119,0.15); color: #6bcb77; border: 1px solid rgba(107,203,119,0.35); }
|
| 224 |
+
.model-badge.qunred { background: rgba(255,80,160,0.15); color: #ff50a0; border: 1px solid rgba(255,80,160,0.35); }
|
| 225 |
+
.model-badge.q25vl3b { background: rgba(80,180,255,0.15); color: #50b4ff; border: 1px solid rgba(80,180,255,0.35); }
|
| 226 |
+
.model-info-box { border-radius: 6px; padding: 9px; font-size: 10px; color: var(--muted); line-height: 1.55; flex-shrink: 0; }
|
| 227 |
+
.canvas-footer { height: 36px; }
|
| 228 |
+
</style>
|
| 229 |
+
</head>
|
| 230 |
+
<body>
|
| 231 |
+
|
| 232 |
+
<div class="top-bar">
|
| 233 |
+
<span class="logo">MULTIMODAL EDGE</span>
|
| 234 |
+
<span class="sep">|</span>
|
| 235 |
+
<span class="sub">Node-Based Inference Canvas</span>
|
| 236 |
+
<span class="badge">10x Vision Models</span>
|
| 237 |
+
</div>
|
| 238 |
+
|
| 239 |
+
<div id="canvas">
|
| 240 |
+
<svg class="wires">
|
| 241 |
+
<path id="wire-img-task" class="wire" />
|
| 242 |
+
<path id="wire-model-task" class="wire" />
|
| 243 |
+
<path id="wire-task-out" class="wire" />
|
| 244 |
+
<path id="wire-task-gnd" class="wire" />
|
| 245 |
+
</svg>
|
| 246 |
+
|
| 247 |
+
<!-- βββ ID 01 : Image Input βββ -->
|
| 248 |
+
<div class="node fixed-height" id="node-img" style="left:40px; top:52px;">
|
| 249 |
+
<div class="node-header">
|
| 250 |
+
<span><span class="status-dot" id="dot-img"></span>Input Image</span>
|
| 251 |
+
<span class="id">ID: 01</span>
|
| 252 |
+
</div>
|
| 253 |
+
<div class="node-body">
|
| 254 |
+
<div>
|
| 255 |
+
<label>Upload Image</label>
|
| 256 |
+
<div class="file-upload" id="dropZone">
|
| 257 |
+
<svg width="30" height="30" viewBox="0 0 24 24" fill="none"
|
| 258 |
+
stroke="#7c6af7" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
| 259 |
+
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>
|
| 260 |
+
<circle cx="8.5" cy="8.5" r="1.5"/>
|
| 261 |
+
<polyline points="21 15 16 10 5 21"/>
|
| 262 |
+
</svg>
|
| 263 |
+
<span>Click or drop image here</span>
|
| 264 |
+
<input type="file" id="fileInput" accept="image/*">
|
| 265 |
+
</div>
|
| 266 |
+
<div class="preview-wrap" id="previewWrap">
|
| 267 |
+
<img id="imgPreview" class="img-preview" />
|
| 268 |
+
<button class="clear-btn" id="clearBtn" title="Remove image">
|
| 269 |
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none"
|
| 270 |
+
stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
| 271 |
+
<line x1="18" y1="6" x2="6" y2="18"/>
|
| 272 |
+
<line x1="6" y1="6" x2="18" y2="18"/>
|
| 273 |
+
</svg>
|
| 274 |
+
</button>
|
| 275 |
+
</div>
|
| 276 |
+
<div class="img-chip" id="imgChip" style="margin-top:6px;">
|
| 277 |
+
<span class="chip-dot"></span>
|
| 278 |
+
<span class="chip-name" id="chipName">β</span>
|
| 279 |
+
<span class="chip-size" id="chipSize"></span>
|
| 280 |
+
</div>
|
| 281 |
+
</div>
|
| 282 |
+
</div>
|
| 283 |
+
<div class="port out" id="port-img-out" style="top:50%;transform:translateY(-50%);"></div>
|
| 284 |
+
</div>
|
| 285 |
+
|
| 286 |
+
<!-- βββ ID 02 : Model Selector βββ -->
|
| 287 |
+
<div class="node fixed-height" id="node-model" style="left:40px; top:412px;">
|
| 288 |
+
<div class="node-header">
|
| 289 |
+
<span><span class="status-dot" id="dot-model"></span>Model Selector</span>
|
| 290 |
+
<span class="id">ID: 02</span>
|
| 291 |
+
</div>
|
| 292 |
+
<div class="node-body">
|
| 293 |
+
<div>
|
| 294 |
+
<label>Active Model</label>
|
| 295 |
+
<select id="modelSelect">
|
| 296 |
+
<option value="qwen_vl_2b">Qwen3-VL-2B-Instruct</option>
|
| 297 |
+
<option value="qwen_vl_4b">Qwen3-VL-4B-Instruct</option>
|
| 298 |
+
<option value="qwen_4b_unredacted">Qwen3.5-4B-Unredacted-MAX</option>
|
| 299 |
+
<option value="qwen_4b">Qwen3.5-4B</option>
|
| 300 |
+
<option value="qwen_2b">Qwen3.5-2B</option>
|
| 301 |
+
<option value="lfm_450">LFM2.5-VL-450M (LiquidAI)</option>
|
| 302 |
+
<option value="gemma4_e2b">Gemma4-E2B-it (Google)</option>
|
| 303 |
+
<option value="lfm_16">LFM2.5-VL-1.6B (LiquidAI)</option>
|
| 304 |
+
<option value="qwen_unredacted">Qwen3.5-2B-Unredacted-MAX</option>
|
| 305 |
+
<option value="qwen25_vl_3b">Qwen2.5-VL-3B-Instruct</option>
|
| 306 |
+
</select>
|
| 307 |
+
</div>
|
| 308 |
+
<div id="modelInfoBox" class="model-info-box"
|
| 309 |
+
style="background:rgba(255,150,50,0.07);border:1px solid rgba(255,150,50,0.3);">
|
| 310 |
+
<span class="model-badge qvl2b">QWEN3-VL Β· 2B</span><br><br>
|
| 311 |
+
Qwen3-VL-2B-Instruct β dedicated vision-language model by Alibaba Cloud.
|
| 312 |
+
Strong spatial grounding, OCR & instruction-following.
|
| 313 |
+
</div>
|
| 314 |
+
<div style="flex:1;"></div>
|
| 315 |
+
</div>
|
| 316 |
+
<div class="port out" id="port-model-out" style="top:50%;transform:translateY(-50%);"></div>
|
| 317 |
+
</div>
|
| 318 |
+
|
| 319 |
+
<!-- βββ ID 03 : Task Config βββ -->
|
| 320 |
+
<div class="node fixed-height" id="node-task" style="left:425px; top:52px;">
|
| 321 |
+
<div class="port in" id="port-task-in" style="top:50%;transform:translateY(-50%);"></div>
|
| 322 |
+
<div class="node-header">
|
| 323 |
+
<span><span class="status-dot" id="dot-task"></span>Task Config</span>
|
| 324 |
+
<span class="id">ID: 03</span>
|
| 325 |
+
</div>
|
| 326 |
+
<div class="node-body">
|
| 327 |
+
<div>
|
| 328 |
+
<label>Task Category</label>
|
| 329 |
+
<select id="categorySelect">
|
| 330 |
+
<option value="Query">Query</option>
|
| 331 |
+
<option value="Caption">Caption</option>
|
| 332 |
+
<option value="Point">Point</option>
|
| 333 |
+
<option value="Detect">Detect</option>
|
| 334 |
+
</select>
|
| 335 |
+
</div>
|
| 336 |
+
<div>
|
| 337 |
+
<label>Prompt Directive</label>
|
| 338 |
+
<textarea id="promptInput" rows="4"
|
| 339 |
+
placeholder="e.g., Count the total number of boats and describe the environment."></textarea>
|
| 340 |
+
</div>
|
| 341 |
+
<button class="run-btn" id="runBtn">
|
| 342 |
+
<span>Execute</span>
|
| 343 |
+
<span class="loader" id="btnLoader"></span>
|
| 344 |
+
</button>
|
| 345 |
+
</div>
|
| 346 |
+
<div class="port out" id="port-task-out" style="top:50%;transform:translateY(-50%);"></div>
|
| 347 |
+
</div>
|
| 348 |
+
|
| 349 |
+
<!-- βββ ID 04 : Output Stream βββ -->
|
| 350 |
+
<div class="node fixed-height" id="node-out" style="left:810px; top:52px;">
|
| 351 |
+
<div class="port in" id="port-out-in" style="top:50%;transform:translateY(-50%);"></div>
|
| 352 |
+
<div class="node-header">
|
| 353 |
+
<span><span class="status-dot" id="dot-out"></span>Output Stream</span>
|
| 354 |
+
<span class="id">ID: 04</span>
|
| 355 |
+
</div>
|
| 356 |
+
<div class="output-node-body">
|
| 357 |
+
<div class="output-header-row">
|
| 358 |
+
<label style="margin-bottom:0;">Streamed Result</label>
|
| 359 |
+
<button class="icon-btn" id="copyBtn" title="Copy result to clipboard">
|
| 360 |
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none"
|
| 361 |
+
stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
| 362 |
+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
|
| 363 |
+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
|
| 364 |
+
</svg>
|
| 365 |
+
COPY
|
| 366 |
+
</button>
|
| 367 |
+
</div>
|
| 368 |
+
<div class="output-box" id="outputBox">Results will stream here...</div>
|
| 369 |
+
</div>
|
| 370 |
+
</div>
|
| 371 |
+
|
| 372 |
+
<!-- βββ ID 05 : Grounding Visualiser βββ -->
|
| 373 |
+
<div class="node fixed-height" id="node-gnd" style="left:810px; top:412px;">
|
| 374 |
+
<div class="port in" id="port-gnd-in" style="top:50%;transform:translateY(-50%);"></div>
|
| 375 |
+
<div class="node-header">
|
| 376 |
+
<span><span class="status-dot" id="dot-gnd"></span>View Grounding</span>
|
| 377 |
+
<span class="id">ID: 05</span>
|
| 378 |
+
</div>
|
| 379 |
+
<div class="ground-node-body">
|
| 380 |
+
<div class="ground-header-row">
|
| 381 |
+
<label style="margin-bottom:0;">Point / Detect Overlay</label>
|
| 382 |
+
<a class="icon-btn teal" id="downloadBtn" title="Download overlay image" style="display:none;">
|
| 383 |
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none"
|
| 384 |
+
stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
| 385 |
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
|
| 386 |
+
<polyline points="7 10 12 15 17 10"/>
|
| 387 |
+
<line x1="12" y1="15" x2="12" y2="3"/>
|
| 388 |
+
</svg>
|
| 389 |
+
SAVE
|
| 390 |
+
</a>
|
| 391 |
+
</div>
|
| 392 |
+
<div class="ground-img-wrap" id="groundWrap">
|
| 393 |
+
<img class="overlay-img" id="overlayImg" src="" style="display:none;" />
|
| 394 |
+
<div class="ground-placeholder" id="groundPlaceholder">
|
| 395 |
+
Active for Point / Detect tasks.<br>Run inference to visualise.
|
| 396 |
+
</div>
|
| 397 |
+
</div>
|
| 398 |
+
</div>
|
| 399 |
+
</div>
|
| 400 |
+
|
| 401 |
+
<div class="canvas-footer"></div>
|
| 402 |
+
</div>
|
| 403 |
+
|
| 404 |
+
<script>
|
| 405 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 406 |
+
// WIRE DRAWING
|
| 407 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 408 |
+
const canvasEl = document.getElementById('canvas');
|
| 409 |
+
function portCenter(id) {
|
| 410 |
+
const el = document.getElementById(id);
|
| 411 |
+
if (!el) return {x:0,y:0};
|
| 412 |
+
const er = el.getBoundingClientRect(), cr = canvasEl.getBoundingClientRect();
|
| 413 |
+
return { x: er.left + er.width/2 - cr.left, y: er.top + er.height/2 - cr.top };
|
| 414 |
+
}
|
| 415 |
+
function bezier(p1, p2) {
|
| 416 |
+
const dx = Math.abs(p2.x - p1.x) * 0.55;
|
| 417 |
+
return `M ${p1.x} ${p1.y} C ${p1.x+dx} ${p1.y}, ${p2.x-dx} ${p2.y}, ${p2.x} ${p2.y}`;
|
| 418 |
+
}
|
| 419 |
+
function updateWires() {
|
| 420 |
+
const wires = [
|
| 421 |
+
['wire-img-task', 'port-img-out', 'port-task-in'],
|
| 422 |
+
['wire-model-task', 'port-model-out','port-task-in'],
|
| 423 |
+
['wire-task-out', 'port-task-out', 'port-out-in'],
|
| 424 |
+
['wire-task-gnd', 'port-task-out', 'port-gnd-in'],
|
| 425 |
+
];
|
| 426 |
+
for (const [id, from, to] of wires) {
|
| 427 |
+
const el = document.getElementById(id);
|
| 428 |
+
if (el) el.setAttribute('d', bezier(portCenter(from), portCenter(to)));
|
| 429 |
+
}
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 433 |
+
// DRAGGING
|
| 434 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 435 |
+
document.querySelectorAll('.node').forEach(node => {
|
| 436 |
+
const header = node.querySelector('.node-header');
|
| 437 |
+
let drag = false, sx, sy, il, it;
|
| 438 |
+
header.addEventListener('mousedown', e => {
|
| 439 |
+
drag=true; sx=e.clientX; sy=e.clientY;
|
| 440 |
+
il=parseInt(node.style.left)||0; it=parseInt(node.style.top)||0;
|
| 441 |
+
node.style.zIndex=100; e.preventDefault();
|
| 442 |
+
});
|
| 443 |
+
document.addEventListener('mousemove', e => {
|
| 444 |
+
if (!drag) return;
|
| 445 |
+
node.style.left=`${il+e.clientX-sx}px`; node.style.top=`${it+e.clientY-sy}px`;
|
| 446 |
+
updateWires();
|
| 447 |
+
});
|
| 448 |
+
document.addEventListener('mouseup', () => { if(drag){drag=false;node.style.zIndex=10;} });
|
| 449 |
+
});
|
| 450 |
+
window.addEventListener('resize', updateWires);
|
| 451 |
+
window.addEventListener('scroll', updateWires);
|
| 452 |
+
document.addEventListener('scroll', updateWires, true);
|
| 453 |
+
requestAnimationFrame(updateWires);
|
| 454 |
+
|
| 455 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 456 |
+
// FILE UPLOAD + CLEAR
|
| 457 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 458 |
+
let currentFile = null;
|
| 459 |
+
const dropZone = document.getElementById('dropZone');
|
| 460 |
+
const fileInput = document.getElementById('fileInput');
|
| 461 |
+
const previewWrap = document.getElementById('previewWrap');
|
| 462 |
+
const imgPreview = document.getElementById('imgPreview');
|
| 463 |
+
const clearBtn = document.getElementById('clearBtn');
|
| 464 |
+
const imgChip = document.getElementById('imgChip');
|
| 465 |
+
const chipName = document.getElementById('chipName');
|
| 466 |
+
const chipSize = document.getElementById('chipSize');
|
| 467 |
+
const dotImg = document.getElementById('dot-img');
|
| 468 |
+
|
| 469 |
+
function formatBytes(b) {
|
| 470 |
+
if (b<1024) return b+' B';
|
| 471 |
+
if (b<1048576) return (b/1024).toFixed(1)+' KB';
|
| 472 |
+
return (b/1048576).toFixed(1)+' MB';
|
| 473 |
+
}
|
| 474 |
+
function handleFile(file) {
|
| 475 |
+
if (!file||!file.type.startsWith('image/')) return;
|
| 476 |
+
currentFile=file;
|
| 477 |
+
imgPreview.src=URL.createObjectURL(file);
|
| 478 |
+
previewWrap.classList.add('visible');
|
| 479 |
+
dropZone.style.display='none';
|
| 480 |
+
chipName.textContent=file.name;
|
| 481 |
+
chipSize.textContent=formatBytes(file.size);
|
| 482 |
+
imgChip.classList.add('visible');
|
| 483 |
+
dotImg.classList.add('active');
|
| 484 |
+
requestAnimationFrame(updateWires);
|
| 485 |
+
}
|
| 486 |
+
function clearImage() {
|
| 487 |
+
currentFile=null; imgPreview.src='';
|
| 488 |
+
previewWrap.classList.remove('visible');
|
| 489 |
+
dropZone.style.display='';
|
| 490 |
+
imgChip.classList.remove('visible');
|
| 491 |
+
chipName.textContent='β'; chipSize.textContent='';
|
| 492 |
+
fileInput.value=''; dotImg.classList.remove('active');
|
| 493 |
+
requestAnimationFrame(updateWires);
|
| 494 |
+
}
|
| 495 |
+
dropZone.onclick = () => fileInput.click();
|
| 496 |
+
fileInput.onchange = e => handleFile(e.target.files[0]);
|
| 497 |
+
clearBtn.onclick = e => { e.stopPropagation(); clearImage(); };
|
| 498 |
+
dropZone.ondragover = e => { e.preventDefault(); dropZone.style.borderColor='var(--accent)'; };
|
| 499 |
+
dropZone.ondragleave = () => { dropZone.style.borderColor=''; };
|
| 500 |
+
dropZone.ondrop = e => {
|
| 501 |
+
e.preventDefault(); dropZone.style.borderColor='';
|
| 502 |
+
if (e.dataTransfer.files.length) handleFile(e.dataTransfer.files[0]);
|
| 503 |
+
};
|
| 504 |
+
|
| 505 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 506 |
+
// MODEL SELECTOR
|
| 507 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 508 |
+
const modelSelect = document.getElementById('modelSelect');
|
| 509 |
+
const modelInfoBox = document.getElementById('modelInfoBox');
|
| 510 |
+
const dotModel = document.getElementById('dot-model');
|
| 511 |
+
dotModel.classList.add('active');
|
| 512 |
+
|
| 513 |
+
const MODEL_INFO = {
|
| 514 |
+
qwen_vl_2b: {
|
| 515 |
+
html: `<span class="model-badge qvl2b">QWEN3-VL Β· 2B</span><br><br>
|
| 516 |
+
Qwen3-VL-2B-Instruct β dedicated vision-language model by Alibaba Cloud.
|
| 517 |
+
Strong spatial grounding, OCR & instruction-following.`,
|
| 518 |
+
bg: 'rgba(255,150,50,0.07)', border: 'rgba(255,150,50,0.30)',
|
| 519 |
+
},
|
| 520 |
+
qwen_vl_4b: {
|
| 521 |
+
html: `<span class="model-badge qvl4b">QWEN3-VL Β· 4B</span><br><br>
|
| 522 |
+
Qwen3-VL-4B-Instruct β enhanced vision-language model by Alibaba Cloud.
|
| 523 |
+
Superior spatial grounding, richer OCR & stronger multi-step reasoning.`,
|
| 524 |
+
bg: 'rgba(255,100,80,0.07)', border: 'rgba(255,100,80,0.25)',
|
| 525 |
+
},
|
| 526 |
+
qwen_4b_unredacted: {
|
| 527 |
+
html: `<span class="model-badge q4bunred">QWEN 3.5 Β· 4B UNREDACTED MAX</span><br><br>
|
| 528 |
+
Qwen3.5-4B-Unredacted-MAX by prithivMLmods. Uncensored fine-tune of Qwen3.5-4B
|
| 529 |
+
with extended instruction-following & unrestricted reasoning.`,
|
| 530 |
+
bg: 'rgba(255,80,80,0.07)', border: 'rgba(255,80,80,0.30)',
|
| 531 |
+
},
|
| 532 |
+
qwen_4b: {
|
| 533 |
+
html: `<span class="model-badge q4b">QWEN 3.5 Β· 4B</span><br><br>
|
| 534 |
+
Qwen3.5 4B multimodal model by Alibaba Cloud.
|
| 535 |
+
Enhanced capacity β richer reasoning & better instruction following.`,
|
| 536 |
+
bg: 'rgba(255,200,80,0.07)', border: 'rgba(255,200,80,0.30)',
|
| 537 |
+
},
|
| 538 |
+
qwen_2b: {
|
| 539 |
+
html: `<span class="model-badge q2b">QWEN 3.5 Β· 2B</span><br><br>
|
| 540 |
+
Qwen3.5 2B multimodal model by Alibaba Cloud.
|
| 541 |
+
Lightweight & fast β ideal for quick Query, Caption, Point & Detect tasks.`,
|
| 542 |
+
bg: 'rgba(124,106,247,0.07)', border: 'rgba(124,106,247,0.25)',
|
| 543 |
+
},
|
| 544 |
+
lfm_450: {
|
| 545 |
+
html: `<span class="model-badge lfm450">LFM Β· 450M</span><br><br>
|
| 546 |
+
LFM2.5-VL 450M by LiquidAI. Ultra-lightweight edge model
|
| 547 |
+
with solid grounding capabilities.`,
|
| 548 |
+
bg: 'rgba(78,205,196,0.07)', border: 'rgba(78,205,196,0.25)',
|
| 549 |
+
},
|
| 550 |
+
gemma4_e2b: {
|
| 551 |
+
html: `<span class="model-badge g4e2b">GEMMA 4 Β· E2B</span><br><br>
|
| 552 |
+
Gemma4-E2B-it by Google DeepMind. Efficient 2B multimodal model
|
| 553 |
+
with strong vision-language understanding & instruction-following.`,
|
| 554 |
+
bg: 'rgba(66,197,107,0.07)', border: 'rgba(66,197,107,0.25)',
|
| 555 |
+
},
|
| 556 |
+
lfm_16: {
|
| 557 |
+
html: `<span class="model-badge lfm16">LFM Β· 1.6B</span><br><br>
|
| 558 |
+
LFM2.5-VL 1.6B by LiquidAI. Larger liquid-state model offering
|
| 559 |
+
enhanced reasoning & richer visual understanding.`,
|
| 560 |
+
bg: 'rgba(107,203,119,0.07)', border: 'rgba(107,203,119,0.25)',
|
| 561 |
+
},
|
| 562 |
+
qwen_unredacted: {
|
| 563 |
+
html: `<span class="model-badge qunred">QWEN 3.5 Β· 2B UNREDACTED MAX</span><br><br>
|
| 564 |
+
Qwen3.5-2B-Unredacted-MAX by prithivMLmods. Fine-tuned variant of Qwen3.5-2B
|
| 565 |
+
with uncensored & extended instruction-following capabilities.`,
|
| 566 |
+
bg: 'rgba(255,80,160,0.07)', border: 'rgba(255,80,160,0.25)',
|
| 567 |
+
},
|
| 568 |
+
qwen25_vl_3b: {
|
| 569 |
+
html: `<span class="model-badge q25vl3b">QWEN 2.5-VL Β· 3B</span><br><br>
|
| 570 |
+
Qwen2.5-VL-3B-Instruct by Alibaba Cloud. Powerful 3B vision-language model
|
| 571 |
+
with strong grounding, OCR & multi-task visual reasoning.`,
|
| 572 |
+
bg: 'rgba(80,180,255,0.07)', border: 'rgba(80,180,255,0.25)',
|
| 573 |
+
},
|
| 574 |
+
};
|
| 575 |
+
modelSelect.onchange = () => {
|
| 576 |
+
const info = MODEL_INFO[modelSelect.value];
|
| 577 |
+
if (!info) return;
|
| 578 |
+
modelInfoBox.innerHTML = info.html;
|
| 579 |
+
modelInfoBox.style.background = info.bg;
|
| 580 |
+
modelInfoBox.style.border = `1px solid ${info.border}`;
|
| 581 |
+
};
|
| 582 |
+
|
| 583 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 584 |
+
// CATEGORY PLACEHOLDER
|
| 585 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 586 |
+
const categorySelect = document.getElementById('categorySelect');
|
| 587 |
+
const promptInput = document.getElementById('promptInput');
|
| 588 |
+
const PLACEHOLDERS = {
|
| 589 |
+
Query: 'e.g., Count the total number of boats and describe the environment.',
|
| 590 |
+
Caption: 'e.g., short | normal | detailed',
|
| 591 |
+
Point: 'e.g., The gun held by the person.',
|
| 592 |
+
Detect: 'e.g., The headlight of the car.',
|
| 593 |
+
};
|
| 594 |
+
categorySelect.onchange = e => { promptInput.placeholder = PLACEHOLDERS[e.target.value] || ''; };
|
| 595 |
+
|
| 596 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 597 |
+
// COPY BUTTON
|
| 598 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 599 |
+
const copyBtn = document.getElementById('copyBtn');
|
| 600 |
+
const outputBox = document.getElementById('outputBox');
|
| 601 |
+
let copyTimer = null;
|
| 602 |
+
|
| 603 |
+
function resetCopyBtn() {
|
| 604 |
+
copyBtn.classList.remove('copied');
|
| 605 |
+
copyBtn.innerHTML = `
|
| 606 |
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none"
|
| 607 |
+
stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round">
|
| 608 |
+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
|
| 609 |
+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
|
| 610 |
+
</svg> COPY`;
|
| 611 |
+
}
|
| 612 |
+
copyBtn.onclick = () => {
|
| 613 |
+
const txt = outputBox.innerText || '';
|
| 614 |
+
if (!txt || txt === 'Results will stream here...') return;
|
| 615 |
+
navigator.clipboard.writeText(txt).then(() => {
|
| 616 |
+
copyBtn.classList.add('copied');
|
| 617 |
+
copyBtn.innerHTML = `
|
| 618 |
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none"
|
| 619 |
+
stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
| 620 |
+
<polyline points="20 6 9 17 4 12"/>
|
| 621 |
+
</svg> COPIED`;
|
| 622 |
+
clearTimeout(copyTimer);
|
| 623 |
+
copyTimer = setTimeout(resetCopyBtn, 2000);
|
| 624 |
+
}).catch(() => {
|
| 625 |
+
const ta = document.createElement('textarea');
|
| 626 |
+
ta.value = txt; ta.style.position = 'fixed'; ta.style.opacity = '0';
|
| 627 |
+
document.body.appendChild(ta); ta.select(); document.execCommand('copy');
|
| 628 |
+
document.body.removeChild(ta);
|
| 629 |
+
});
|
| 630 |
+
};
|
| 631 |
+
|
| 632 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 633 |
+
// GROUNDING DISPLAY (server-side annotated image)
|
| 634 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 635 |
+
const overlayImg = document.getElementById('overlayImg');
|
| 636 |
+
const groundPlaceholder = document.getElementById('groundPlaceholder');
|
| 637 |
+
const downloadBtn = document.getElementById('downloadBtn');
|
| 638 |
+
const dotGnd = document.getElementById('dot-gnd');
|
| 639 |
+
|
| 640 |
+
function showOverlay(b64png) {
|
| 641 |
+
const src = 'data:image/png;base64,' + b64png;
|
| 642 |
+
overlayImg.src = src;
|
| 643 |
+
overlayImg.style.display = 'block';
|
| 644 |
+
groundPlaceholder.style.display = 'none';
|
| 645 |
+
dotGnd.classList.add('active');
|
| 646 |
+
|
| 647 |
+
const ts = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
| 648 |
+
downloadBtn.href = src;
|
| 649 |
+
downloadBtn.download = `grounding_${ts}.png`;
|
| 650 |
+
downloadBtn.style.display = 'flex';
|
| 651 |
+
}
|
| 652 |
+
|
| 653 |
+
function resetOverlay(msg) {
|
| 654 |
+
overlayImg.src = '';
|
| 655 |
+
overlayImg.style.display = 'none';
|
| 656 |
+
groundPlaceholder.textContent = msg || 'Active for Point / Detect tasks.\nRun inference to visualise.';
|
| 657 |
+
groundPlaceholder.style.display = 'flex';
|
| 658 |
+
downloadBtn.style.display = 'none';
|
| 659 |
+
dotGnd.classList.remove('active');
|
| 660 |
+
}
|
| 661 |
+
|
| 662 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 663 |
+
// RUN INFERENCE
|
| 664 |
+
// ββββββββββββββββββββββββββββββββββββββββββββββ
|
| 665 |
+
const runBtn = document.getElementById('runBtn');
|
| 666 |
+
const btnLoader = document.getElementById('btnLoader');
|
| 667 |
+
const allWires = ['wire-img-task','wire-model-task','wire-task-out','wire-task-gnd'];
|
| 668 |
+
const dotTask = document.getElementById('dot-task');
|
| 669 |
+
const dotOut = document.getElementById('dot-out');
|
| 670 |
+
|
| 671 |
+
runBtn.onclick = async () => {
|
| 672 |
+
if (!currentFile) { alert('Please upload an image into the Input Node.'); return; }
|
| 673 |
+
const promptStr = promptInput.value.trim();
|
| 674 |
+
if (!promptStr) { alert('Please enter a prompt directive.'); return; }
|
| 675 |
+
|
| 676 |
+
// ββ Reset UI ββββββββββββββββββββββββββββββ
|
| 677 |
+
runBtn.disabled = true;
|
| 678 |
+
btnLoader.style.display = 'inline-block';
|
| 679 |
+
outputBox.innerText = '';
|
| 680 |
+
outputBox.style.color = '';
|
| 681 |
+
dotTask.classList.add('active');
|
| 682 |
+
dotOut.classList.remove('active');
|
| 683 |
+
allWires.forEach(id => document.getElementById(id)?.classList.add('active'));
|
| 684 |
+
resetCopyBtn();
|
| 685 |
+
resetOverlay('Running inferenceβ¦');
|
| 686 |
+
|
| 687 |
+
const category = categorySelect.value;
|
| 688 |
+
const modelId = modelSelect.value;
|
| 689 |
+
|
| 690 |
+
// ββ Step 1: stream text from /api/run βββββ
|
| 691 |
+
const formData = new FormData();
|
| 692 |
+
formData.append('image', currentFile);
|
| 693 |
+
formData.append('category', category);
|
| 694 |
+
formData.append('prompt', promptStr);
|
| 695 |
+
formData.append('model_id', modelId);
|
| 696 |
+
|
| 697 |
+
let fullText = '';
|
| 698 |
+
|
| 699 |
+
try {
|
| 700 |
+
const response = await fetch('/api/run', { method: 'POST', body: formData });
|
| 701 |
+
if (!response.ok) {
|
| 702 |
+
const err = await response.json();
|
| 703 |
+
throw new Error(err.error || 'Execution failed.');
|
| 704 |
+
}
|
| 705 |
+
|
| 706 |
+
const reader = response.body.getReader();
|
| 707 |
+
const decoder = new TextDecoder('utf-8');
|
| 708 |
+
let buffer = '';
|
| 709 |
+
|
| 710 |
+
while (true) {
|
| 711 |
+
const { value, done } = await reader.read();
|
| 712 |
+
if (done) break;
|
| 713 |
+
buffer += decoder.decode(value, { stream: true });
|
| 714 |
+
const lines = buffer.split('\n\n');
|
| 715 |
+
buffer = lines.pop();
|
| 716 |
+
for (const line of lines) {
|
| 717 |
+
if (!line.startsWith('data: ')) continue;
|
| 718 |
+
const payload = line.slice(6);
|
| 719 |
+
if (payload === '[DONE]') break;
|
| 720 |
+
try {
|
| 721 |
+
const data = JSON.parse(payload);
|
| 722 |
+
if (data.chunk) {
|
| 723 |
+
fullText += data.chunk;
|
| 724 |
+
outputBox.innerText = fullText;
|
| 725 |
+
outputBox.scrollTop = outputBox.scrollHeight;
|
| 726 |
+
}
|
| 727 |
+
} catch (_) {}
|
| 728 |
+
}
|
| 729 |
+
}
|
| 730 |
+
|
| 731 |
+
dotOut.classList.add('active');
|
| 732 |
+
|
| 733 |
+
// ββ Step 2: if Point or Detect β call /api/annotate ββ
|
| 734 |
+
if ((category === 'Point' || category === 'Detect') && fullText.trim()) {
|
| 735 |
+
groundPlaceholder.textContent = 'Annotating imageβ¦';
|
| 736 |
+
groundPlaceholder.style.display = 'flex';
|
| 737 |
+
|
| 738 |
+
try {
|
| 739 |
+
const annotForm = new FormData();
|
| 740 |
+
annotForm.append('image', currentFile);
|
| 741 |
+
annotForm.append('text', fullText);
|
| 742 |
+
annotForm.append('category', category);
|
| 743 |
+
|
| 744 |
+
const annotResp = await fetch('/api/annotate', {
|
| 745 |
+
method: 'POST', body: annotForm,
|
| 746 |
+
});
|
| 747 |
+
if (!annotResp.ok) throw new Error('Annotation request failed');
|
| 748 |
+
|
| 749 |
+
const annotData = await annotResp.json();
|
| 750 |
+
if (annotData.error) {
|
| 751 |
+
resetOverlay('Annotation error: ' + annotData.error);
|
| 752 |
+
} else if (annotData.image_b64) {
|
| 753 |
+
showOverlay(annotData.image_b64);
|
| 754 |
+
} else {
|
| 755 |
+
resetOverlay('No coordinates found in model output.');
|
| 756 |
+
}
|
| 757 |
+
} catch (annotErr) {
|
| 758 |
+
resetOverlay('Annotation failed: ' + annotErr.message);
|
| 759 |
+
console.error('Annotation error:', annotErr);
|
| 760 |
+
}
|
| 761 |
+
} else if (category !== 'Point' && category !== 'Detect') {
|
| 762 |
+
resetOverlay('Active for Point / Detect tasks.\nRun inference to visualise.');
|
| 763 |
+
}
|
| 764 |
+
|
| 765 |
+
} catch (err) {
|
| 766 |
+
outputBox.innerText = `[Error] ${err.message}`;
|
| 767 |
+
outputBox.style.color = '#ff6b6b';
|
| 768 |
+
resetOverlay('Inference error β see Output Stream node.');
|
| 769 |
+
} finally {
|
| 770 |
+
runBtn.disabled = false;
|
| 771 |
+
btnLoader.style.display = 'none';
|
| 772 |
+
dotTask.classList.remove('active');
|
| 773 |
+
allWires.forEach(id => document.getElementById(id)?.classList.remove('active'));
|
| 774 |
+
}
|
| 775 |
+
};
|
| 776 |
+
</script>
|
| 777 |
+
</body>
|
| 778 |
+
</html>
|