Giter Site home page Giter Site logo

pynutrition's Introduction

pynutrition

LLM-driven Python daily nutrition app

Installation

pip install pynutrition

Usage

from pynutrition import Ingredient, Quantity, Calories, Composition
from pynutrition.nutrients import Fat, Saturates, Carbohydrate, Sugar, Protein, Salt

yoghurt = Ingredient(name="Greek Yoghurt Bakoma (5900197012723)", quantity=Quantity(250), calories=Calories(100), composition=Composition({
    Fat(7.5), Saturates(4.5), Carbohydrate(4.7), Sugar(4.7), Protein(3.5), Salt(0.12) 
}), base=100)
walnuts = Ingredient("Walnuts Carrefour (5905617004623)", Quantity(30), Calories(666), composition=Composition({
    Fat(60.3), Saturates(6.6), Carbohydrate(11.5), Sugar(9.9), Protein(16)
}), base=100)

meal = yoghurt + walnuts
print(meal.calories.as_int())  # round(2.5 * 100 + 0.3 * 666)
>>> 450

The base is used for calculations of nutritional information which are expressed as amounts per base, often (as in the example) equal to 100g. All quantities are expressed in grams.

You can use .get_data and .load_data to fetch nutrional data with GPT-4 in the format accepted by the app and load each retrieved row as Ingredient that can be used to compose meals.

Info

Software engineers, plagued by the stereotype of poor eating and collecting bad habits

Source: HackerNoon

This is a one-day project I quickly built (and tuned) for myself to improve my diet and nutrition. While you can see the haste in the code and design, I have realised even such rudimentary version might be useful to you. I want to contribute to supporting others in the community in their goal of becoming healthier, happier and stronger.

I hope I will find some time to make this project grow. If you are interested in extending its functionalities, found bugs or want to help, hit me up through issues.

pynutrition's People

Contributors

haiyangdeperci avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.