-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind_phone.py
More file actions
33 lines (27 loc) · 1.21 KB
/
Copy pathfind_phone.py
File metadata and controls
33 lines (27 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import boto3
import config
from replit import db
client=boto3.client('rekognition',
aws_access_key_id=db['aws_access_key_id'],
aws_secret_access_key=db['aws_secret_access_key'],
region_name=db['region_name'])
def find_phone(bin_img):
response = client.detect_labels(Image={'Bytes': bin_img}, MaxLabels=10)
for label in response['Labels']:
#print ("Label: " + label['Name'])
if("PHONE" in label['Name'].upper()):
return True
#print("------------------------------------------------------------")
# print ("Confidence: " + str(label['Confidence']))
# print ("Instances:")
# for instance in label['Instances']:
# print (" Bounding box")
# print (" Top: " + str(instance['BoundingBox']['Top']))
# print (" Left: " + str(instance['BoundingBox']['Left']))
# print (" Width: " + str(instance['BoundingBox']['Width']))
# print (" Height: " + str(instance['BoundingBox']['Height']))
# print (" Confidence: " + str(instance['Confidence']))
return False
# with open("phon.JPG", "rb") as image:
# f = image.read()
# print(find_phone(f))