Commit 44a44ac4 authored by Sikhin VC's avatar Sikhin VC

added server API endpoints

parent 0ff858d7
Pipeline #69223 canceled with stage
...@@ -22,7 +22,6 @@ from scipy.optimize import linear_sum_assignment as linear_assignment ...@@ -22,7 +22,6 @@ from scipy.optimize import linear_sum_assignment as linear_assignment
from edge_engine.common.config import EDGE_CONFIG, LAST_COUNT, MONGO_URI_ADD_EVENTLOGS from edge_engine.common.config import EDGE_CONFIG, LAST_COUNT, MONGO_URI_ADD_EVENTLOGS
import requests import requests
from uuid import uuid1 from uuid import uuid1
import json
class CementBagCounter(ModelWrapper): class CementBagCounter(ModelWrapper):
...@@ -332,9 +331,9 @@ class CementBagCounter(ModelWrapper): ...@@ -332,9 +331,9 @@ class CementBagCounter(ModelWrapper):
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 bs64 = str(base64.b64encode(img2).decode('utf-8')) # Changed this line. converted byte to string
json_file = {"eventId": str(uuid1()).split('-')[0], "cameraId": EDGE_CONFIG['deviceId'], "cameraName": EDGE_CONFIG['deviceId'], "timestamp": datetime.isoformat(datetime.now()), "frame": bs64, "cement_bag_count": self.count} json = {"eventId": str(uuid1()).split('-')[0], "cameraId": EDGE_CONFIG['deviceId'], "cameraName": EDGE_CONFIG['deviceId'], "timestamp": datetime.isoformat(datetime.now()), "frame": bs64}
logger.info(f"json is {json_file}") logger.info(f"json is {json}")
response = requests.post(url=MONGO_URI_ADD_EVENTLOGS, json=json.loads(json_file)) response = requests.post(url=MONGO_URI_ADD_EVENTLOGS, json=json)
logger.info(f"response is : {response.text}") logger.info(f"response is : {response.text}")
logger.info(f"Count: {self.count}") logger.info(f"Count: {self.count}")
frame = draw_circles_on_frame( frame = draw_circles_on_frame(
......
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