NutriAI is a sophisticated nutrition analysis platform designed to provide real-time insights into food product ingredients. Utilizing high-performance Google Gemini Large Language Models (LLMs) and computer vision, the system analyzes ingredient lists and nutritional labels to deliver a comprehensive health assessment, categorized highlights, and an interactive nutritionist chat interface.
- Framework: React 19 (Vite-powered Single Page Application)
- Styling: Tailwind CSS
- State Management: React Context API (NutriContext)
- Image Handling: Custom cropping and webcam integration via
react-image-cropandreact-webcam.
- Server: Python Flask
- AI Engine: Google Gemini 1.5 Series
- Integrated multimodal analysis using Gemini 1.5 (Pro/Flash) for unified image recognition, nutritional reasoning, and conversational interaction.
- Architecture: Blueprint-based modular structure with service-oriented logic.
| Endpoint | Method | Description |
|---|---|---|
/health |
GET |
Service status and health monitoring. |
/samples |
GET |
Fetches a list of standardized product samples for testing. |
/analyze |
POST |
Primary analysis engine. Accepts Base64 image data or raw ingredient text. |
/chat |
POST |
Stateful conversational interface for nutritional follow-ups. |
- Node.js (v18+)
- Python (v3.10+)
- Google Gemini API Key
git clone https://github.com/Sayan-CtrlZ/NutriAI.git
cd nutriAI- Navigate to the server directory:
cd server - Create and activate a virtual environment:
python -m venv venv source venv/Scripts/activate # Windows
- Install dependencies:
pip install -r requirements.txt
- Configure environment variables in
.env:GEMINI_API_KEY=your_gemini_api_key_here ALLOWED_ORIGINS=<YOUR_FRONTEND_URL>,http://localhost:5173 PORT=10000
- Execute the server:
python run.py
- Navigate to the client directory:
cd ../client - Install dependencies:
npm install
- Configure environment variables in
.env:VITE_API_URL=<YOUR_BACKEND_URL>
- Start the development environment:
npm run dev
- Dynamic Scoring: A 0-100 proprietary health score based on ingredient quality.
- Set the following environment variables on your hosting provider:
GEMINI_API_KEY: Your Google Gemini API Key.ALLOWED_ORIGINS: Comma-separated list of your frontend URLs (e.g.,https://your-frontend-app.com).PORT: Usually10000or as required by your provider.
- Set the Health Check Path to
/health.
- Set the following environment variable on your hosting provider:
VITE_API_URL: The URL of your deployed backend (e.g.,<YOUR_BACKEND_URL>).
- Build the project:
npm run build
© 2025 NutriAI by TechHackers