Skip to content

Commit 96c14a9

Browse files
committed
Client: fix client python
1 parent e47e224 commit 96c14a9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

client/python/iot_facerecognition_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def mainloop(self):
130130
counter = 0
131131
for msg in self.msg[1]:
132132
font = cv2.FONT_HERSHEY_SIMPLEX
133-
cv2.putText(frame2, str(msg), (int(20), int(20 + counter * 20)), font, 0.5, (0, 0, 200), 1,
133+
cv2.putText(frame2, "{}: {}".format(str(msg["prediction"]), str(msg["label"])), (int(20), int(20 + counter * 20)), font, 0.5, (0, 0, 200), 1,
134134
cv2.LINE_AA)
135135
counter = counter + 1
136136
cv2.imshow('facerecognition', frame2)
@@ -145,7 +145,10 @@ def receiveloop(self):
145145

146146
jdoc = json.loads(receive)
147147
cmd = jdoc["command"]
148-
ctx = jdoc["context"]
148+
hasCtx = "context" in jdoc
149+
ctx = None
150+
if (hasCtx):
151+
ctx = jdoc["context"]
149152

150153
if cmd is int(FaceRecognition.Command.MESSAGE_TAG_FACE):
151154
self.msg[0] = ctx

0 commit comments

Comments
 (0)