Spaces:
Running
Running
Enhance the way the current html displays detections. move detections to one side of the video display. move biome display there as well. maintain all other logic.
Browse files- README.md +8 -5
- index.html +151 -19
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: VisionVortex Watcher ποΈπ
|
| 3 |
+
colorFrom: yellow
|
| 4 |
+
colorTo: yellow
|
| 5 |
+
emoji: π³
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://huggingface.co/deepsite).
|
index.html
CHANGED
|
@@ -1,19 +1,151 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
| 6 |
+
<title>YOLO Webcam + Chat</title>
|
| 7 |
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
| 8 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
| 9 |
+
</head>
|
| 10 |
+
<body class="bg-dark text-white">
|
| 11 |
+
|
| 12 |
+
<div class="container py-4">
|
| 13 |
+
<div class="d-flex justify-content-between align-items-center mb-4">
|
| 14 |
+
<h4>Welcome, {{ username }}</h4>
|
| 15 |
+
<a href="/logout" class="btn btn-outline-light btn-sm">Logout</a>
|
| 16 |
+
</div>
|
| 17 |
+
<div class="row">
|
| 18 |
+
<!-- Webcam Column -->
|
| 19 |
+
<div class="col-md-8 mb-4">
|
| 20 |
+
<div class="text-center">
|
| 21 |
+
<h5>Live Webcam</h5>
|
| 22 |
+
<img src="{{ url_for('video_feed') }}" class="img-fluid rounded" style="max-height: 360px;">
|
| 23 |
+
</div>
|
| 24 |
+
</div>
|
| 25 |
+
|
| 26 |
+
<!-- Detections Column -->
|
| 27 |
+
<div class="col-md-4 mb-4">
|
| 28 |
+
<div class="sticky-top" style="top: 20px;">
|
| 29 |
+
<!-- Biome Display -->
|
| 30 |
+
<div class="mb-3 p-2 bg-info bg-opacity-25 rounded text-center">
|
| 31 |
+
<strong>Current Biome:</strong> <span id="current-biome">Loading...</span>
|
| 32 |
+
</div>
|
| 33 |
+
|
| 34 |
+
<!-- Detection Timeline -->
|
| 35 |
+
<div class="mb-4">
|
| 36 |
+
<h5>Detection Highlights</h5>
|
| 37 |
+
<div id="categorized-timeline" class="bg-secondary rounded p-3" style="max-height: 500px; overflow-y: auto;">
|
| 38 |
+
<p class="text-muted">Loading detection events...</p>
|
| 39 |
+
</div>
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
</div>
|
| 44 |
+
<!-- Group Chat - Full width below -->
|
| 45 |
+
<div class="mb-4">
|
| 46 |
+
<h5>Group Chat</h5>
|
| 47 |
+
<div id="chatbox" class="bg-secondary rounded p-3 mb-3" style="height: 300px; overflow-y: scroll;"></div>
|
| 48 |
+
<div class="input-group">
|
| 49 |
+
<input id="message" class="form-control" placeholder="Type a message...">
|
| 50 |
+
<button class="btn btn-primary" onclick="sendMessage()">Send</button>
|
| 51 |
+
</div>
|
| 52 |
+
</div>
|
| 53 |
+
</div>
|
| 54 |
+
|
| 55 |
+
<script>
|
| 56 |
+
// === Chat Functions ===
|
| 57 |
+
function loadChat() {
|
| 58 |
+
$.get("/chat", function(data) {
|
| 59 |
+
let html = "";
|
| 60 |
+
data.forEach(msg => {
|
| 61 |
+
html += `<p><strong>${msg.user}</strong>: ${msg.message}<br><small class="text-muted">${msg.timestamp}</small></p>`;
|
| 62 |
+
});
|
| 63 |
+
$("#chatbox").html(html).scrollTop(9999);
|
| 64 |
+
});
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
function sendMessage() {
|
| 68 |
+
$.post("/chat", {message: $("#message").val()}, function() {
|
| 69 |
+
$("#message").val("");
|
| 70 |
+
loadChat();
|
| 71 |
+
});
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
// === Detection Timeline (Categorized) ===
|
| 75 |
+
function loadTimeline() {
|
| 76 |
+
$.get("/detections", function(response) {
|
| 77 |
+
// Update current biome
|
| 78 |
+
const biome = response.current_biome || "Unknown";
|
| 79 |
+
// Format biome name: "biome-meadows" β "Meadows"
|
| 80 |
+
const formattedBiome = biome
|
| 81 |
+
.replace(/^biome-/, '')
|
| 82 |
+
.replace(/-/g, ' ')
|
| 83 |
+
.replace(/\b\w/g, l => l.toUpperCase());
|
| 84 |
+
$("#current-biome").text(formattedBiome);
|
| 85 |
+
|
| 86 |
+
// Render categorized events
|
| 87 |
+
const grouped = response.events || {};
|
| 88 |
+
const categoryTitles = {
|
| 89 |
+
"status": "Active Status Effects",
|
| 90 |
+
"recent_buff": "Recent Consumables",
|
| 91 |
+
"boss_ability": "Boss Powers",
|
| 92 |
+
"boss_health": "Boss Health",
|
| 93 |
+
"creature": "Creatures Nearby",
|
| 94 |
+
"crafting": "Crafting Stations",
|
| 95 |
+
"plant": "Plants & Crops",
|
| 96 |
+
"storage": "Storage",
|
| 97 |
+
"vehicle": "Vehicles",
|
| 98 |
+
"world": "World Events",
|
| 99 |
+
"other": "Other"
|
| 100 |
+
};
|
| 101 |
+
|
| 102 |
+
const renderOrder = [
|
| 103 |
+
"status", "recent_buff", "boss_ability", "boss_health",
|
| 104 |
+
"creature", "crafting", "plant", "storage", "vehicle", "world", "other"
|
| 105 |
+
];
|
| 106 |
+
|
| 107 |
+
let html = "";
|
| 108 |
+
let hasContent = false;
|
| 109 |
+
|
| 110 |
+
renderOrder.forEach(cat => {
|
| 111 |
+
const events = grouped[cat];
|
| 112 |
+
if (events && events.length > 0) {
|
| 113 |
+
hasContent = true;
|
| 114 |
+
const title = categoryTitles[cat] || cat.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase());
|
| 115 |
+
html += `<h6 class="mt-3">${title}</h6><div class="ps-2">`;
|
| 116 |
+
events.forEach(e => {
|
| 117 |
+
const conf = (e.confidence * 100).toFixed(0);
|
| 118 |
+
let badgeColor = "secondary";
|
| 119 |
+
if (cat === "status") badgeColor = "warning";
|
| 120 |
+
else if (cat === "boss_health") badgeColor = "danger";
|
| 121 |
+
else if (cat === "creature") badgeColor = "success";
|
| 122 |
+
else if (cat === "recent_buff") badgeColor = "primary";
|
| 123 |
+
else if (cat === "boss_ability") badgeColor = "dark";
|
| 124 |
+
else if (cat === "world") badgeColor = "info";
|
| 125 |
+
html += `<p class="mb-1"><span class="badge bg-${badgeColor}">${e.class}</span> ${conf}%</p>`;
|
| 126 |
+
});
|
| 127 |
+
html += `</div>`;
|
| 128 |
+
}
|
| 129 |
+
});
|
| 130 |
+
|
| 131 |
+
$("#categorized-timeline").html(
|
| 132 |
+
hasContent ? html : "<p class='text-muted'>No active detections.</p>"
|
| 133 |
+
);
|
| 134 |
+
}).fail(() => {
|
| 135 |
+
$("#current-biome").text("Offline");
|
| 136 |
+
$("#categorized-timeline").html("<p class='text-muted'>Failed to load detections.</p>");
|
| 137 |
+
});
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
// === Polling ===
|
| 141 |
+
setInterval(loadChat, 3000);
|
| 142 |
+
setInterval(loadTimeline, 2000);
|
| 143 |
+
|
| 144 |
+
// Initial loads
|
| 145 |
+
loadChat();
|
| 146 |
+
loadTimeline();
|
| 147 |
+
</script>
|
| 148 |
+
|
| 149 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 150 |
+
</body>
|
| 151 |
+
</html>
|