Skip to content

Commit

Permalink
adding new element for prediction
Browse files Browse the repository at this point in the history
  • Loading branch information
chabazite committed Nov 28, 2023
1 parent ab88534 commit 5672647
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/webapp/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ ws.onerror = (error) => {
ws.onmessage = (event) => {
try {
const data = JSON.parse(event.data);
// Update the web page with new data
// Existing data updates
document.getElementById('heat-index').textContent = data.heat_index.toFixed(2);
document.getElementById('humidity').textContent = data.humidity;
document.getElementById('temperature').textContent = data.temperature.toFixed(2);
document.getElementById('datetime').textContent = data.datetime;
document.getElementById('prediction').textContent = prediction.max_mean.toFixed(2);
// New prediction data updates
if(data.mean_max) {
document.getElementById('prediction').textContent = data.mean_max.toFixed(2);
}
} catch (error) {
console.error('Error parsing WebSocket data:', error);
}
};

ws.onclose = () => {
console.log('WebSocket connection closed');
};

0 comments on commit 5672647

Please sign in to comment.