Skip to content

A project based on OpenFoodFacts data to build a machine learning model able to predict a nutriscore grade

License

Notifications You must be signed in to change notification settings

mickaelandrieu/nutriscore-app

Repository files navigation

OpenFoodFacts Nutriscore predictor

How to get the dataset

As the dataset is too big to be shared on GitHub, you must download it on OpenFoodFacts (products.csv: 4Go).

Local installation

python -m venv dev
source dev/Scripts/activate
pip install -r requirements.txt

Docker installation

Build the image

docker build --tag app:1.0 .

Access the Streamlit application

docker run --publish 8501:8501 -it app:1.0 -m streamlit run src/app.py

Then access http://localhost:8501.

Access the REST API

docker run --publish 8501:8501 -it app:1.0 src/api.py

Then access http://localhost:8501

Everytime you update the project, you must build a new image with a new tag.

Train the model

  1. Download the RAW data on OpenFoodFacts ;
  2. Execute notebooks/eda.ipynb notebook to clean the data ;
  3. Execute notebooks/feature_encoding_and_selection.ipynb notebook to transform the data ;
  4. Execute src/create_folds.py to prepare data for training ;
  5. Execute src/train.py to train the model ;

Evaluate the performance of the model

python src/report.py --fold=1

fold value is in range [0,4]

report (10th of January, 2022)

Test the machine learning model (Without Docker)

Using a Streamlit Web app

streamlit run src/app.py

Using a REST API

python src/api.py

Quality tools

python -m isort src/
python -m black src/
python -m flake8 src/ --count --statistics

LICENSE

This project is provided under the MIT license.

About

A project based on OpenFoodFacts data to build a machine learning model able to predict a nutriscore grade

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published