Spaces:
Runtime error
Runtime error
Update index.html
Browse files- index.html +85 -153
index.html
CHANGED
|
@@ -2,125 +2,87 @@
|
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
-
<title>Mesh Reasoner
|
| 6 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 7 |
<script src="https://cdn.plot.ly/plotly-2.24.1.min.js"></script>
|
| 8 |
<style>
|
| 9 |
-
body { background: #06090e; color: #cbd5e1; }
|
| 10 |
-
.glass { background: rgba(15,23,42,0.
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
::-webkit-scrollbar { width: 6px; }
|
| 14 |
-
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px;}
|
| 15 |
</style>
|
| 16 |
</head>
|
| 17 |
-
<body class="flex h-screen overflow-hidden
|
| 18 |
|
| 19 |
-
<aside
|
| 20 |
-
<
|
| 21 |
-
|
| 22 |
-
<
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
<h3 class="font-bold text-orange-400 text-[13px] mb-1 tracking-widest border-b border-slate-800 pb-1">1. EXECUTION PHASE</h3>
|
| 29 |
-
<p class="text-[10.5px] text-slate-400 mb-3 leading-tight font-serif italic">What part of the mesh are we updating? Dimensional space (solving a problem) or internal physics (forming memory)?</p>
|
| 30 |
-
|
| 31 |
-
<select id="engineMode" onchange="sendConfig()" class="text-[13px] py-1.5 cursor-pointer text-white">
|
| 32 |
-
<option value="inference">⚙ INFERENCE (Move space, calculate answers)</option>
|
| 33 |
-
<option value="training">🎯 TRAINING (Lock nodes, optimize stiffness 'K')</option>
|
| 34 |
</select>
|
| 35 |
-
|
| 36 |
-
* In <b>INFERENCE</b>, A & B freely slide to find correct factor numbers. <br>
|
| 37 |
-
* In <b>TRAINING</b>, A & B lock mathematically to objective C; the strain updates their structural memory (K-coef).
|
| 38 |
-
</div>
|
| 39 |
-
</div>
|
| 40 |
|
| 41 |
-
<
|
| 42 |
-
|
| 43 |
-
<
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
<select id="distSplit" onchange="sendConfig()" class="text-[13px] py-1.5 mb-3 cursor-pointer text-white">
|
| 47 |
-
<option value="uniform">DUMB GEOMETRY (50/50 Equal Split Shock)</option>
|
| 48 |
-
<option value="individual">LEARNED BEHAVIOR (Split uses Elastic 'K' modifiers)</option>
|
| 49 |
</select>
|
|
|
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
</div>
|
| 57 |
|
| 58 |
-
<
|
| 59 |
-
|
| 60 |
-
<
|
| 61 |
-
<
|
| 62 |
-
|
| 63 |
-
<select id="probType" onchange="sendConfig()" class="text-[13px] py-1.5 mb-3 cursor-pointer text-white">
|
| 64 |
-
<option value="add">TEST RULE: Alignments (Node A + Node B = Node C)</option>
|
| 65 |
-
<option value="mult">TEST RULE: Multiplication (Node A * Node B = Node C)</option>
|
| 66 |
-
</select>
|
| 67 |
-
|
| 68 |
-
<div class="flex items-center gap-2 mt-4 bg-slate-800/50 p-2 rounded">
|
| 69 |
-
<div class="flex flex-col">
|
| 70 |
-
<span class="font-bold text-[10px] text-green-400">Lock Target Constraint C To:</span>
|
| 71 |
-
<input type="number" id="singleVal" value="45" class="text-center font-mono w-24">
|
| 72 |
-
</div>
|
| 73 |
-
<button onclick="triggerSingle()" class="flex-grow bg-blue-600 hover:bg-blue-500 rounded text-white font-bold h-11 text-xs transition duration-200 uppercase tracking-widest">Single Test Run</button>
|
| 74 |
-
</div>
|
| 75 |
-
</div>
|
| 76 |
|
| 77 |
-
<
|
| 78 |
-
|
| 79 |
-
<h3 class="font-bold text-purple-400 text-[13px] mb-1 tracking-widest border-b border-purple-800/50 pb-1">4. AUTOMATED DATASET PIPELINE</h3>
|
| 80 |
-
<p class="text-[10.5px] text-purple-300/60 mb-3 leading-tight font-serif italic">Continuously feed a batch of changing objective "C" variables. Tests the network's capacity to adjust continuously.</p>
|
| 81 |
-
|
| 82 |
-
<div class="grid grid-cols-2 gap-2 text-xs font-mono mb-4 bg-black/50 p-3 rounded">
|
| 83 |
-
<div> <span class="block text-slate-500">Problem Ct:</span> <input type="number" id="b_count" value="15" class="text-white text-center mt-1"> </div>
|
| 84 |
-
<div> <span class="block text-slate-500">-</span> </div>
|
| 85 |
-
<div> <span class="block text-slate-500">Target MIN:</span> <input type="number" id="b_min" value="10" class="text-white text-center mt-1"> </div>
|
| 86 |
-
<div> <span class="block text-slate-500">Target MAX:</span> <input type="number" id="b_max" value="100" class="text-white text-center mt-1"> </div>
|
| 87 |
-
</div>
|
| 88 |
-
<button onclick="triggerBatch()" class="w-full py-2.5 bg-purple-600 hover:bg-purple-500 text-white font-bold rounded shadow transition tracking-widest text-[12px] uppercase">Initialize Continuous Pipeline</button>
|
| 89 |
-
</div>
|
| 90 |
-
|
| 91 |
-
<button onclick="triggerHalt()" class="w-full py-2 border-2 border-red-900 text-red-500 hover:bg-red-900 hover:text-white text-[13px] font-black uppercase tracking-widest transition">⛔ Halt Server & Clear Queues</button>
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
</div>
|
| 94 |
</aside>
|
| 95 |
|
| 96 |
-
<main class="flex-grow flex flex-col
|
| 97 |
-
<div
|
| 98 |
-
<div class="h-
|
| 99 |
-
|
| 100 |
-
<
|
| 101 |
-
|
| 102 |
-
<
|
| 103 |
</div>
|
| 104 |
-
<!--
|
| 105 |
-
<div class="w-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
<div id="logger">No pipeline initialized...</div>
|
| 109 |
</div>
|
| 110 |
</div>
|
| 111 |
</main>
|
| 112 |
|
| 113 |
<script>
|
| 114 |
-
const endpoint = ''; // Set relative for HF
|
| 115 |
-
|
| 116 |
async function sendConfig() {
|
| 117 |
await fetch('/apply_config', {
|
| 118 |
method: 'POST', headers: {'Content-Type': 'application/json'},
|
| 119 |
body: JSON.stringify({
|
| 120 |
-
mode: document.getElementById('
|
| 121 |
-
distribution:
|
| 122 |
problem_type: document.getElementById('probType').value,
|
| 123 |
-
asymmetric:
|
| 124 |
})
|
| 125 |
});
|
| 126 |
}
|
|
@@ -134,85 +96,55 @@
|
|
| 134 |
}
|
| 135 |
|
| 136 |
async function triggerBatch() {
|
| 137 |
-
await sendConfig();
|
| 138 |
await fetch('/batch_run', {
|
| 139 |
method: 'POST', headers: {'Content-Type':'application/json'},
|
| 140 |
body: JSON.stringify({
|
| 141 |
batch_size: document.getElementById('b_count').value,
|
| 142 |
-
val_min:
|
| 143 |
-
val_max: document.getElementById('b_max').value
|
| 144 |
})
|
| 145 |
});
|
| 146 |
}
|
| 147 |
-
|
| 148 |
-
async function triggerHalt() { await fetch('/halt', { method: 'POST'}); }
|
| 149 |
|
| 150 |
-
/
|
|
|
|
| 151 |
setInterval(async () => {
|
| 152 |
try {
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
Object.keys(d.nodes).forEach(id => {
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
// Graph tooltip content
|
| 171 |
-
hoverData.push(`VERTEX ${id}<br>Solution Coord: ${v.x.toFixed(3)}<br>Phys Memory (K): ${v.k.toFixed(4)}`);
|
| 172 |
-
|
| 173 |
-
// Lower Left Window output formatting
|
| 174 |
-
let nodeColor = v.anchored ? 'text-red-300' : 'text-sky-300';
|
| 175 |
-
systemLogHeader += `
|
| 176 |
-
<div class="py-1">
|
| 177 |
-
<span class="${nodeColor}">◆ [ VERTEX ${id} ]</span> <span class="text-slate-500 font-bold ml-1">${stateLockTxt}</span><br>
|
| 178 |
-
├─ Structural Answer (Dim X) <span class='text-white bg-slate-800 rounded px-1.5 ml-2 font-black shadow shadow-black'>${v.x.toFixed(6)}</span><br>
|
| 179 |
-
└─ Latent Cell Mod (Stiff-K) <span class='text-purple-300 ml-2 font-mono'>${v.k.toFixed(6)}</span>
|
| 180 |
-
</div>
|
| 181 |
-
`;
|
| 182 |
});
|
| 183 |
-
|
| 184 |
-
document.getElementById('
|
| 185 |
-
|
| 186 |
-
//
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
// Draw Network Lines visually via Plotly
|
| 190 |
-
let DrawShapeParams = {
|
| 191 |
type: 'scatter3d', mode: 'lines+markers+text',
|
| 192 |
x: px.concat([px[0]]), y: py.concat([py[0]]), z: pz.concat([pz[0]]),
|
| 193 |
-
text:
|
| 194 |
-
textfont:{color:'rgba(255,255,255,0.7)',size:12, family:'system-ui, monospace'},
|
| 195 |
-
textposition: 'top left',
|
| 196 |
-
hoverinfo: 'text', hovertext: hoverData.concat(['']),
|
| 197 |
-
line: {color: isTraining ? 'rgba(239, 68, 68, 0.6)':'rgba(56, 189, 248, 0.6)', width: 5},
|
| 198 |
-
marker: {size: 14, line:{width:2, color:'#1e293b'}, color:['#fb923c','#c084fc','#38bdf8']}
|
| 199 |
};
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
scene: {
|
| 204 |
-
camera: { eye: {x:0, y:-1.5, z:1.3} },
|
| 205 |
-
xaxis: {title:'Constraint Values (Latent Logic X Axis)', color:'white', gridcolor:'#1e293b'},
|
| 206 |
-
yaxis: {title:'System Shift Y', color:'#475569', gridcolor:'#1e293b', zerolinecolor:'#475569'},
|
| 207 |
-
zaxis: {title:'System Shift Z', color:'#475569', gridcolor:'#1e293b', zerolinecolor:'#475569'}
|
| 208 |
-
}
|
| 209 |
};
|
|
|
|
|
|
|
| 210 |
|
| 211 |
-
if(!window.plotlyRun){ Plotly.newPlot('plot',[DrawShapeParams], SceneLayout, {responsive:true}); window.plotlyRun = true; }
|
| 212 |
-
else { Plotly.react('plot', [DrawShapeParams], SceneLayout); }
|
| 213 |
-
|
| 214 |
} catch(e) {}
|
| 215 |
-
},
|
| 216 |
</script>
|
| 217 |
</body>
|
| 218 |
</html>
|
|
|
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
+
<title>Mesh Reasoner Lab</title>
|
| 6 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 7 |
<script src="https://cdn.plot.ly/plotly-2.24.1.min.js"></script>
|
| 8 |
<style>
|
| 9 |
+
body { background: #06090e; color: #cbd5e1; font-family: monospace; }
|
| 10 |
+
.glass { background: rgba(15,23,42,0.9); border: 1px solid #334155; }
|
| 11 |
+
.force-pos { color: #4ade80; }
|
| 12 |
+
.force-neg { color: #f87171; }
|
|
|
|
|
|
|
| 13 |
</style>
|
| 14 |
</head>
|
| 15 |
+
<body class="flex h-screen overflow-hidden">
|
| 16 |
|
| 17 |
+
<aside class="w-96 glass p-4 flex flex-col gap-4 overflow-y-auto">
|
| 18 |
+
<h1 class="text-blue-400 font-bold border-b border-slate-700 pb-2">TOPOLOGICAL DIALS</h1>
|
| 19 |
+
|
| 20 |
+
<div class="space-y-4 text-xs">
|
| 21 |
+
<section>
|
| 22 |
+
<label class="text-slate-500">PHASE</label>
|
| 23 |
+
<select id="mode" onchange="sendConfig()" class="w-full bg-slate-900 border border-slate-700 p-1">
|
| 24 |
+
<option value="inference">INFERENCE (Solving)</option>
|
| 25 |
+
<option value="training">TRAINING (Learning K)</option>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
</select>
|
| 27 |
+
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
<section>
|
| 30 |
+
<label class="text-slate-500">CONSTRAINT LOGIC</label>
|
| 31 |
+
<select id="probType" onchange="sendConfig()" class="w-full bg-slate-900 border border-slate-700 p-1">
|
| 32 |
+
<option value="add">A + B = C</option>
|
| 33 |
+
<option value="mult">A * B = C</option>
|
|
|
|
|
|
|
|
|
|
| 34 |
</select>
|
| 35 |
+
</section>
|
| 36 |
|
| 37 |
+
<section class="border-t border-slate-800 pt-2">
|
| 38 |
+
<label class="text-green-400">TARGET C:</label>
|
| 39 |
+
<input type="number" id="singleVal" value="45" class="w-full bg-black border border-slate-700 p-1 text-center">
|
| 40 |
+
<button onclick="triggerSingle()" class="w-full bg-blue-700 mt-2 py-1 font-bold">ENGAGE SINGLE RUN</button>
|
| 41 |
+
</section>
|
|
|
|
| 42 |
|
| 43 |
+
<section class="bg-slate-900 p-2 rounded">
|
| 44 |
+
<label class="text-purple-400">BATCH TEST SETS:</label>
|
| 45 |
+
<input type="number" id="b_count" value="10" class="w-full bg-black border border-slate-700 p-1 mb-1">
|
| 46 |
+
<button onclick="triggerBatch()" class="w-full bg-purple-700 py-1 font-bold">START BATCH RUN</button>
|
| 47 |
+
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
<button onclick="triggerHalt()" class="w-full border border-red-500 text-red-500 py-1 hover:bg-red-900">RESET ENGINE</button>
|
| 50 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
+
<div class="mt-auto border-t border-slate-800 pt-4">
|
| 53 |
+
<h3 class="text-xs text-orange-400">LIVE SYSTEM ERROR</h3>
|
| 54 |
+
<div id="error-meter" class="text-2xl font-bold">0.000</div>
|
| 55 |
+
<div class="w-full bg-slate-800 h-2 mt-1 rounded-full overflow-hidden">
|
| 56 |
+
<div id="error-bar" class="bg-red-500 h-full transition-all" style="width: 0%"></div>
|
| 57 |
+
</div>
|
| 58 |
</div>
|
| 59 |
</aside>
|
| 60 |
|
| 61 |
+
<main class="flex-grow flex flex-col">
|
| 62 |
+
<div id="plot" class="flex-grow"></div>
|
| 63 |
+
<div class="h-64 border-t border-slate-700 flex bg-black/50">
|
| 64 |
+
<!-- Force Meters -->
|
| 65 |
+
<div id="force-tracker" class="w-1/2 p-4 border-r border-slate-800 text-[11px] overflow-y-auto">
|
| 66 |
+
<h4 class="text-blue-300 mb-2 underline">NODE FORCE VECTORS</h4>
|
| 67 |
+
<div id="node-details">Waiting...</div>
|
| 68 |
</div>
|
| 69 |
+
<!-- Event Log -->
|
| 70 |
+
<div id="logger" class="w-1/2 p-4 text-[10px] text-slate-500 overflow-y-auto">
|
| 71 |
+
<h4 class="text-slate-400 mb-2">EVENT LOG</h4>
|
| 72 |
+
<div id="log-content">...</div>
|
|
|
|
| 73 |
</div>
|
| 74 |
</div>
|
| 75 |
</main>
|
| 76 |
|
| 77 |
<script>
|
|
|
|
|
|
|
| 78 |
async function sendConfig() {
|
| 79 |
await fetch('/apply_config', {
|
| 80 |
method: 'POST', headers: {'Content-Type': 'application/json'},
|
| 81 |
body: JSON.stringify({
|
| 82 |
+
mode: document.getElementById('mode').value,
|
| 83 |
+
distribution: 'individual',
|
| 84 |
problem_type: document.getElementById('probType').value,
|
| 85 |
+
asymmetric: false
|
| 86 |
})
|
| 87 |
});
|
| 88 |
}
|
|
|
|
| 96 |
}
|
| 97 |
|
| 98 |
async function triggerBatch() {
|
|
|
|
| 99 |
await fetch('/batch_run', {
|
| 100 |
method: 'POST', headers: {'Content-Type':'application/json'},
|
| 101 |
body: JSON.stringify({
|
| 102 |
batch_size: document.getElementById('b_count').value,
|
| 103 |
+
val_min: 10, val_max: 100
|
|
|
|
| 104 |
})
|
| 105 |
});
|
| 106 |
}
|
|
|
|
|
|
|
| 107 |
|
| 108 |
+
async function triggerHalt() { await fetch('/halt', {method: 'POST'}); }
|
| 109 |
+
|
| 110 |
setInterval(async () => {
|
| 111 |
try {
|
| 112 |
+
const r = await fetch('/state');
|
| 113 |
+
const d = await r.json();
|
| 114 |
+
|
| 115 |
+
// 1. Update Error UI
|
| 116 |
+
const err = Math.abs(d.error);
|
| 117 |
+
document.getElementById('error-meter').innerText = d.error.toFixed(4);
|
| 118 |
+
document.getElementById('error-bar').style.width = Math.min(100, err * 2) + "%";
|
| 119 |
+
document.getElementById('error-meter').className = err < 0.1 ? "text-green-400 text-2xl font-bold" : "text-red-400 text-2xl font-bold";
|
| 120 |
+
|
| 121 |
+
// 2. Update Force UI
|
| 122 |
+
let forceHTML = "";
|
| 123 |
+
let px=[], py=[], pz=[], ids=[];
|
| 124 |
Object.keys(d.nodes).forEach(id => {
|
| 125 |
+
const n = d.nodes[id];
|
| 126 |
+
const fClass = n.force > 0 ? "force-pos" : "force-neg";
|
| 127 |
+
forceHTML += `<div>NODE ${id}: X=[${n.x.toFixed(2)}] | <span class="${fClass}">FORCE: ${n.force.toFixed(4)}</span> | K: ${n.k.toFixed(3)}</div>`;
|
| 128 |
+
px.push(n.x); py.push(n.y); pz.push(n.z); ids.push(id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
});
|
| 130 |
+
document.getElementById('node-details').innerHTML = forceHTML;
|
| 131 |
+
document.getElementById('log-content').innerHTML = d.logs.map(l => `<div>${l}</div>`).join('');
|
| 132 |
+
|
| 133 |
+
// 3. Update Plot
|
| 134 |
+
const trace = {
|
|
|
|
|
|
|
|
|
|
| 135 |
type: 'scatter3d', mode: 'lines+markers+text',
|
| 136 |
x: px.concat([px[0]]), y: py.concat([py[0]]), z: pz.concat([pz[0]]),
|
| 137 |
+
text: ids.concat(['']), marker: {size: 10, color: ['#fb923c','#c084fc','#38bdf8']}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
};
|
| 139 |
+
const layout = {
|
| 140 |
+
margin: {l:0,r:0,t:0,b:0}, paper_bgcolor: 'transparent',
|
| 141 |
+
scene: { xaxis: {range: [-10, 110]}, yaxis: {range: [-5, 5]}, zaxis: {range: [-5, 5]} }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
};
|
| 143 |
+
if(!window.plotted){ Plotly.newPlot('plot', [trace], layout); window.plotted=true; }
|
| 144 |
+
else { Plotly.react('plot', [trace], layout); }
|
| 145 |
|
|
|
|
|
|
|
|
|
|
| 146 |
} catch(e) {}
|
| 147 |
+
}, 150);
|
| 148 |
</script>
|
| 149 |
</body>
|
| 150 |
</html>
|