Commit 5824a15c authored by Sikhin VC's avatar Sikhin VC

added server API endpoints

parent 7aab7103
Pipeline #69213 canceled with stage
......@@ -33,7 +33,7 @@ CONFIG_ENV = json.loads(os.environ.get('config', default=None))
logger.info(f"CONFIG ENV IS {CONFIG_ENV}")
DEPLOYMENT_ID = CONFIG_ENV.get('DEPLOYMENT_ID',None)
GET_JANUS_DETAILS = CONFIG_ENV.get('GET_JANUS_DETAILS',None)
MONGO_URI_ADD_EVENTLOGS = CONFIG_ENV.get('MONGO_URI_ADD_EVENTLOGS',None)
MONGO_URI_ADD_EVENTLOGS = CONFIG_ENV.get('MONGO_URI',None)
url = GET_JANUS_DETAILS + DEPLOYMENT_ID
print(url)
EDGE_CONFIG = requests.get(url).json()["data"]
......
......@@ -328,12 +328,11 @@ class CementBagCounter(ModelWrapper):
elif object_id in self.uncounted_objects:
self.uncounted_objects.pop(object_id, None)
self.count += 1
url = MONGO_URI_ADD_EVENTLOGS
img2 = frame.copy()
img2 = cv2.resize(img2, (64, 64))
bs64 = str(base64.b64encode(img2).decode('utf-8')) # Changed this line. converted byte to string
json = {"eventId": str(uuid1()).split('-')[0], "cameraId": EDGE_CONFIG['deviceId'], "cameraName": EDGE_CONFIG['deviceId'], "timestamp": datetime.isoformat(datetime.now()), "frame": bs64}
response = requests.post(url=url, json=json)
response = requests.post(url=MONGO_URI_ADD_EVENTLOGS, json=json)
logger.info(f"response is : {response.text}")
logger.info(f"Count: {self.count}")
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