Food Decoder is an open source project designed to help you purchase healthy products to live long and be healthy using AI models to highlight the product's potential benefits and harmful effects. DO NOTE:- AI can Make mistakes.
-
Barcode Scanning :- uses htmlQR code scanner libraries and https://world.openfoodfacts.org/ api to fetch product details. Do Note: - not every product is available in the world.openfoodfacts database for that i designed a visionary model to read the ingredients directly from the package
-
Vision Model :- upload a photo of the package ingredients if the barcode isnt working, (this uses Nvidia nemotron nano 12b v2 vl)
-
Analysis :- After the barcode/image has been uploaded succesfully it uses the models to read and calculate health score based on the ingredients and processes potential benefits, harmful effects and potential allergens.
-
UI:- easy to navigate UI, the scan barcode and image button is available directly at the homepage for easier navigation and faster navigation
-
I hosted the backend on Hugging Faces which ensures 99.9 % uptime and thanks for HackClub for providing the models for free
What i used in frontend
-
HTML5, CSS3, Vanilla JavaScript
-
HTML5-QRCode (for barcode scanning)
Backend and models
-
Framework:- Fastapi
-
BackendHosting:- Hugging Face Spaces
-
PrimaryLLM:- Google Gemini 2.5 Flash(this is used when we use barcode scanning)
-
FallBackLLM:- Nvidia Nemotron-12b (this is used when we use the image feeding button)
-
Food Database:Open Food Facts API
-
Scan or Upload: If the database contains the product scanning the barcode(usually behind the food package) can give instant insights but if you want deeper analysis or the product is not in the database you can take a photo of the backside of the product which will give a more detailed insight.
-
Database Lookup: If a barcode is scanned the openfoodfacts api returns an json containing the ingredient list.
-
AI Processing: After Getting an ingredient either from barcode or vision model there are 2 cases :-
-
- Uses Gemini 2.5 flash if the barcode reading was succesfull.
-
- Uses Nvidia Nemotron if the barcode failed and an image was uploaded
- Final Analysis:- The JSON returned by the Models is formatted in the web UI giving a detailed analysis and health score.
Idk why would anyone install it locally but here are the steps to do so:-
- Clone the Repo
- git clone https://github.com/adityaprasad-sudo/FoodAnalayser.git cd FoodAnalayser
- Setup the api keys
-
make .env file in the cloned repo
this goes into your .env file and put your gemini api key in the chiggaapi and openrouter api key in the opapikey:-
chiggaapi=YOUR_GEMINI_API_KEY opapikey=YOUR_OPENROUTER_API_KEY
3.Install dependencies
pip install fastapi uvicorn google-generativeai pillow requests python-dotenv python-multipart
uvicorn main:app --reload --port 7860
4.Runing the frontend
- You can serve the HTML/CSS/JS files using any standard live server (like the VS Code Live Server extension)
NOTE: Camera access in browsers requires either a localhost or https:// connection
DecodeFood is built for educational and informational purposes only. The AI-generated health scores and insights do not constitute professional medical advice. Users with severe food allergies should always verify ingredients on the physical packaging.
Built by Aditya Prasad GitHub: @adityaprasad-sudo
item used in the video - Amazon
-
Demo Video (https://drive.google.com/file/d/1url-S7SR59TI-1AMfo4ylVShVGI_h3xj/view?usp=sharing)
-
Demo Screenshots
Which Barcode to Scan?
