scrypted-detection-trainer 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.nodejs.js +1 -1
- package/dist/main.nodejs.js.map +1 -1
- package/dist/plugin.zip +0 -0
- package/out/main.nodejs.js +19 -13
- package/out/main.nodejs.js.map +1 -1
- package/out/plugin.zip +0 -0
- package/package.json +1 -1
- package/src/main.ts +21 -15
package/out/plugin.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/main.ts
CHANGED
|
@@ -502,7 +502,7 @@ class DetectionTrainer extends ScryptedDeviceBase implements Settings, HttpReque
|
|
|
502
502
|
<div class="toast" id="toast"></div>
|
|
503
503
|
|
|
504
504
|
<script>
|
|
505
|
-
const BASE = location.pathname.
|
|
505
|
+
const BASE = location.pathname.endsWith('/') ? location.pathname.slice(0, -1) : location.pathname;
|
|
506
506
|
let pending = [];
|
|
507
507
|
let labeledCount = 0;
|
|
508
508
|
|
|
@@ -530,20 +530,21 @@ function toast(msg, color='#1a3') {
|
|
|
530
530
|
}
|
|
531
531
|
|
|
532
532
|
async function loadPending() {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
533
|
+
try {
|
|
534
|
+
const res = await fetch(BASE + '/api/pending');
|
|
535
|
+
pending = await res.json();
|
|
536
|
+
|
|
537
|
+
const statsRes = await fetch(BASE + '/api/stats');
|
|
538
|
+
const stats = await statsRes.json();
|
|
539
|
+
document.getElementById('stat-pending').textContent = stats.pending;
|
|
540
|
+
document.getElementById('stat-labeled').textContent = stats.labeled;
|
|
541
|
+
document.getElementById('stat-total').textContent = stats.total;
|
|
542
|
+
|
|
543
|
+
const list = document.getElementById('detections-list');
|
|
544
|
+
if (!pending.length) {
|
|
545
|
+
list.innerHTML = '<div class="empty"><div class="icon">✅</div><div>No pending detections to review.<br><span style="font-size:12px;color:#444">Captures will appear here as cameras detect objects.</span></div></div>';
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
547
548
|
|
|
548
549
|
list.innerHTML = pending.map(r => {
|
|
549
550
|
const date = new Date(r.timestamp).toLocaleString();
|
|
@@ -573,6 +574,11 @@ async function loadPending() {
|
|
|
573
574
|
</div>
|
|
574
575
|
</div>\`;
|
|
575
576
|
}).join('');
|
|
577
|
+
} catch(e) {
|
|
578
|
+
console.error('loadPending error', e);
|
|
579
|
+
const list = document.getElementById('detections-list');
|
|
580
|
+
if (list) list.innerHTML = '<div class="empty"><div style="color:#a44">Error loading captures: ' + e.message + '</div></div>';
|
|
581
|
+
}
|
|
576
582
|
}
|
|
577
583
|
|
|
578
584
|
async function label(id, labelVal) {
|