← All projects

FoodOrTrash

A food classification tool using a three-tier pipeline: database lookup, AI classification, and ingredient decomposition.

FoodOrTrash

Problem

Consumers want a quick, trustworthy answer to "is this food actually good for me?" — but single-source classifiers give inconsistent results. Pure LLM answers hallucinate; pure database lookups miss anything novel; raw nutritional heuristics over-penalise nuance.

Approach

A three-tier pipeline. First, a local database of 1,345 hand-classified items (1,159 real foods and 186 trash items across 27 categories) returns a verdict for known inputs — fast and deterministic, with Fuse.js handling typos and plurals. If the item is unknown, Cloudflare Workers AI running Llama 3.1 8B classifies it with a whole-food-first prompt. For compound inputs like recipes, an ingredient-decomposition layer breaks the item into components, scores each, and weighs them into a composite 0–100 verdict — which keeps behaviour consistent across repeat queries for the same item. Built on Next.js and TypeScript with Tailwind and Framer Motion for the UI.

Stack

Next.jsTypeScriptTailwindAI/ML

Synopsis

The scope is three classification tiers — curated lookup, AI fallback for unknowns, and ingredient decomposition for compound foods — plus editorial long-form that explains the scoring philosophy. The purpose is to give a consumer a trustworthy, consistent verdict on real-food-vs-processed for any input, with the reasoning exposed on the verdict card rather than hidden behind an opaque LLM call.

Outcome

Publicly live at foodortrash.com.

Gallery

The verdict surface

A bold food-or-trash call with a 0–100 score and an ingredient-level rationale. When the verdict is Trash, a suggested real-food recipe appears so the user leaves with an action, not just a rejection.
A bold food-or-trash call with a 0–100 score and an ingredient-level rationale. When the verdict is Trash, a suggested real-food recipe appears so the user leaves with an action, not just a rejection.

Browse the underlying database

1,345 hand-classified items across 27 categories (1,159 real food and 186 trash) drive the deterministic tier before the AI layer ever runs.
1,345 hand-classified items across 27 categories (1,159 real food and 186 trash) drive the deterministic tier before the AI layer ever runs.

Long-form context

Essays that explain the scoring heuristics and the nutrition history behind them. The classifier returns a verdict; the writing explains why the scoring lands where it does.
Essays that explain the scoring heuristics and the nutrition history behind them. The classifier returns a verdict; the writing explains why the scoring lands where it does.
Visit live site →GitHub