APPLIED AI / PUBLIC SOURCEPublic source · Code walkthrough

Batch background removal.
A real Python workflow.

An image-processing workflow built for batch jobs, with a FastAPI upload endpoint, reusable Python processing service, browser interface, CLI and Docker packaging.

EVIDENCE TYPELocal FastAPI prototype · Public code
TECHNOLOGYPython · FastAPI · Pillow · rembg / ONNX
INSPECTED REVISION6a248677c735 ↗ · 8 Oct 2026
REAL ONNX MODEL / VERIFIED EXECUTION

From a source image to a transparent PNG.

A real `rembg` model ran through the application's Python processing pipeline. This before-and-after sample comes from an actual ONNX inference run—not a retouched or AI-generated marketing mockup.

✓ Real inference executed
Before: a synthetic blue bottle against a beige background. After: the bottle extracted from its background by a real u2netp rembg model, displayed on a transparency checkerboard.
Synthetic sample image → real `u2netp`/ONNX Runtime output, captured automatically from the application.
Real model runu2netp · ONNX Runtime
PNG RGBA outputAlpha channel: 0–255

One synthetic product illustration demonstrates the real inference path. It is not a benchmark of segmentation accuracy across different photographs or models.

REAL APPLICATION SCREENSHOTS

See the interface in action.

The actual FastAPI application running locally in Chromium, with two synthetic sample files selected using the original upload interface.

Captured from running source · 10 Oct 2026
Desktop / original application
Actual Batch Background Removal dashboard rendered from its public FastAPI app, with two synthetic sample images selected.
Original dashboard · Upload selection and batch controls
Mobile / responsive UI
Mobile screenshot of the original FastAPI browser dashboard rendered at 390 pixels wide.
Original UI · 390px mobile viewport
12/12API & preprocessing tests passed
08Browser interaction checks passed

The 12 API tests use a deterministic model test double for repeatability; the separate real-model execution above verifies actual ONNX inference on a synthetic sample.

01 / PROJECT CONTEXT

The use case

Batch editing images one at a time is slow. I built a reusable Python workflow to handle multiple inputs, prepare them consistently, and package transparent PNG outputs for download.

02 / HOW IT WORKS

Inside the build

The FastAPI endpoint accepts image batches and delegates the processing to a reusable service. The code handles file decoding, EXIF orientation, resizing, output naming and ZIP creation; the same service also powers a command-line workflow.

Browser / CLIContent validation & EXIF normalizationModel inferencePNG ZIP / folder output

Workflow overview based on the linked implementation.

03 / DIRECT CODE EVIDENCE

Explore the implementation

Open the actual Python implementation below. Each link points to the exact code revision used for this walkthrough.

01 / FastAPI input and output contractInspect code ↗
app/main.py

Defines health and batch-processing endpoints, handles up to 50 files per request, dispatches processing through a threadpool and streams a downloadable ZIP.

02 / Image preparation and inferenceInspect code ↗
app/services/background_removal.py

Implements image-content decoding, EXIF orientation correction, resizing, context padding, rembg inference, safe output naming, and ZIP packaging.

03 / Repeatable command-line workflowInspect code ↗
tools/process_folder.py

Accepts input/output directories and optional inference settings for batch processing outside the browser.

04 / Inspectable browser interfaceInspect code ↗
app/static/index.html

Implements the browser dashboard for selecting image batches, starting processing and downloading the resulting archive.

05 / Runtime packagingInspect code ↗
Dockerfile

Packages the Python dependencies and FastAPI startup command in a Docker container definition.

04 / ENGINEERING HIGHLIGHTS

What I built into it

  • Separated HTTP request handling from the reusable image-processing service.
  • Bound batch count and image inference dimensions, while documenting the remaining request-size risks.
  • Exposed both a browser workflow and a folder-based CLI without requiring a public user account.
05 / PROJECT STATUS

Current stage

Local application prototype with inspectable source. The code demonstrates the batch-processing workflow; multi-user hosting, upload-resource safeguards and performance benchmarking are future production-hardening tasks.

← Back to portfolioNext: Laravel attendance system ↗