P

Food Detective

Food-label reader for kids

Scan a food label, see which ingredients are safe, and how many servings a child can have per day.

Ingredient lists hide additives behind chemical names and E-numbers. Food Detective is a desktop app that helps children aged 6 to 12 and their parents understand what is in packaged food, and turns intake limits into a number of servings. It runs entirely on free, public data, with no paid AI services or API keys.

What it does

  • Adaptive OCR pipeline: OpenCV bilateral filtering and CLAHE clean up curved, unevenly lit labels before EasyOCR reads them, with a Pillow fallback if OpenCV is missing.
  • RapidFuzz corrects OCR misreads against a known vocabulary, for example "barlev" to "barley".
  • Queries OpenFoodFacts, OpenFDA, Wikipedia and Wikidata in parallel with asyncio.gather.
  • Scores each ingredient as Safe, Caution, Avoid or Toxic/Not Food using word-boundary matching.
  • Serving calculator reads serving size, sugar, sodium and saturated fat from the label and works out safe daily servings for a 20 kg reference child.
  • Results stream to the Tkinter GUI over server-sent events from a local FastAPI server, with a thread-safe queue keeping the interface responsive.
  • SQLite cache with a 90-day TTL and background cleanup makes repeat scans near instant.

Architecture

The Tkinter desktop app launches a local FastAPI server and listens to it over an SSE stream. The server runs OCR in a thread, then looks each ingredient up in the SQLite cache or the public APIs. A kid-friendly explainer rewrites scientific summaries in simple words, such as "made in a lab" instead of "synthesised".