Inspiration
Our team was inspired by the daily friction people experience with manual calorie tracking. Current solutions often require users to manually search and log food items, which is slow and prone to error. We wanted to leverage powerful, modern AI to make healthy eating and data logging instant, accurate, and seamless.
What it does
The Smart Calorie Tracker is an AI-powered web application that provides instant, visual nutritional analysis from a single image of a meal.
Image Analysis: Users upload a photo of their food.
Gemini AI Processing: The Flask backend sends the image to the Gemini API, which identifies the food items, estimates their quantities, and returns detailed calorie and macro information.
Data Visualization: The React frontend displays the results in a clean, professional dashboard, including a doughnut chart for macro distribution (protein, carbs, fat).
How we built it
We built the application using a robust, decoupled architecture :
Backend: Developed with Python and Flask. This layer handles image receiving, all communication with the Gemini API, and provides the core /analyze endpoint. We utilized a professional structure separating routes (URL definitions) and services (core business logic/AI calls).
Frontend: Built with React and bundled via Vite for a fast, modern development environment. The UI features a creative, split-screen desktop dashboard. We implemented a decoupled structure separating pages (e.g., Home.jsx) and a dedicated api directory (client.js) for handling all API communication.
AI Integration: We used the Gemini API for multimodal analysis, allowing it to accurately identify complex meals and estimate portion sizes directly from an image.
Challenges we ran into
Execution Policy: A major early challenge was resolving the Windows PowerShell Execution Policy error (npm.ps1 cannot be loaded...), which initially blocked running the frontend development server. This required running Set-ExecutionPolicy RemoteSigned as an administrator.
Initial Folder Structure: We initially struggled with disorganized code (monolithic app.py, monolithic App.jsx). This required a full project refactoring to implement professional separation of concerns (routes, services, pages, api).
Git Branching: We faced a src refspec main does not match any error during the final push to GitHub, caused by a mismatch between the local master branch and the remote main branch, which required running git branch -M main to align them.
Accomplishments we're proud of
Successful Gemini Integration: Achieving accurate, real-time nutritional analysis from a single image using the Gemini API.
Professional Architecture: Implementing a clean, decoupled backend (Flask routes/services) and frontend (React pages/api) structure, which drastically improves maintainability and scalability.
Intuitive UI/UX: Designing a fast, modern, and aesthetically pleasing user interface that makes complex nutritional data easy to digest.
What we learned
Separation of Concerns: The importance of structuring a project with distinct layers (UI, API Client, Routes, Business Logic) for long-term health.
Modern DevOps Workflow: Mastering the full Git lifecycle, from initialization and committing to handling branch conflicts (main vs. master) and correctly pushing code to a remote repository.
Troubleshooting Environment Errors: Effectively diagnosing and solving common system-level issues like the PowerShell Execution Policy.
What's next for Smart Calorie Tracker
User Authentication: Implementing user sign-up and login to save historical scan data.
Database Integration: Integrating a database (e.g., PostgreSQL or MongoDB) to store a history of user scans and nutritional targets.
Personalized Goals: Allowing users to set macro and calorie goals and providing feedback based on their scanned meals.