Skip to content

Commit

Permalink
Merge pull request #1 from carchi8py/0.2
Browse files Browse the repository at this point in the history
0.2
  • Loading branch information
carchi8py authored Jan 26, 2021
2 parents c761410 + e2ea23a commit 59e6f4b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __pycache__/
*.py[cod]
*$py.class
*.idea
new_user_credentials.csv

# C extensions
*.so
Expand Down
Binary file added IMG_1733.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ This is a project i am doing for fun to play around with a raspberry pi and some
The following need to be pip installed
* gpiozero
* picamera
* boto3
## Versions
* [0.1](https://carchi8py.com/2021/01/08/setting-up-the-raspberry-pi/)
* [0.2](https://carchi8py.com/2021/01/22/simple-image-detection-with-aws-rekognition/)
## Authors
* [carchi8py](https://www.carchi8py.com)

Expand Down
20 changes: 20 additions & 0 deletions imageDectect.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import csv
import boto3

with open('new_user_credentials.csv', 'r') as input:
csvreader = csv.DictReader(input)
for row in csvreader:
access_key_id = row['Access key ID']
secret_key = row['Secret access key']

photo = 'IMG_1733.JPG'
client = boto3.client('rekognition',
aws_access_key_id=access_key_id,
aws_secret_access_key=secret_key,
region_name='us-west-2')
with open(photo, 'rb') as source_photo:
source_bytes = source_photo.read()

response = client.detect_labels(Image={'Bytes': source_bytes})
for each in response['Labels']:
print(each['Name'] + ": " + str(each['Confidence']))

0 comments on commit 59e6f4b

Please sign in to comment.