Skip to content

Instantly share code, notes, and snippets.

View theactivationfunction's full-sized avatar

agooday theactivationfunction

View GitHub Profile
@theactivationfunction
theactivationfunction / athena.sql
Last active December 1, 2020 17:19
athena.sql
CREATE OR REPLACE VIEW myview AS
SELECT DISTINCT
"image-db"."labels"."source"
, "image-db"."labels"."name"
, "image-db"."labels"."parents_0_name" "parent_category"
, "image-db"."labels"."parents_1_name" "sub_category"
, "image-db"."labels"."confidence" "label_confidence"
, "image-db"."text"."detectedtext"
, "image-db"."text"."type"
, "image-db"."text"."id"
{
"Records": [
{
"eventVersion": "2.1",
"eventSource": "aws:s3",
"awsRegion": "eu-west-2",
"eventTime": "2020-06-17T13:38:46.701Z",
"eventName": "ObjectCreated:Put",
"userIdentity": {
"principalId": "A7UQA2IM60E06"
import json
import boto3
import os
#from flatten_json import flatten
s3=boto3.resource('s3')
target_bucket='<your TARGET bucket name here>' # please update with the S3 bucket you will be sending files to
# Amazon Rekognition
def detect_labels(source_image, bucket):
client=boto3.client('rekognition')