A smart Flask application that analyzes nutritional content, provides health scores, and suggests recipe videos for food items, with a special focus on Indian cuisine.
- 🔍 Instant nutrition analysis for any food item
- 💯 Smart health scoring system (1-10 scale)
- 🎯 Recipe video recommendations
- 🇮🇳 Indian cuisine specialization
- 📱 Mobile-friendly interface
- 🤖 AI-powered analysis using GPT-4o
- Backend: Flask (Python)
- Frontend: HTML, CSS, JavaScript
- AI/ML: OpenAI GPT-4o
- External APIs:
- OpenAI API
- YouTube Data API v3
app/
├── constants/ # Constants
├── models/ # Data models
├── routes/ # API endpoints
├── services/ # Business logic
├── static/ # Frontend assets
└── templates/ # HTML templates
- Clone & Install
git clone https://github.com/yourusername/calorie-counter.git
cd calorie-counter
pip install -r requirements.txt
- Create a
.env
file in the root directory:
OPENAI_API_KEY=your_openai_api_key
YOUTUBE_API_KEY=your_youtube_api_key
- Run the application:
python3 wsgi.py
POST /calculate_nutrition
Content-Type: application/json
{
"food_item": "butter chicken",
"quantity": 100,
"unit": "g"
}
GET /get_food_suggestions
Our health score (1-10) considers:
- Protein content (+)
- Fiber content (+)
- Vitamins & minerals (+)
- Sugar content (-)
- Sodium levels (-)
Score interpretation:
- 8-10: Excellent 🟢
- 6-7.9: Good 🟡
- 4-5.9: Fair 🟠
- 1-3.9: Limited 🔴
# Run all tests
pytest
# Run specific test file
pytest pytest tests/test_nutrition_routes.py -v
# Run with verbose output
pytest -v
# Run specific test case
pytest tests/test_nutrition_routes.py::TestNutritionRoutes::test_analyze_real_chicken_breast -v
tests/
├── __init__.py # Test configurations and shared data
├── conftest.py # Test fixtures
├── test_nutrition_routes.py # API endpoint tests
└── test_data/ # Test images and mock data
└── images/
├── valid_food.jpg
├── chicken_breast.jpg
└── invalid_format.txt
- Food suggestion validation
- Nutrition calculation with various inputs
- Image analysis with real food images
- Error handling and validation
- API response structure verification
- Fork
- Create feature branch (
git checkout -b feature/NewFeature
) - Commit (
git commit -m 'Add NewFeature'
) - Push (
git push origin feature/NewFeature
) - Open PR
- OpenAI team for GPT-4
- YouTube API team
- Flask community