diff --git a/image_bot.py b/image_bot.py index e4fc2c0..4bcd132 100755 --- a/image_bot.py +++ b/image_bot.py @@ -20,6 +20,7 @@ def find_human(event): image_data = open(event.src_path, "rb").read() response = requests.post(f"{codeai_server}/v1/vision/detection", files={"image":image_data}).json() + send_bool = False for object in response["predictions"]: if object["label"] == "person" and object["confidence"] > 0.60: path = event.src_path @@ -28,14 +29,14 @@ def find_human(event): thickness = 2 image = cv2.rectangle(image, (object["x_min"], object["y_min"]), (object["x_max"], object["y_max"]), color, thickness) cv2.imwrite(path,image) - send_telegram(event) - break -# print(response["predictions"]) + send_bool = True + if send_bool == True: + send_telegram(event) def send_telegram(event): time.sleep(1) bot.send_photo(chat_id=chat_id, photo=open(event.src_path, 'rb')) - bot.send_message(chat_id=chat_id, text="Tweakers?!") + bot.send_message(chat_id=chat_id, text="Tweakers!") if __name__ == "__main__":