Update app.py
This commit is contained in:
parent
2d361b19ff
commit
72ef5512ba
1 changed files with 9 additions and 3 deletions
12
app.py
12
app.py
|
@ -125,7 +125,9 @@ async def detect(websocket: WebSocket):
|
|||
"cameraIdentifier": camera_id,
|
||||
"timestamp": time.time(),
|
||||
"data": {
|
||||
"detections": boxes
|
||||
"detections": boxes,
|
||||
"modelId": stream['modelId'],
|
||||
"modelName": stream['modelName']
|
||||
}
|
||||
}
|
||||
logging.debug(f"Sending detection data for camera {camera_id}: {detection_data}")
|
||||
|
@ -154,6 +156,8 @@ async def detect(websocket: WebSocket):
|
|||
camera_id = data.get("cameraIdentifier")
|
||||
rtsp_url = data.get("rtspUrl")
|
||||
model_url = data.get("modelUrl")
|
||||
modelId = data.get("modelId")
|
||||
modelName = data.get("modelName")
|
||||
|
||||
if model_url:
|
||||
print(f"Downloading model from {model_url}")
|
||||
|
@ -190,9 +194,11 @@ async def detect(websocket: WebSocket):
|
|||
'buffer': buffer,
|
||||
'thread': thread,
|
||||
'rtsp_url': rtsp_url,
|
||||
'stop_event': stop_event
|
||||
'stop_event': stop_event,
|
||||
'modelId': modelId,
|
||||
'modelName': modelName
|
||||
}
|
||||
logging.info(f"Subscribed to camera {camera_id} with URL {rtsp_url}")
|
||||
logging.info(f"Subscribed to camera {camera_id} with modelId {modelId}, modelName {modelName} and URL {rtsp_url}")
|
||||
elif camera_id and camera_id in streams:
|
||||
stream = streams.pop(camera_id)
|
||||
stream['cap'].release()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue