Spaces:
Runtime error
Runtime error
Update index.html
Browse files- index.html +43 -87
index.html
CHANGED
|
@@ -3,12 +3,12 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<script src="https://cdn.plot.ly/plotly-2.24.1.min.js"></script>
|
| 9 |
<style>
|
| 10 |
body { background: #06090e; color: #cbd5e1; font-family: monospace; }
|
| 11 |
-
.glass { background: rgba(15,23,42,0.
|
| 12 |
#drawer { transition: transform 0.3s ease-in-out; z-index: 100; }
|
| 13 |
.drawer-hidden { transform: translateY(100%); }
|
| 14 |
</style>
|
|
@@ -16,143 +16,99 @@
|
|
| 16 |
<body class="flex flex-col h-screen overflow-hidden">
|
| 17 |
|
| 18 |
<header class="glass p-3 flex justify-between items-center z-10">
|
| 19 |
-
<h1
|
| 20 |
-
<button onclick="toggleDrawer()" class="bg-blue-600 px-4 py-1 rounded text-white text-xs font-bold">
|
| 21 |
</header>
|
| 22 |
|
| 23 |
-
<
|
| 24 |
-
<aside id="drawer" class="fixed inset-x-0 bottom-0 drawer-hidden glass p-5 flex flex-col gap-5 max-h-[90vh] overflow-y-auto">
|
| 25 |
<div class="flex justify-between items-center border-b border-slate-700 pb-2">
|
| 26 |
-
<span class="text-orange-400 font-bold">
|
| 27 |
-
<button onclick="toggleDrawer()" class="text-slate-400 text-
|
| 28 |
</div>
|
| 29 |
|
| 30 |
<div class="space-y-4">
|
| 31 |
<section>
|
| 32 |
-
<label class="text-slate-500 text-[10px]">
|
| 33 |
-
<
|
| 34 |
-
<option value="training">TRAINING (Learn K factor)</option>
|
| 35 |
-
<option value="inference">INFERENCE (Predict Output C)</option>
|
| 36 |
-
</select>
|
| 37 |
</section>
|
| 38 |
|
| 39 |
<section>
|
| 40 |
-
<label class="text-slate-500 text-[10px]">
|
| 41 |
-
<select id="
|
| 42 |
-
<option value="
|
| 43 |
-
<option value="
|
|
|
|
| 44 |
</select>
|
| 45 |
</section>
|
| 46 |
|
| 47 |
-
<section
|
| 48 |
-
<label class="text-
|
| 49 |
-
<
|
| 50 |
-
|
| 51 |
-
<
|
| 52 |
-
|
| 53 |
-
</div>
|
| 54 |
-
</section>
|
| 55 |
-
|
| 56 |
-
<section class="bg-blue-900/20 p-4 rounded border border-blue-800">
|
| 57 |
-
<label class="text-blue-400 font-bold text-xs">CUSTOM INPUT TEST (A & B)</label>
|
| 58 |
-
<div class="grid grid-cols-2 gap-2 mt-2">
|
| 59 |
-
<input type="number" id="custom_a" value="7" class="bg-black text-center p-2 border border-slate-700">
|
| 60 |
-
<input type="number" id="custom_b" value="8" class="bg-black text-center p-2 border border-slate-700">
|
| 61 |
-
</div>
|
| 62 |
-
<button onclick="testCustom()" class="w-full bg-blue-700 mt-2 py-3 font-bold text-xs rounded uppercase">Run Prediction</button>
|
| 63 |
</section>
|
| 64 |
|
| 65 |
-
<button onclick="
|
|
|
|
|
|
|
| 66 |
</div>
|
| 67 |
</aside>
|
| 68 |
|
| 69 |
<main class="flex-grow flex flex-col min-h-0">
|
| 70 |
<div id="plot" class="flex-grow"></div>
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
<div class="
|
| 74 |
-
<h4 class="text-blue-300 text-[10px] font-bold">LIVE TOPOLOGY</h4>
|
| 75 |
-
<div id="error-val" class="text-xs font-bold text-red-400">ERR: 0.000</div>
|
| 76 |
-
</div>
|
| 77 |
-
<div id="nodes-ui" class="space-y-1 text-[11px] font-mono"></div>
|
| 78 |
-
<div id="logs" class="mt-auto pt-2 border-t border-slate-800 text-[9px] text-slate-500 h-20 overflow-y-auto"></div>
|
| 79 |
</div>
|
| 80 |
</main>
|
| 81 |
|
| 82 |
<script>
|
| 83 |
-
|
| 84 |
-
function toggleDrawer() { drawer.classList.toggle('drawer-hidden'); }
|
| 85 |
|
| 86 |
-
async function
|
| 87 |
-
const type = document.getElementById('logicType').value;
|
| 88 |
-
document.getElementById('logic-label').innerText = "LOGIC: " + type.toUpperCase();
|
| 89 |
await fetch('/config', {
|
| 90 |
method: 'POST', headers: {'Content-Type': 'application/json'},
|
| 91 |
body: JSON.stringify({
|
| 92 |
mode: document.getElementById('mode').value,
|
| 93 |
-
|
|
|
|
| 94 |
})
|
| 95 |
});
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
async function genBatch() {
|
| 99 |
toggleDrawer();
|
| 100 |
-
await fetch('/generate_batch', {
|
| 101 |
-
method: 'POST', headers: {'Content-Type':'application/json'},
|
| 102 |
-
body: JSON.stringify({ count: document.getElementById('batch_count').value })
|
| 103 |
-
});
|
| 104 |
}
|
| 105 |
|
| 106 |
-
async function
|
|
|
|
| 107 |
toggleDrawer();
|
| 108 |
-
await fetch('/test_custom', {
|
| 109 |
-
method: 'POST', headers: {'Content-Type':'application/json'},
|
| 110 |
-
body: JSON.stringify({ a: document.getElementById('custom_a').value, b: document.getElementById('custom_b').value })
|
| 111 |
-
});
|
| 112 |
}
|
| 113 |
|
| 114 |
-
async function
|
| 115 |
|
| 116 |
setInterval(async () => {
|
| 117 |
try {
|
| 118 |
const res = await fetch('/state');
|
| 119 |
const d = await res.json();
|
| 120 |
-
document.getElementById('error-val').innerText = "
|
| 121 |
-
document.getElementById('error-val').className = Math.abs(d.error) < 0.05 ? "text-green-400 font-bold" : "text-red-400 font-bold";
|
| 122 |
|
| 123 |
let ui = "";
|
| 124 |
let px=[], py=[], pz=[], ids=[];
|
| 125 |
-
Object.keys(d.nodes).forEach(id => {
|
| 126 |
const n = d.nodes[id];
|
| 127 |
-
ui += `<div class="
|
| 128 |
-
|
| 129 |
-
<span class="text-slate-500 italic">K=${n.k.toFixed(4)} | F=${n.f.toFixed(3)}</span>
|
| 130 |
-
</div>`;
|
| 131 |
-
px.push(n.x); py.push(id==='A'?1:id==='B'?-1:0); pz.push(0); ids.push(id);
|
| 132 |
});
|
| 133 |
document.getElementById('nodes-ui').innerHTML = ui;
|
| 134 |
-
document.getElementById('logs').innerHTML = d.logs.map(l => `<div>${l}</div>`).join('');
|
| 135 |
|
| 136 |
const trace = {
|
| 137 |
-
type: 'scatter3d', mode: '
|
| 138 |
-
x: px
|
| 139 |
-
text: ids
|
| 140 |
-
marker: {size: 10, color:['#fb923c','#c084fc','#38bdf8']},
|
| 141 |
-
line: {color:'#334155', width:2}
|
| 142 |
-
};
|
| 143 |
-
const layout = {
|
| 144 |
-
margin:{l:0,r:0,t:0,b:0}, paper_bgcolor:'transparent',
|
| 145 |
-
scene:{
|
| 146 |
-
xaxis:{color:'#475569', title:'COORD'},
|
| 147 |
-
yaxis:{range:[-2,2], visible:false},
|
| 148 |
-
zaxis:{range:[-2,2], visible:false},
|
| 149 |
-
camera: {eye:{x:0, y:-1.8, z:0.8}}
|
| 150 |
-
}
|
| 151 |
};
|
| 152 |
-
if(!window.plotted){ Plotly.newPlot('plot', [trace],
|
| 153 |
-
else { Plotly.react('plot', [trace]
|
| 154 |
} catch(e){}
|
| 155 |
-
},
|
| 156 |
</script>
|
| 157 |
</body>
|
| 158 |
</html>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Multicellular Mesh Engine</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<script src="https://cdn.plot.ly/plotly-2.24.1.min.js"></script>
|
| 9 |
<style>
|
| 10 |
body { background: #06090e; color: #cbd5e1; font-family: monospace; }
|
| 11 |
+
.glass { background: rgba(15,23,42,0.95); border: 1px solid #334155; }
|
| 12 |
#drawer { transition: transform 0.3s ease-in-out; z-index: 100; }
|
| 13 |
.drawer-hidden { transform: translateY(100%); }
|
| 14 |
</style>
|
|
|
|
| 16 |
<body class="flex flex-col h-screen overflow-hidden">
|
| 17 |
|
| 18 |
<header class="glass p-3 flex justify-between items-center z-10">
|
| 19 |
+
<h1 class="text-blue-400 font-bold text-xs uppercase">Multicellular Mesh</h1>
|
| 20 |
+
<button onclick="toggleDrawer()" class="bg-blue-600 px-4 py-1 rounded text-white text-xs font-bold font-sans">MESH CONFIG</button>
|
| 21 |
</header>
|
| 22 |
|
| 23 |
+
<aside id="drawer" class="fixed inset-x-0 bottom-0 drawer-hidden glass p-6 flex flex-col gap-4 z-50 max-h-[90vh] overflow-y-auto">
|
|
|
|
| 24 |
<div class="flex justify-between items-center border-b border-slate-700 pb-2">
|
| 25 |
+
<span class="text-orange-400 font-bold">MESH ARCHITECTURE</span>
|
| 26 |
+
<button onclick="toggleDrawer()" class="text-slate-400 text-xl">✕</button>
|
| 27 |
</div>
|
| 28 |
|
| 29 |
<div class="space-y-4">
|
| 30 |
<section>
|
| 31 |
+
<label class="text-slate-500 text-[10px]">MESH DEPTH (Hidden Cells between A-C / B-C)</label>
|
| 32 |
+
<input type="number" id="meshDepth" value="3" class="w-full bg-black border border-slate-700 p-3 text-blue-400 font-bold">
|
|
|
|
|
|
|
|
|
|
| 33 |
</section>
|
| 34 |
|
| 35 |
<section>
|
| 36 |
+
<label class="text-slate-500 text-[10px]">PROBLEM DOMAIN</label>
|
| 37 |
+
<select id="probType" class="w-full bg-slate-900 border border-slate-700 p-3 text-white rounded">
|
| 38 |
+
<option value="housing">Housing (Loc ID + Size -> Price)</option>
|
| 39 |
+
<option value="sub">Subtraction (A - B = C)</option>
|
| 40 |
+
<option value="div">Division (A / B = C)</option>
|
| 41 |
</select>
|
| 42 |
</section>
|
| 43 |
|
| 44 |
+
<section>
|
| 45 |
+
<label class="text-slate-500 text-[10px]">PHASE</label>
|
| 46 |
+
<select id="mode" class="w-full bg-slate-900 border border-slate-700 p-3 text-white rounded">
|
| 47 |
+
<option value="training">TRAINING (Learn Relationships)</option>
|
| 48 |
+
<option value="inference">INFERENCE (Predict Output)</option>
|
| 49 |
+
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
</section>
|
| 51 |
|
| 52 |
+
<button onclick="applyConfig()" class="w-full bg-blue-700 py-3 font-bold rounded">APPLY & RESET MESH</button>
|
| 53 |
+
<button onclick="genData()" class="w-full bg-purple-700 py-3 font-bold rounded">START DATASET RUN</button>
|
| 54 |
+
<button onclick="halt()" class="w-full border border-red-500 text-red-500 py-3 rounded">HALT</button>
|
| 55 |
</div>
|
| 56 |
</aside>
|
| 57 |
|
| 58 |
<main class="flex-grow flex flex-col min-h-0">
|
| 59 |
<div id="plot" class="flex-grow"></div>
|
| 60 |
+
<div class="h-48 glass border-t border-slate-700 p-4 font-mono text-[10px]">
|
| 61 |
+
<div id="error-val" class="text-lg font-bold text-red-400 mb-2">ERR: 0.000</div>
|
| 62 |
+
<div id="nodes-ui" class="grid grid-cols-2 gap-2 h-24 overflow-y-auto"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
</div>
|
| 64 |
</main>
|
| 65 |
|
| 66 |
<script>
|
| 67 |
+
function toggleDrawer() { document.getElementById('drawer').classList.toggle('drawer-hidden'); }
|
|
|
|
| 68 |
|
| 69 |
+
async function applyConfig() {
|
|
|
|
|
|
|
| 70 |
await fetch('/config', {
|
| 71 |
method: 'POST', headers: {'Content-Type': 'application/json'},
|
| 72 |
body: JSON.stringify({
|
| 73 |
mode: document.getElementById('mode').value,
|
| 74 |
+
depth: document.getElementById('meshDepth').value,
|
| 75 |
+
type: document.getElementById('probType').value
|
| 76 |
})
|
| 77 |
});
|
|
|
|
|
|
|
|
|
|
| 78 |
toggleDrawer();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
}
|
| 80 |
|
| 81 |
+
async function genData() {
|
| 82 |
+
await fetch('/generate', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({}) });
|
| 83 |
toggleDrawer();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
}
|
| 85 |
|
| 86 |
+
async function halt() { await fetch('/halt', {method: 'POST'}); toggleDrawer(); }
|
| 87 |
|
| 88 |
setInterval(async () => {
|
| 89 |
try {
|
| 90 |
const res = await fetch('/state');
|
| 91 |
const d = await res.json();
|
| 92 |
+
document.getElementById('error-val').innerText = "SYSTEM TENSION: " + d.error.toFixed(4);
|
|
|
|
| 93 |
|
| 94 |
let ui = "";
|
| 95 |
let px=[], py=[], pz=[], ids=[];
|
| 96 |
+
Object.keys(d.nodes).sort().forEach(id => {
|
| 97 |
const n = d.nodes[id];
|
| 98 |
+
ui += `<div>${id}: <b>${n.x.toFixed(2)}</b> <span class="text-slate-600">K:${n.k.toFixed(2)}</span></div>`;
|
| 99 |
+
px.push(n.x); py.push(n.y); pz.push(0); ids.push(id);
|
|
|
|
|
|
|
|
|
|
| 100 |
});
|
| 101 |
document.getElementById('nodes-ui').innerHTML = ui;
|
|
|
|
| 102 |
|
| 103 |
const trace = {
|
| 104 |
+
type: 'scatter3d', mode: 'markers+text',
|
| 105 |
+
x: px, y: py, z: pz,
|
| 106 |
+
text: ids, marker: {size: 8, color:'#38bdf8'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
};
|
| 108 |
+
if(!window.plotted){ Plotly.newPlot('plot', [trace], {margin:{l:0,r:0,t:0,b:0}, paper_bgcolor:'transparent', scene:{camera:{eye:{x:1.5,y:1.5,z:1.5}}}}, {displayModeBar:false}); window.plotted=true; }
|
| 109 |
+
else { Plotly.react('plot', [trace]); }
|
| 110 |
} catch(e){}
|
| 111 |
+
}, 300);
|
| 112 |
</script>
|
| 113 |
</body>
|
| 114 |
</html>
|