sanketskg commited on
Commit
cc91020
·
verified ·
1 Parent(s): cf73907

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. static/index.html +11 -8
static/index.html CHANGED
@@ -13,7 +13,7 @@
13
  .sensor-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f9f9f9; }
14
  .sensor-item label { width: 100px; font-weight: bold; font-size: 0.85em; color: #555; }
15
  .sensor-item input[type=range] { flex: 1; margin: 0 10px; }
16
- .sensor-item span { width: 40px; text-align: right; font-family: monospace; font-size: 0.9em; background: #eee; padding: 2px 5px; border-radius: 3px; }
17
  .array-view { background: #1e1e1e; color: #4af626; padding: 15px; border-radius: 6px; font-family: monospace; font-size: 0.9em; word-wrap: break-word; line-height: 1.6; margin-bottom: 20px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.3); }
18
  .btn { background: #007bff; color: white; border: none; padding: 12px 15px; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 1em; width: 100%; margin-bottom: 10px; transition: background 0.2s; }
19
  .btn:hover { background: #0056b3; }
@@ -79,11 +79,11 @@
79
  const li = document.createElement('li');
80
  li.className = 'sensor-item';
81
  // Flex sensors typically map from 0 to 90 degrees or arbitrary voltage.
82
- // MPUs map from -2g to +2g or similar. We use -10 to +10 as a general sandbox.
83
  li.innerHTML = `
84
  <label>${name}</label>
85
- <input type="range" id="slider${i}" min="-10" max="10" step="0.1" value="${sensors[i]}" oninput="updateSensor(${i}, this.value)">
86
- <span id="val${i}">${sensors[i].toFixed(1)}</span>
87
  `;
88
  listEl.appendChild(li);
89
  });
@@ -92,12 +92,15 @@
92
 
93
  function updateSensor(i, val) {
94
  sensors[i] = parseFloat(val);
95
- document.getElementById(`val${i}`).innerText = sensors[i].toFixed(1);
 
 
 
96
  updateArrayView();
97
  }
98
 
99
  function updateArrayView() {
100
- arrayView.innerText = '[\n ' + sensors.map(s => s.toFixed(1)).join(', ') + '\n]';
101
  }
102
 
103
  function loadExampleData() {
@@ -128,8 +131,8 @@
128
  const slider = document.getElementById(`slider${i}`);
129
  if (slider) slider.value = sensors[i];
130
 
131
- const span = document.getElementById(`val${i}`);
132
- if (span) span.innerText = sensors[i].toFixed(1);
133
  }
134
  updateArrayView();
135
  // Removed auto-predict so you have to click Predict manually
 
13
  .sensor-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f9f9f9; }
14
  .sensor-item label { width: 100px; font-weight: bold; font-size: 0.85em; color: #555; }
15
  .sensor-item input[type=range] { flex: 1; margin: 0 10px; }
16
+ .sensor-item input[type=number] { width: 60px; text-align: right; font-family: monospace; font-size: 0.9em; background: #eee; padding: 2px 5px; border: 1px solid #ccc; border-radius: 3px; }
17
  .array-view { background: #1e1e1e; color: #4af626; padding: 15px; border-radius: 6px; font-family: monospace; font-size: 0.9em; word-wrap: break-word; line-height: 1.6; margin-bottom: 20px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.3); }
18
  .btn { background: #007bff; color: white; border: none; padding: 12px 15px; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 1em; width: 100%; margin-bottom: 10px; transition: background 0.2s; }
19
  .btn:hover { background: #0056b3; }
 
79
  const li = document.createElement('li');
80
  li.className = 'sensor-item';
81
  // Flex sensors typically map from 0 to 90 degrees or arbitrary voltage.
82
+ // MPUs map from -2g to +2g or similar. We use -30 to +30 as a general sandbox.
83
  li.innerHTML = `
84
  <label>${name}</label>
85
+ <input type="range" id="slider${i}" min="-30" max="30" step="0.01" value="${sensors[i]}" oninput="updateSensor(${i}, this.value)">
86
+ <input type="number" id="val${i}" step="0.01" value="${sensors[i].toFixed(2)}" oninput="updateSensor(${i}, this.value)">
87
  `;
88
  listEl.appendChild(li);
89
  });
 
92
 
93
  function updateSensor(i, val) {
94
  sensors[i] = parseFloat(val);
95
+ const slider = document.getElementById(`slider${i}`);
96
+ const numInput = document.getElementById(`val${i}`);
97
+ if(slider && slider.value !== val) slider.value = val;
98
+ if(numInput && numInput.value !== val) numInput.value = val;
99
  updateArrayView();
100
  }
101
 
102
  function updateArrayView() {
103
+ arrayView.innerText = '[\n ' + sensors.map(s => s.toFixed(2)).join(', ') + '\n]';
104
  }
105
 
106
  function loadExampleData() {
 
131
  const slider = document.getElementById(`slider${i}`);
132
  if (slider) slider.value = sensors[i];
133
 
134
+ const numInput = document.getElementById(`val${i}`);
135
+ if (numInput) numInput.value = sensors[i].toFixed(2);
136
  }
137
  updateArrayView();
138
  // Removed auto-predict so you have to click Predict manually