🍽️ 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!