Spaces:
Sleeping
Sleeping
Update show_image.html
Browse files- show_image.html +40 -5
show_image.html
CHANGED
|
@@ -3,22 +3,57 @@
|
|
| 3 |
<html lang="ru">
|
| 4 |
<head>
|
| 5 |
<meta charset="UTF-8">
|
| 6 |
-
<title
|
| 7 |
<style>
|
| 8 |
body {
|
| 9 |
font-family: Arial, sans-serif;
|
| 10 |
text-align: center;
|
| 11 |
-
padding:
|
| 12 |
}
|
| 13 |
img {
|
| 14 |
max-width: 90%;
|
| 15 |
height: auto;
|
| 16 |
-
border: 2px solid #
|
|
|
|
| 17 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
</style>
|
| 19 |
</head>
|
| 20 |
<body>
|
| 21 |
-
<h1>Последнее
|
| 22 |
-
<img src="/last_image" alt="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
</body>
|
| 24 |
</html>
|
|
|
|
|
|
| 3 |
<html lang="ru">
|
| 4 |
<head>
|
| 5 |
<meta charset="UTF-8">
|
| 6 |
+
<title>Мониторинг растения</title>
|
| 7 |
<style>
|
| 8 |
body {
|
| 9 |
font-family: Arial, sans-serif;
|
| 10 |
text-align: center;
|
| 11 |
+
padding: 20px;
|
| 12 |
}
|
| 13 |
img {
|
| 14 |
max-width: 90%;
|
| 15 |
height: auto;
|
| 16 |
+
border: 2px solid #000;
|
| 17 |
+
margin-bottom: 20px;
|
| 18 |
}
|
| 19 |
+
.stats {
|
| 20 |
+
font-size: 1.2em;
|
| 21 |
+
margin-top: 10px;
|
| 22 |
+
}
|
| 23 |
+
.green { color: green; }
|
| 24 |
+
.yellow { color: goldenrod; }
|
| 25 |
+
.brown { color: brown; }
|
| 26 |
</style>
|
| 27 |
</head>
|
| 28 |
<body>
|
| 29 |
+
<h1>Последнее изображение растения</h1>
|
| 30 |
+
<img id="plantImage" src="/last_image" alt="Растение">
|
| 31 |
+
<div class="stats">
|
| 32 |
+
<div class="green">Зелёный: <span id="green">0</span>%</div>
|
| 33 |
+
<div class="yellow">Жёлтый: <span id="yellow">0</span>%</div>
|
| 34 |
+
<div class="brown">Коричневый: <span id="brown">0</span>%</div>
|
| 35 |
+
</div>
|
| 36 |
+
|
| 37 |
+
<script>
|
| 38 |
+
function updateImageAndStats() {
|
| 39 |
+
const timestamp = new Date().getTime();
|
| 40 |
+
document.getElementById("plantImage").src = "/last_image?t=" + timestamp;
|
| 41 |
+
|
| 42 |
+
fetch("/color_stats")
|
| 43 |
+
.then(response => response.json())
|
| 44 |
+
.then(data => {
|
| 45 |
+
document.getElementById("green").textContent = data.green;
|
| 46 |
+
document.getElementById("yellow").textContent = data.yellow;
|
| 47 |
+
document.getElementById("brown").textContent = data.brown;
|
| 48 |
+
});
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
// Первичная загрузка
|
| 52 |
+
updateImageAndStats();
|
| 53 |
+
|
| 54 |
+
// Обновление каждые 10 секунд
|
| 55 |
+
setInterval(updateImageAndStats, 10000);
|
| 56 |
+
</script>
|
| 57 |
</body>
|
| 58 |
</html>
|
| 59 |
+
|