NutriLens is a cutting-edge web application that transforms simple food photos into comprehensive nutritional reports. By leveraging the power of modern Vision Language Models (VLMs), it provides detailed calorie counts, macronutrient breakdowns, and health evaluations in seconds.
Whether you prioritize privacy with local models or crave the precision of state-of-the-art cloud APIs, NutriLens adapts to your needs.
- 📷 Instant Analysis: Upload a photo of your meal and get immediate feedback.
- 🧠 Multi-Model Intelligence: Built to be model-agnostic. Switch seamlessly between:
- Google Gemini: High speed and accuracy.
- OpenAI GPT: Industry-leading reasoning and detail.
- Anthropic: Excellent nuance and safety.
- Ollama (Local): Run models like
llama3.2-visionentirely on your machine for complete privacy and zero cost.
- 📊 Structured Reports:
- Identification: Recognizes distinct food items on the plate.
- Portion & Calories: Estimates serving sizes and energy content.
- Macro Breakdown: Calculates Protein, Carbs, and Fats.
- Health Score: Provides a qualitative health assessment of the meal.
- 🛠 Flexible Configuration: Simple YAML-based setup for API keys and model preferences.
- Python 3.8+ installed on your system.
- (Optional) Ollama installed if you plan to use local models.
-
Clone the Repository
git clone https://github.com/yourusername/nutrilens.git cd nutrilens -
Install Dependencies It is recommended to use a virtual environment.
python -m venv venv source venv/bin/activate pip install -r requirements.txt -
Configuration Copy the example configuration file to create your local config.
cp config.example.yaml config.yaml # On Windows: copy config.example.yaml config.yaml -
Add API Keys Open
config.yamland add your API keys. You can paste them directly or reference environment variables (e.g.,${OPENAI_API_KEY}).providers: openai: api_key: "sk-..." gemini: api_key: "AIza..." # ... other providers
Start the Flask development server:
python app.pyVisit http://localhost:5000 in your browser to start analyzing meals!
The config.yaml file allows you to define which AI models are available in the UI.
To use a local model like Llama 3.2 Vision:
- Run
ollama servein your terminal. - Pull the model:
ollama pull llama3.2-vision. - Ensure your
config.yamlmatches the default:ollama: name: "Ollama (Local)" type: ollama model: "llama3.2-vision" base_url: "http://localhost:11434"
Simply populate the api_key field for your desired provider. If a provider is missing an API key, it will automatically be hidden from the UI.
Important: The nutritional information and calorie estimates provided by this application are generated by AI and are approximate. Actual values may vary based on ingredients, preparation methods, and portion sizes.
This tool is for educational and informational purposes only. It is not a substitute for professional medical advice, diagnosis, or treatment. Always seek the advice of your physician or qualified health provider with any questions you may have regarding a medical condition or dietary changes.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project.
- Create your feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
Distributed under the MIT License. See LICENSE for more information.