Food Recommendation System using TensorFlow Recommenders (TFRS) and deployed using TensorFlow Serving.
Notebook: MamMates Food Recommendation
Dataset: Food Recommendation Dataset (Dummy)
Using MamMates Food Recommendation, you can get food recommendation based on the given id_user
.
- TensorFlow 2.14.0 or higher
- TensorFlow Recommenders 0.7.3 or higher
- Docker 24.0.7 or higher
If you already have Docker installed, you only need to run the following command:
- Pull the image from Docker Hub:
docker pull putuwaw/mammates-food-recommendation
- Run the image:
docker run -p 8504:8504 --name ml-rec putuwaw/mammates-food-recommendation
-
You can check that the model is already running by opening the browser and go to http://localhost:8504/v1/models/food_rec
-
To do prediction, you can use the following command:
curl -s https://raw.githubusercontent.com/MamMates/ml-food-recommendation/main/example.json | curl -X POST -d @- http://localhost:8504/v1/models/food_rec:predict
- You will get the following response:
{
"predictions": [
{
"output_1": [
1.59945917, 1.14119792, 0.741919041, 0.635785818, 0.532811046,
0.467606097, 0.457192838, 0.0975963473, 0.017279733, -0.0865440145
],
"output_2": ["13", "14", "12", "2", "18", "20", "11", "10", "7", "9"]
}
]
}
If you want to develop this model, you can follow the steps below:
- Clone this repository:
git clone https://github.com/MamMates/ml-food-recommendation.git
-
Update the model by changing the saved model in the model folder.
-
Build the Docker image:
docker build -t mammates-food-recommendation .
- Run the image:
docker run -p 8504:8504 --name ml-rec mammates-food-recommendation
-
You can check that the model is already running by opening browser and go to http://localhost:8504/v1/models/food_rec
-
To do prediction, you can use the following command:
curl -d @example.json -X POST http://localhost:8504/v1/models/food_rec:predict
- To stop the container:
docker stop ml-rec
Note
If you want to learn more about TensorFlow Serving, you can read the REST API documentation here.
This project is licensed under the MIT License. See the LICENSE file for details.