AI Nutrition Tracker is a modern web application that helps users understand the nutritional content of their food through two powerful interfaces: image recognition and natural language AI chat. Simply upload a photo of your meal or ask nutrition-related questions to get instant insights.
- Upload food images via drag-and-drop or file selection
- Automatic food identification using Facebook's DETR-ResNet50 object detection model
- Real-time nutritional information retrieval from USDA FoodData Central API
- Chat interface with an AI nutrition expert powered by Qwen3-0.6B language model
- Get answers about calories, nutrients, dietary recommendations, and more
- Intelligent response formatting with highlighted information
- Seamless interface switching between chat and image upload modes
- Responsive design that works across devices
- Clean, intuitive UI with smooth animations and visual feedback
- Backend: Django (Python web framework)
- Machine Learning:
- Object Detection: Facebook's DETR (DEtection TRansformer) with ResNet-50 backbone
- NLP: Qwen3-0.6B language model for nutrition-related chat responses
- APIs: USDA FoodData Central API for comprehensive nutritional data
- Frontend: Vanilla JavaScript, HTML5, CSS3 with custom animations
- Deployment: Compatible with standard Python web hosting environments
-
Clone the repository:
git clone https://github.com/yourusername/ai-nutrition-tracker.git cd ai-nutrition-tracker -
Create a virtual environment:
python3 -m venv venv source venv/bin/activate # For Unix/MacOS # OR venv\Scripts\activate # For Windows
-
Install dependencies:
pip install -r requirements.txt
-
Create a .env file with your USDA API key:
USDA_API_KEY=your_api_key_hereGet your free API key from: USDA FoodData Central
-
Run the development server:
python3 manage.py runserver
-
Visit
http://127.0.0.1:8000/in your browser to use the application.
- Click the "Image Upload" tab
- Drag and drop a food image or click to select a file
- Click "Analyze Food"
- View the detected food items and their detailed nutritional information
- Click the "Chat Mode" tab (active by default)
- Type your nutrition-related question in the input field
- Get instant answers with key information highlighted
- Continue the conversation with follow-up questions
ai-nutrition-tracker/
├── food_detector/ # Main Django app
│ ├── templates/ # HTML templates
│ ├── views.py # View functions handling requests
│ └── urls.py # URL routing
├── static/ # Static assets
│ ├── css/ # Stylesheets
│ ├── js/ # JavaScript files
│ └── images/ # Images
├── media/ # Uploaded images
├── main.py # Food detection logic
├── manage.py # Django management script
└── README.md # Project documentation
- User accounts to save food history and track nutritional intake over time
- Meal planning recommendations based on nutritional goals
- Mobile app version with camera integration
- Expanded food database with regional and cultural specialties
MIT License
- Machine learning models from Hugging Face
- Nutritional data from USDA FoodData Central
- Icons by Font Awesome
Made with ❤️ for better nutrition