FoodLens AI: Know what's in your food before you eat.

Scan a label, pick your diet and allergies, and get a clear ingredient-by-ingredient check with the reasons shown.


Inspiration

Food labels are hard to read. They use E-numbers, technical names, tiny print and often another language, and ingredients like gelatin or glycerin can come from different sources. People who follow a halal, Hindu-friendly, vegetarian, vegan or Kosher diet, or who have allergies, have to decode this every time they shop or travel. We wanted a tool that gives a clear answer and shows its reasoning.

What it does

FoodLens AI checks a food label against your own diet and allergies. No account is needed.

  • ✓ Upload a label photo (any language) or type the ingredients
  • ✓ Choose a diet or belief: Halal, Vegetarian, Vegan, Hindu-friendly (no beef) or Kosher
  • ✓ Pick optional allergies
  • ✓ Get an overall verdict: Looks suitable / Needs a closer look / Not suitable / Not enough information
  • ✓ See a reason for every ingredient, a red allergy alert, estimated nutrition per serving, and recent checks saved only on your device
  • ✓ Works on desktop and mobile

Who it is for: anyone who has to read labels carefully, such as Muslims checking halal, Hindus avoiding beef, vegetarians and vegans, Kosher followers and people with allergies.


How we built it

Stack: HTML, CSS and JavaScript front end, Python Flask back end, Gemini 3.6 Flash for AI.

Photo or text -> Flask API (file type, size, rate limit)
-> Gemini reads the label into JSON
-> Rule engine (525 rules) decides known ingredients
-> Gemini + Google Search estimates only unclear items
-> Merge (rules always win) -> Verdict with reasons and sources

How AI is used in the product

  1. Gemini reads the label. It only transcribes the photo into structured JSON (ingredients, "may contain", nutrition). Text on a package is treated as data, never as instructions.
  2. A rule engine decides what is known. 525 transparent rules mark each ingredient OK, Doubtful, Not OK or Unknown.
  3. AI estimates only what is unclear. Unclear items go to Gemini with Google Search grounding, returning an estimate with a confidence level and sources.
  4. Rules always win. If rules and AI disagree, the rule result is used. The overall verdict is the strictest status found.
  5. Allergens are separate. They are always listed, and "may contain" warnings are shown apart from real ingredients.

How AI was used during development: The idea, feature list, design decisions, rule choices, testing and project management were done by our team (Abubaker and Sania). We used Claude as a coding assistant to help write and refine the code, and Gemini to create the logo and thumbnail. We ran every feature ourselves, tested it on real labels (see the results table below) and fixed what did not work before submitting.


Challenges we ran into

  • Many ingredients cannot be settled from the name alone (gelatin, E471, Vitamin D3). We had to show "Needs a closer look" or "Unknown" honestly instead of guessing.
  • Reading photos can make mistakes, so we reject blurry or incomplete labels and remind users to compare with the package.
  • Keeping the AI from overruling the rules, and making sure an AI failure never hides the rule-based result.

Accomplishments that we're proud of

  • A transparent 525-rule engine, so every verdict has a reason
  • Safe failure handling: blurry photos are rejected, and if the AI times out the rule result is still shown with a warning
  • A clean interface for desktop and mobile
  • Real tests: all 9 matched what we expected
Input Profile Result
Photo: chia seeds Halal Looks suitable + nutrition
Photo: organic milk, Vitamin D3 Halal Not enough information (Vitamin D3 unknown)
beef extract Hindu-friendly Not suitable
tallow Hindu-friendly Not suitable
citric acid Halal OK
sugar Halal OK
water Halal OK
milk + milk allergy Halal Suitable + allergy alert
milk Vegan Not suitable

What we learned

AI works best as an assistant, not the judge. Clear rules should decide what is known, and AI should only estimate what is unclear, with sources and honest uncertainty. We also learned how much label photos vary and why safe failure matters.

Limitations: FoodLens is informational only. It is not medical advice or a religious ruling, and "no match" does not prove a product is allergen-free or certified. Ingredients with no rule show as Unknown, never OK. Our test set is small (9 inputs), so more real-world testing is needed.


What's next for FoodLens AI

  • More ingredient rules and testing on more languages and label types
  • Product lists for each diet (Halal, Vegetarian, Hindu-friendly, allergy-free)
  • Search by product code
  • Halal food near me

Team

  • Abubaker Afzal: project management, testing, backend. 👉︎ GitHub
  • Sania Amjad: frontend. 👉︎ GitHub

Built With

Share this project:

Updates

Submission history