Your Intelligent Personal Nutritionist β Powered by Multi-Agent RAG Orchestration, Llama-3/4 Vision Systems, and a premium Glassmorphism client.
NutriCrew AI is a state-of-the-art intelligent nutritionist companion designed to replace manual, tedious food tracking databases with a frictionless visual experience. By combining high-speed computer vision and a collaborative team of specialized AI agents, NutriCrew analyzes any dish from a single photograph and offers deep culinary advice and recipes.
- πΈ Snapshot Analysis: Take a photo of your meal or upload it from your gallery to automatically detect ingredients, estimate calories, and score its overall health rating.
- π§ Multi-Agent RAG: Leverages a structured, sequential team of specialized AI agents (Ingredient Analysts, Nutrition Experts, and Chefs) to analyze composition, point out hidden allergens/additives, and formulate healthier alternatives.
- β¨ Premium Glassmorphic UI: Experience a fluid interface inspired by modern design trendsβcomplete with dynamic breathing background orbs, smooth sliding tab controls, micro-interactions, and built-in device haptic feedback.
- πΎ Offline History Tracking: Revisit your past meal analysis reports anytime with local offline persistence and intuitive swipe-to-dismiss feed management.
NutriCrew AI is designed with a decoupled architecture. A high-performance Flutter client manages layout rendering, local state persistence, and capture mechanisms. The backend uses an asynchronous FastAPI server to coordinate vision detection and run a sequential multi-agent intelligence pipeline to deliver structural nutritionist insights.
graph TD
A[Flutter Mobile Client] -->|1. POST Uploaded Image| B(FastAPI Gateway)
B -->|2. Analyze Image| C[Groq Llama-4-Scout-17b]
C -->|3. Food Segmentation JSON| B
B -->|4. Kickoff Sequential Crew| D[CrewAI Sequencer]
subgraph Multi-Agent Crew [Multi-Agent Analysis Team]
D -->|Task 1: Composition| E[Ingredient Analyst]
D -->|Task 2: Nutri Insights| F[Nutrition Expert]
D -->|Task 3: Healthy Recipes| G[Recipe Generator]
E -->|Output| F
F -->|Output| G
end
E & F & G -->|5. Structured Outputs| D
D -->|6. Merge Payload| B
B -->|7. JSON Response| A
A -->|8. Store Query Local| H[(SharedPreferences)]
The mobile application utilizes a Dark Mode Glassmorphic Design System built on custom layout widgets, linear gradients, backdrop-blur components, and haptic feedback triggers.
Launch into a gorgeous dark canvas featuring glowing background orbs that scale and reposition dynamically to keep the workspace alive.
| Welcome Portal | Upload Bottom Sheet | Image Loaded State |
|---|---|---|
- Animated Backgrounds: Breathing floating orbs with linear gradients shift softly in the background using
flutter_animatetriggers. - Micro-Animations: Capture portals pulse softly when empty, and CTA cards elevate with drop-shadow glow overlays upon loading.
A central analytical dashboard presenting immediate ratings, total caloric estimations, and macro balances.
- Circular Macro Gauges: Carbohydrates, proteins, and fats are visualised in proportional ring systems.
- Dynamic Health score: Features a rating gauge (1-10) color-coded on the fly (π’ Green for high health-index, π‘ Orange for moderate, π΄ Red for cautionary items).
A detailed section dissecting composition tables, specific nutritional advice, and actionable alternatives.
| Composition & Allergens | Nutritionist Advice | Alternative Recommendations |
|---|---|---|
- Nested Key-Value Tables: Automatically formats nested food JSON maps into clean, legible styling components.
- Interactive Navigation: Clicking on a suggested healthy alternative card fires a device haptic vibrate and automatically slides to the Recipes tab.
Provides detailed, healthy alternatives with lists of ingredients and checklists of preparation steps.
| Recipe Recommendations | Checklist Steps |
|---|---|
- Color-Coded Badges: Shows critical recipe insights like prep times and high-protein indicators.
- Functional Checklist: Interactive steps that keep tracking simple.
Offline history tracking ensures that all scanned analysis reports can be accessed instantly from the local database.
- Swipe-To-Dismiss: Swipe left on items to delete records permanently from the cache with soft haptic vibrations.
- Dynamic Indicators: A real-time notification badge counts and displays the active scan history total on the Home Screen.
NutriCrew segments food diagnostics and recipe formulation across specific specialized roles.
Acts as the initial segmenter. It parses the base64 image data payload and returns metadata including estimated calories and health rankings.
- Constraint: Output is configured as strict JSON:
{ "food_name": "String", "ingredients": ["Array of Strings"], "calories": 450, "health_rating": 7 }
- Role: Ingredient Analyst
- Goal: Analyze the food composition and ingredients list for artificial additives, hidden sugars, high-sodium products, or allergens.
- Backstory: An expert food scientist specializing in chemical analysis and dietetics.
- Role: Nutrition Expert
- Goal: Evaluate the caloric footprint and provide clear diet advice, highlighting why this food is rated the way it is and suggesting general alternatives.
- Backstory: A certified clinical nutritionist with deep experience in macro balancing and athletic diets.
- Role: Recipe Generator (Professional Chef)
- Goal: Develop detailed, step-by-step recipes for a healthier replacement for the detected food item.
- Backstory: A Michelin-star chef focused on converting calorie-dense comfort food into highly nutritious dishes.
The backend is built with FastAPI exposing an asynchronous post routing mechanism.
Accepts a raw image file upload, processes it with the Vision Engine, feeds it into the sequential Crew, and returns the merged analytical payload.
- Content-Type:
multipart/form-data - Payload:
file(Binary Image File)
{
"food_name": "Spaghetti Carbonara",
"ingredients": ["Spaghetti", "Pecorino Romano", "Guanciale", "Egg Yolks", "Black Pepper"],
"calories": 650,
"health_rating": 4,
"ingredient_analysis": "Refined wheat pasta causes rapid glucose spikes. Guanciale contains high levels of saturated fat and sodium...",
"nutrition_advice": "High in caloric density with low fiber. Increase micronutrients by adding roasted vegetables. Good protein source from eggs, but offset by high saturated fats.",
"healthy_alternative": "Zucchini Noodle Carbonara using Turkey Bacon and Light Pecorino.",
"recipes": [
{
"recipe_name": "Zucchini Noodle Carbonara",
"prep_time": "15 mins",
"ingredients": "3 medium zucchinis (spiraled), 4 slices turkey bacon (chopped), 2 large eggs, 1/4 cup light Pecorino Romano, Cracked black pepper",
"instructions": "1. Spiralize zucchinis and pat dry. 2. Crisp turkey bacon in a pan. 3. Whisk eggs and cheese in a bowl. 4. Toss zucchini noodles in the pan for 1-2 mins. 5. Remove from heat, stir in egg mixture quickly to avoid scrambling, and serve with fresh pepper."
}
]
}NutriCrew/
β
βββ backend/ # Asynchronous FastAPI Gateway
β βββ api/ # Route routers
β β βββ routes.py # /analyze endpoints & runner hookups
β βββ crew/ # CrewAI configuration
β β βββ agents.py # Multi-Agent configurations
β β βββ tasks.py # Structured task mappings
β β βββ runner.py # Crew sequencer & parser
β βββ tools/ # Vision integrations
β β βββ vision_tool.py # Llama-4-Scout API runner
β βββ uploads/ # Temporary file cache
β βββ app.py # Server entry file
β βββ requirements.txt # Backend Python dependencies
β βββ .env # API keys
β
βββ frontend/ # Flutter UI Application
βββ lib/
β βββ models/
β β βββ nutrition_model.dart # Resilient data converters
β βββ screens/
β β βββ home_screen.dart # Home & image upload interface
β β βββ result_screen.dart # Premium sliding result panels
β β βββ history_screen.dart # Offline storage swipe-to-dismiss feed
β βββ services/
β β βββ api_service.dart # Dio client settings
β β βββ history_service.dart # SharedPreferences interface
β βββ theme/
β β βββ app_theme.dart # Colors, gradients, typography
β βββ widgets/
β β βββ glass_card.dart # Custom BackdropFilter widget
β β βββ animated_background.dart # Floating breathing backdrop orbs
β βββ main.dart # Client entrypoint
βββ pubspec.yaml # Flutter dependencies
One of the highlights of the Flutter client is its Type Resilience Parser. In typical LLM integrations, formatting can vary (e.g. returning list objects, maps, or string arrays). To prevent client crashes, NutriCrew filters data using clean parsing logic in nutrition_model.dart:
static String _parseString(dynamic value) {
if (value == null) return "";
if (value is String) return value;
if (value is List) {
return value.map((e) => _parseString(e)).join("\n");
}
if (value is Map) {
final keys = value.keys.toList();
if (keys.length == 1) {
final val = value[keys.first];
if (val is String) return val;
}
return value.entries
.map((entry) => "${entry.key}: ${_parseString(entry.value)}")
.join("\n");
}
return value.toString();
}This prevents any _Map<String, dynamic> is not a subtype of String errors at runtime.
- Flutter SDK (3.22+)
- Python (3.10+)
- Groq Cloud API Key
- Navigate to the backend folder:
cd backend - Set up a virtual environment:
python -m venv venv # Activate on Windows: venv\Scripts\activate # Activate on macOS/Linux: source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Create a
.envfile in the root of thebackend/directory:GROQ_API_KEY=gsk_your_groq_api_key_goes_here
- Spin up the development server:
uvicorn app:app --reload --host 0.0.0.0 --port 8000
- Navigate to the frontend folder:
cd frontend - Verify package dependencies:
flutter pub get
- Check emulator connection (e.g., Android Emulator or physical device):
flutter devices
- Run the debug client:
flutter run
Note
If using an Android Emulator, the API service points to http://10.0.2.2:8000 (which loops back to localhost on the host PC). If testing on a physical device, update the base URL in api_service.dart to match your host PC's local IP address (e.g. http://192.168.1.XX:8000).
Feel free to open pull requests or file issues to enhance:
- Additional specialized CrewAI agents (like personal trainers or macro planners).
- SQLite-backed robust database synchronization.
- On-device ML classification.









