Added stuff.

master
Matt Theissen 1 year ago
parent 2fdf170b72
commit aa1fe490e6

@ -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_bool = True
if send_bool == True:
send_telegram(event)
break
# print(response["predictions"])
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__":