Serverless · Freelance

Container-Image Lambdas for Audio Segmentation and Sentiment

Docker-based Lambdas process uploaded audio with a TensorFlow speech segmenter and score text with several sentiment lexicons.

  • Lambda containers
  • ECR
  • S3
  • SAM
  • TensorFlow
  • ffmpeg
  • Python

// Overview

A SAM template deploys an S3 bucket whose notifications invoke a 2 GB, 15-minute Lambda packaged as a container image with TensorFlow, ffmpeg and a segmentation library. It segments speech, music and noise and writes a CSV back to S3. Sibling images score text with several lexicons.

// The problem

Heavy ML libraries and binaries exceed Lambda zip limits, yet processing had to run automatically on upload.

// Flow

Container-Image Lambdas for Audio Segmentation and Sentiment flow1. S3 upload → 2. S3 notification → 3. Container Lambda → 4. Format gate → 5. Segmentation → 6. Result → 7. Sentiment Lambda → 8. Delivery01S3 upload02S3 notification03Container Lambda04 · GATEFormat gate05Segmentation06Result07Sentiment Lambda08Delivery
  1. S3 uploadaudio placed under a media prefix
  2. S3 notificationput and multipart-complete events invoke the function
  3. Container LambdaECR image, 2048 MB, 900 s timeout
  4. Format gate gateaccepts wav, mp3 and m4a only
  5. Segmentationdownload, segment, write CSV
  6. ResultCSV written under a separate prefix
  7. Sentiment Lambdasequenced text in, per-lexicon scores out
  8. DeliveryDocker build, ECR push, SAM deploy with image URI parameter

// Design decisions & guardrails

  • Container images bypass zip size limits; non-root user in the image.
  • Prefix-filtered notifications avoid recursive triggers.
  • One handler tolerates API-style and S3-style event shapes; local test events included.

// Outcome

ML-grade processing on a serverless footprint.

// Related