A comprehensive nutrition tracking dashboard powered by AI image analysis using Google's Gemini 2.5 Flash model.
- 🤖 AI-Powered Food Analysis - Upload food images and get detailed nutritional breakdowns
- 📊 Interactive Dashboard - Track daily nutrition with beautiful charts and progress indicators
- 🎯 Goal Tracking - Set and monitor daily calorie and macronutrient goals
- 📱 Mobile Responsive - Optimized for all devices with bottom navigation
- 🔐 User Authentication - Secure sign up/sign in with MySQL database
- 📈 Progress Analytics - Weekly trends and goal achievement tracking
- 🥧 Visual Insights - Pie charts for macronutrient breakdown and progress bars
- Python 3.8+
- MySQL database
- Gemini API key from Google AI Studio
-
Clone the repository
git clone https://github.com/jthweb/AI-Calories-Calculator.git cd AI-Calories-Calculator
-
Install dependencies
pip install -r requirements.txt
-
Configure environment variables Copy
.env
and update with your database credentials:DB_HOST=your_mysql_host DB_PORT=3306 DB_NAME=calories_tracker DB_USER=your_username DB_PASSWORD=your_password SECRET_KEY=your_secret_key
-
Set up database The app will automatically create the required tables on first run.
-
Run the dashboard
streamlit run app.py
-
Access the app Open http://localhost:8501 in your browser
The dashboard is fully responsive with:
- Bottom navigation bar for easy mobile access
- Touch-friendly interface
- Optimized layouts for small screens
- Progressive Web App capabilities
- Frontend: Streamlit with custom CSS/HTML
- AI Model: Google Gemini 2.5 Flash
- Database: MySQL
- Charts: Plotly
- Image Processing: PIL/Pillow
- Authentication: Custom secure implementation
- Daily nutrition overview
- Progress metrics with visual indicators
- Macronutrient pie charts
- Weekly calorie trends
- Today's meal summary
- Food image upload/camera capture
- AI-powered nutritional analysis
- Meal type categorization
- Automatic data saving
- Set daily nutrition targets
- Progress tracking with charts
- Goal achievement analytics
- Preset configurations (weight loss, maintenance, muscle gain)
- Profile management
- API key configuration
- Data export options
- Account preferences
The app creates three main tables:
users
- User accounts and preferencesmeals
- Meal records with nutrition datameal_items
- Individual food items per meal
- Passwords are securely hashed
- API keys are encrypted in database
- Images are processed in real-time (not stored)
- Local browser storage for session management
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
- Google Gemini AI for powerful food analysis
- Streamlit for the fantastic web framework
- Plotly for beautiful interactive charts
- Original concept by JThweb
For issues and feature requests, please open an issue on GitHub.