Skip to content

Instantly share code, notes, and snippets.

@LucioD3v
Created April 28, 2026 17:22
Show Gist options
  • Select an option

  • Save LucioD3v/fac9ffef895a31769515a442718d3c85 to your computer and use it in GitHub Desktop.

Select an option

Save LucioD3v/fac9ffef895a31769515a442718d3c85 to your computer and use it in GitHub Desktop.
Código fuente para la función AWS Lambda utilizada en la charla "Crea tu Fábrica de IA con Amazon Rekognition" de Cúcuta-Cloud.
import boto3
def lambda_handler(event, context):
rekognition = boto3.client('rekognition')
s3 = boto3.client('s3')
# Obtener el nombre del bucket y la foto del evento
bucket = event['Records'][0]['s3']['bucket']['name']
key = event['Records'][0]['s3']['object']['key']
print(f"Analizando imagen: {key} en el bucket: {bucket}")
# Llamada a la IA (Amazon Rekognition)
response = rekognition.detect_labels(
Image={'S3Object': {'Bucket': bucket, 'Name': key}},
MaxLabels=5,
MinConfidence=80
)
print("--- RESULTADOS DE LA IA ---")
for label in response['Labels']:
print(f"Detectado: {label['Name']} con {label['Confidence']:.2f}% de certeza")
return response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment