-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheye_track.py
More file actions
27 lines (23 loc) · 726 Bytes
/
Copy patheye_track.py
File metadata and controls
27 lines (23 loc) · 726 Bytes
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
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 eyes_are_closed(bin_img):
response = client.detect_faces(
Image={
'Bytes': bin_img
},
Attributes=[
'ALL',
]
)
if len(response['FaceDetails'])<=0:
return False
firstFace = response['FaceDetails'][0] #only looks at the first face
return not firstFace['EyesOpen']['Value']
with open("eyes_open.jpg", "rb") as image:
f = image.read()
print(eyes_are_closed(f))