Spaces:
Sleeping
Sleeping
eeeeelin commited on
Commit ·
56be9ff
1
Parent(s): f2d45f2
allow analyse either one cam only
Browse files- app/__pycache__/models.cpython-311.pyc +0 -0
- app/models.py +5 -1
- app/static/js/dashboard.js +24 -12
app/__pycache__/models.cpython-311.pyc
CHANGED
|
Binary files a/app/__pycache__/models.cpython-311.pyc and b/app/__pycache__/models.cpython-311.pyc differ
|
|
|
app/models.py
CHANGED
|
@@ -47,13 +47,17 @@ class SessionData:
|
|
| 47 |
|
| 48 |
people_min_out = sum(e.seats_min for e in self.events if e.direction == 'OUT')
|
| 49 |
people_max_out = sum(e.seats_max for e in self.events if e.direction == 'OUT')
|
| 50 |
-
|
|
|
|
|
|
|
| 51 |
return {
|
| 52 |
'vehicles_in': vehicles_in,
|
| 53 |
'vehicles_out': vehicles_out,
|
| 54 |
'net_vehicles': vehicles_in - vehicles_out,
|
| 55 |
'people_on_site_min': people_min - people_min_out,
|
| 56 |
'people_on_site_max': people_max - people_max_out,
|
|
|
|
|
|
|
| 57 |
'vehicle_distribution': self._get_distribution()
|
| 58 |
}
|
| 59 |
|
|
|
|
| 47 |
|
| 48 |
people_min_out = sum(e.seats_min for e in self.events if e.direction == 'OUT')
|
| 49 |
people_max_out = sum(e.seats_max for e in self.events if e.direction == 'OUT')
|
| 50 |
+
|
| 51 |
+
# on_site_min = max(0, people_min - people_min_out)
|
| 52 |
+
# on_site_max = max(0, people_max - people_max_out)
|
| 53 |
return {
|
| 54 |
'vehicles_in': vehicles_in,
|
| 55 |
'vehicles_out': vehicles_out,
|
| 56 |
'net_vehicles': vehicles_in - vehicles_out,
|
| 57 |
'people_on_site_min': people_min - people_min_out,
|
| 58 |
'people_on_site_max': people_max - people_max_out,
|
| 59 |
+
# 'people_on_site_min': on_site_min,
|
| 60 |
+
# 'people_on_site_max': on_site_max,
|
| 61 |
'vehicle_distribution': self._get_distribution()
|
| 62 |
}
|
| 63 |
|
app/static/js/dashboard.js
CHANGED
|
@@ -1037,7 +1037,11 @@ class WorkbenchManager {
|
|
| 1037 |
// -------------------------------------------------------------------------
|
| 1038 |
|
| 1039 |
updateStartButtonState() {
|
| 1040 |
-
const allReady = Object.values(CAMERA_ROLES).every(role => {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1041 |
const config = this.cameraConfigs[role];
|
| 1042 |
return config.hasVideo && config.hasLine;
|
| 1043 |
});
|
|
@@ -1048,9 +1052,16 @@ class WorkbenchManager {
|
|
| 1048 |
|
| 1049 |
const { startBtn } = this.globalElements;
|
| 1050 |
|
| 1051 |
-
if (anyProcessing) {
|
| 1052 |
-
|
| 1053 |
-
} else if (allReady) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1054 |
startBtn.disabled = false;
|
| 1055 |
startBtn.innerHTML = `<i data-feather="play"></i> Start Analysis`;
|
| 1056 |
feather.replace();
|
|
@@ -1060,15 +1071,16 @@ class WorkbenchManager {
|
|
| 1060 |
}
|
| 1061 |
|
| 1062 |
async startAnalysis() {
|
| 1063 |
-
//
|
| 1064 |
-
|
| 1065 |
const config = this.cameraConfigs[role];
|
| 1066 |
-
|
| 1067 |
-
|
| 1068 |
-
|
| 1069 |
-
|
|
|
|
|
|
|
| 1070 |
}
|
| 1071 |
-
|
| 1072 |
// Show processing UI
|
| 1073 |
const { processingStatus, startBtn, locationInput } = this.globalElements;
|
| 1074 |
processingStatus.classList.remove('hidden');
|
|
@@ -1081,7 +1093,7 @@ class WorkbenchManager {
|
|
| 1081 |
|
| 1082 |
try {
|
| 1083 |
// Start processing for each camera
|
| 1084 |
-
for (const role of
|
| 1085 |
const response = await fetch('/setup/start-processing', {
|
| 1086 |
method: 'POST',
|
| 1087 |
headers: { 'Content-Type': 'application/json' },
|
|
|
|
| 1037 |
// -------------------------------------------------------------------------
|
| 1038 |
|
| 1039 |
updateStartButtonState() {
|
| 1040 |
+
// const allReady = Object.values(CAMERA_ROLES).every(role => {
|
| 1041 |
+
// const config = this.cameraConfigs[role];
|
| 1042 |
+
// return config.hasVideo && config.hasLine;
|
| 1043 |
+
// });
|
| 1044 |
+
const anyReady = Object.values(CAMERA_ROLES).some(role => {
|
| 1045 |
const config = this.cameraConfigs[role];
|
| 1046 |
return config.hasVideo && config.hasLine;
|
| 1047 |
});
|
|
|
|
| 1052 |
|
| 1053 |
const { startBtn } = this.globalElements;
|
| 1054 |
|
| 1055 |
+
// if (anyProcessing) {
|
| 1056 |
+
// startBtn.disabled = true;
|
| 1057 |
+
// } else if (allReady) {
|
| 1058 |
+
// startBtn.disabled = false;
|
| 1059 |
+
// startBtn.innerHTML = `<i data-feather="play"></i> Start Analysis`;
|
| 1060 |
+
// feather.replace();
|
| 1061 |
+
// } else {
|
| 1062 |
+
// startBtn.disabled = true;
|
| 1063 |
+
// }
|
| 1064 |
+
if (anyProcessing || anyReady) {
|
| 1065 |
startBtn.disabled = false;
|
| 1066 |
startBtn.innerHTML = `<i data-feather="play"></i> Start Analysis`;
|
| 1067 |
feather.replace();
|
|
|
|
| 1071 |
}
|
| 1072 |
|
| 1073 |
async startAnalysis() {
|
| 1074 |
+
// Identify which cameras are actually ready
|
| 1075 |
+
const readyCameras = Object.values(CAMERA_ROLES).filter(role => {
|
| 1076 |
const config = this.cameraConfigs[role];
|
| 1077 |
+
return config.hasVideo && config.hasLine;
|
| 1078 |
+
});
|
| 1079 |
+
// Validation checks if list is empty, rather than checking specific roles
|
| 1080 |
+
if (readyCameras.length === 0) {
|
| 1081 |
+
alert(`Please configure at least one camera (upload video and draw line).`);
|
| 1082 |
+
return;
|
| 1083 |
}
|
|
|
|
| 1084 |
// Show processing UI
|
| 1085 |
const { processingStatus, startBtn, locationInput } = this.globalElements;
|
| 1086 |
processingStatus.classList.remove('hidden');
|
|
|
|
| 1093 |
|
| 1094 |
try {
|
| 1095 |
// Start processing for each camera
|
| 1096 |
+
for (const role of readyCameras) {
|
| 1097 |
const response = await fetch('/setup/start-processing', {
|
| 1098 |
method: 'POST',
|
| 1099 |
headers: { 'Content-Type': 'application/json' },
|