๐ฝ๏ธ AI Nutrition Vision โ Food Recognition & Nutrition Analyzer
Powered by OpenAI GPT-4o Vision + Streamlit
ai-nutrition-vision is an AI-powered food image analysis app that identifies food items and generates structured nutritional information using OpenAI Vision (GPT-4o).
Upload a food image โ AI identifies the food โ returns a description or a detailed JSON nutrition breakdown.
๐ Features ๐ Food Recognition
Identifies the food shown in the image
Provides a clean, human-readable description
Useful for calorie-tracking & diet apps
๐งฎ Nutrition Analysis (JSON Output)
AI returns structured data:
{ "food_name": "", "serving_description": "", "calories": "", "fat_grams": "", "protein_grams": "", "confidence_level": "" }
Perfect for:
Fitness apps
Meal trackers
Diet automation tools
๐ผ๏ธ Vision AI Powered
Uses GPT-4o Vision:
Reads image content
Understands food types
Produces contextual nutrition insights
๐จ Beautiful Streamlit Interface
Drag & drop food image upload
Toggle between description vs. nutrition JSON
Clean results section
๐ Project Structure ai-nutrition-vision/ โโโ app.py โโโ requirements.txt โโโ .env.example โโโ .gitignore โโโ README.md
๐ง Setup Instructions 1๏ธโฃ Clone the Repository git clone https://github.com/Shehjad2019/ai-nutrition-vision.git cd ai-nutrition-vision
2๏ธโฃ Create a Virtual Environment python -m venv venv source venv/bin/activate # macOS/Linux venv\Scripts\activate # Windows
3๏ธโฃ Install Dependencies pip install -r requirements.txt
4๏ธโฃ Add Your API Key
Copy:
cp .env.example .env
Then fill in .env:
OPENAI_API_KEY=your_openai_api_key_here
Upload a food image โ choose mode โ click Analyze Food.
๐ง How It Works 1๏ธโฃ Upload an image
User uploads jpg/png โ Streamlit displays it.
2๏ธโฃ Image โ Base64
The app converts the image to Base64 for OpenAI Vision.
3๏ธโฃ AI Vision Processing
The model receives:
Image
Text prompt And returns:
Either a human-readable description
Or a structured JSON nutrition output
4๏ธโฃ Display Results
AI output is displayed inside Streamlit.
๐ Environment Variables OPENAI_API_KEY=your_openai_api_key_here
๐ค Author
Shehjad Patel GitHub: https://github.com/Shehjad2019
โญ Support
If this project helped you, please โญ star the repo on GitHub!