Comment by murderszn
I built a small demo that classifies food using the Cube Rule rather than asking a general model to write an essay on whether a hot dog is a sandwich.The Cube Rule categorizes food by the location of structural starch relative to the six faces of a cube:
0 Starchless (Salad): Steak, soup
1 Face (Toast): Pizza, nigiri
2 Faces (Sandwich): Burger, unfolded quesadilla
3 Faces (Taco): Hot dog, hard-shell taco
4 Faces (Sushi): Open wrap, enchilada
5 Faces (Quiche): Bread bowl, deep-dish pizza
6 Faces (Calzone): Sealed burrito, dumpling
Extensions: Cake (stacked layers, e.g., lasagna), Nachos (dispersed starch, e.g., poutine, cereal)
Implementation & Constraints
Model: Clef Flash running via Cloudflare Workers AI. It takes text, an image, or both, and outputs a classification with relative preference scores across the categories.
Frontend/Hosting: Static frontend on Cloudflare Pages.
Privacy: Images are processed in-memory and not logged or stored. Session history remains in localStorage.
Rate limits: Capped at 5 req/min per IP to stay within free-tier worker limits.
A hot dog consistently lands as a taco (starch on bottom and two parallel sides). Edge cases like wet rice or rolled vs. folded wraps depend on how the vision model parses boundaries. Rotation doesn't affect the ruling, and the container/plate is ignored.
Demo: https://foodbyclef.pages.dev/
Feedback on edge cases and classification failures welcome.