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/dist/plugin.zip
CHANGED
|
Binary file
|
package/out/main.nodejs.js
CHANGED
|
@@ -1983,7 +1983,7 @@ class DetectionTrainer extends sdk_1.ScryptedDeviceBase {
|
|
|
1983
1983
|
<div class="toast" id="toast"></div>
|
|
1984
1984
|
|
|
1985
1985
|
<script>
|
|
1986
|
-
const BASE = location.pathname.
|
|
1986
|
+
const BASE = location.pathname.endsWith('/') ? location.pathname.slice(0, -1) : location.pathname;
|
|
1987
1987
|
let pending = [];
|
|
1988
1988
|
let labeledCount = 0;
|
|
1989
1989
|
|
|
@@ -2011,20 +2011,21 @@ function toast(msg, color='#1a3') {
|
|
|
2011
2011
|
}
|
|
2012
2012
|
|
|
2013
2013
|
async function loadPending() {
|
|
2014
|
-
|
|
2015
|
-
|
|
2014
|
+
try {
|
|
2015
|
+
const res = await fetch(BASE + '/api/pending');
|
|
2016
|
+
pending = await res.json();
|
|
2016
2017
|
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2018
|
+
const statsRes = await fetch(BASE + '/api/stats');
|
|
2019
|
+
const stats = await statsRes.json();
|
|
2020
|
+
document.getElementById('stat-pending').textContent = stats.pending;
|
|
2021
|
+
document.getElementById('stat-labeled').textContent = stats.labeled;
|
|
2022
|
+
document.getElementById('stat-total').textContent = stats.total;
|
|
2022
2023
|
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2024
|
+
const list = document.getElementById('detections-list');
|
|
2025
|
+
if (!pending.length) {
|
|
2026
|
+
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>';
|
|
2027
|
+
return;
|
|
2028
|
+
}
|
|
2028
2029
|
|
|
2029
2030
|
list.innerHTML = pending.map(r => {
|
|
2030
2031
|
const date = new Date(r.timestamp).toLocaleString();
|
|
@@ -2054,6 +2055,11 @@ async function loadPending() {
|
|
|
2054
2055
|
</div>
|
|
2055
2056
|
</div>\`;
|
|
2056
2057
|
}).join('');
|
|
2058
|
+
} catch(e) {
|
|
2059
|
+
console.error('loadPending error', e);
|
|
2060
|
+
const list = document.getElementById('detections-list');
|
|
2061
|
+
if (list) list.innerHTML = '<div class="empty"><div style="color:#a44">Error loading captures: ' + e.message + '</div></div>';
|
|
2062
|
+
}
|
|
2057
2063
|
}
|
|
2058
2064
|
|
|
2059
2065
|
async function label(id, labelVal) {
|