Commit d02b1a8d authored by Sikhin VC's avatar Sikhin VC

added app key in events API

parent 5fbd98ee
Pipeline #69537 failed with stage
...@@ -301,8 +301,9 @@ class CementBagCounter(ModelWrapper): ...@@ -301,8 +301,9 @@ class CementBagCounter(ModelWrapper):
self.count += 1 self.count += 1
img2 = frame.copy() img2 = frame.copy()
img2 = cv2.resize(img2, (64, 64)) img2 = cv2.resize(img2, (64, 64))
bs64 = str(base64.b64encode(img2).decode('utf-8')) # Changed this line. converted byte to string img2 = cv2.imencode('.jpg', img2)[1]
logger.info(f"Base 64 image is : {bs64}") bs64 = str(base64.b64encode(img2).decode('utf-8'))
bs64 += "data:image/jpeg;base64,"
json = {"eventId": str(uuid1()).split('-')[0], "cameraId": EDGE_CONFIG['deviceId'], "cameraName": EDGE_CONFIG['deviceId'], "timestamp": datetime.isoformat(datetime.now()), "frame": bs64, "cement_bag_count": str(self.count), "app":"cement"} json = {"eventId": str(uuid1()).split('-')[0], "cameraId": EDGE_CONFIG['deviceId'], "cameraName": EDGE_CONFIG['deviceId'], "timestamp": datetime.isoformat(datetime.now()), "frame": bs64, "cement_bag_count": str(self.count), "app":"cement"}
requests.post(url=MONGO_URI_ADD_EVENTLOGS, json=json) requests.post(url=MONGO_URI_ADD_EVENTLOGS, json=json)
logger.info(f"Count: {self.count}") logger.info(f"Count: {self.count}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment