LLM-driven Python daily nutrition app
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pynutrition-0.0.1.tar.gz.
File metadata
- Download URL: pynutrition-0.0.1.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b24432037d4bf7b043c93a900ae8a9aba2a81f572abb655126ac5df2ec7b5f68
|
|
| MD5 |
29228a0e27cd8e04dab41c03d81a17bd
|
|
| BLAKE2b-256 |
ddb11903303b53ea795843c59372811b314a5ecf5468491cce5712e17c84df8e
|
File details
Details for the file pynutrition-0.0.1-py3-none-any.whl.
File metadata
- Download URL: pynutrition-0.0.1-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
080812011a7fa72bfc27753ba020c0c32f834fa0eac0cc93b3e7a00b6112fd1e
|
|
| MD5 |
e86a15876e1a08c25a1fe9624ab9b333
|
|
| BLAKE2b-256 |
bcb1f6c2b792dabe4548e5eb3233e610fc928f763cc13d02bbd8ab5472637694
|