Work 11 / 18
One runtime for eight image enhancements
Eight image enhancements share one runtime: input validation, a common runner, an API server, and deployment to four serving targets. When something broke in deployment, it was fixed once for all eight.
- Enhancements on it
- 8
- Each pulls it in as a git submodule
- Serving targets
- 4
- Lambda, SageMaker, Beam, Cerebrium
- Deployment fixes shared
- 7
- Fixed once for all eight
- Releases
- automated
- release-please, conventional commits
What it is
Each enhancement plugs into the same runtime: face blur, plate blur, straightening, denoising, sky, colour, scene type and object removal. Inputs are validated with Pydantic.
The runner splits every job into compute and apply. A caller can ask what an enhancement would do without paying for the render, and a photo that needs no change returns early.
- RequestValidated with Pydantic
- compute()Decide what to change
- Unchanged?Return early, no render
- apply()Render the output
Deployment
Reusable CI actions build a Docker image, run a shared pytest step and deploy to AWS Lambda, SageMaker, Beam or Cerebrium. Releases use release-please and conventional commits, with weights in Git LFS and versions bumped in lock-step.
Fixed once, for all eight
- Lambda images missing the libgl1 and libjpeg libraries.
- OpenCV switched to the headless build.
- Timeouts raised to 180 seconds.
- Git LFS files not fetched in the deploy checkout.
- A flag for unchanged photos, so they skip the render.
- A custom runtime for Cerebrium.
- The API key setting made optional.
Limits
A submodule ties every enhancement to one runtime version. Four serving targets are four things to keep working. Weights live in Git LFS, and there is no shared evaluation harness yet, so each model is still evaluated on its own.
Tools
Python, Pydantic, Docker, GitHub Actions, AWS Lambda, SageMaker, Beam, Cerebrium, Git LFS, release-please.
The full write-up
There is a longer write-up of this project. It has client details in it, so email me if you’d like a redacted copy.