Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

rename stuff and add use_face to settings

roryclearf96596bb3cb9
diff --git a/clearcam.py b/clearcam.py
index 7e985f4..c2c2f28 100644
--- a/clearcam.py
+++ b/clearcam.py
@@ -735,8 +735,8 @@ class HLSRequestHandler(BaseHTTPRequestHandler):
self.send_200()
return
- if parsed_path.path == "/get_features":
- self.send_200({"object_search":global_settings.use_clip, "face_search":use_face})
+ if parsed_path.path == "/get_global_settings":
+ self.send_200(global_settings.__dict__)
return
if parsed_path.path == "/get_max_storage":
self.send_200(body={"max_gb":self.server.max_gb})
@@ -1385,8 +1385,9 @@ class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
super().server_close()
class GlobalSettings:
- def __init__(self, use_clip=True, model_size="t", model_res=960, userID=None, key=None, use_qwen=False, qwen_size=2):
+ def __init__(self, use_clip=True, use_face=False ,model_size="t", model_res=960, userID=None, key=None, use_qwen=False, qwen_size=2):
self.use_clip = use_clip
+ self.use_face = use_face
self.model_size = model_size
self.model_res = model_res
self.userID = userID
diff --git a/mainview.html b/mainview.html
index d8c4f7e..7a09b65 100644
--- a/mainview.html
+++ b/mainview.html
@@ -2366,30 +2366,30 @@
}
async function loadFeatureFlags() {
- const response = await fetch('/get_features');
+ const response = await fetch('/get_global_settings');
const features = await response.json();
const uploadContainer = document.querySelector('div[style*="position: relative; display: flex"]');
const imageUploadLabel = uploadContainer.querySelector('label[for="imageUpload"]');
const faceUploadLabel = uploadContainer.querySelector('label[for="faceUpload"]');
const searchInput = document.getElementById('imageSearchInput');
const tooltip = uploadContainer.querySelector('.tooltip');
- imageUploadLabel.style.display = features.object_search ? 'flex' : 'none';
- faceUploadLabel.style.display = features.face_search ? 'flex' : 'none';
- searchInput.style.display = features.object_search ? 'inline-block' : 'none';
+ imageUploadLabel.style.display = features.use_clip ? 'flex' : 'none';
+ faceUploadLabel.style.display = features.use_face ? 'flex' : 'none';
+ searchInput.style.display = features.use_clip ? 'inline-block' : 'none';
const searchButton = document.getElementById('searchButton');
- searchButton.style.display = (features.object_search || features.face_search) ? 'flex' : 'none';
+ searchButton.style.display = (features.use_clip || features.use_face) ? 'flex' : 'none';
const clearButton = document.getElementById('clearButton');
- clearButton.style.display = (features.object_search || features.face_search) ? 'flex' : 'none';
+ clearButton.style.display = (features.use_clip || features.use_face) ? 'flex' : 'none';
const tooltipText = tooltip.querySelector('.tooltiptext');
- if (features.object_search && features.face_search) {
+ if (features.use_clip && features.use_face) {
tooltipText.textContent = 'Use an image or face to find similar objects in your footage.';
- } else if (features.object_search) {
+ } else if (features.use_clip) {
tooltipText.textContent = 'Use an image to find similar objects in your footage.';
- } else if (features.face_search) {
+ } else if (features.use_face) {
tooltipText.textContent = 'Use a face image to find matching people in your footage.';
}
const searchRow = uploadContainer.closest('div[style*="display: flex; align-items: center"]');
- if (searchRow && !features.object_search && !features.face_search) {
+ if (searchRow && !features.use_clip && !features.use_face) {
searchRow.style.display = 'none';
}
}