This project is a food recommendation engine that processes order data from CSV files, categorizes food items using a local LLM (Ollama), and generates recommendation rules.
- Python 3.10 or higher
- Pip for package management
- A running instance of Ollama with the
llama3.2model.
-
Clone the repository:
git clone <repository_url> cd <repository_name>
-
Create and activate a virtual environment:
python3 -m venv .env source .env/bin/activate -
Install the required dependencies:
pip install -r requirements.txt
This project involves two main components: a data processing pipeline and a Flask web application.
This script processes raw order data, categorizes food items, and generates recommendation rules.
To run the data processing pipeline, execute the following command from the root of the project:
python src/pipeline.pyThis will:
- Read all CSV files from the
data/rawDatadirectory. - For each file, it will extract unique food items.
- Categorize the items using the Ollama Llama3.2 model.
- Generate two rule files (
rules.jsonanduser_history.json) and save them in a new directory undermodel/<restaurant_name>/.
This application provides an API endpoint to get meal suggestions based on the pre-generated rules.
To start the Flask web application, execute the following command from the root of the project:
python src/app.pyThis will start a local development server, typically accessible at http://127.0.0.1:5000/.
You can access the meal suggestion API using the following examples:
-
Get general suggestions for a restaurant:
http://127.0.0.1:5000/get_meal_suggestions?restaurant=Nagarjunasuites -
Get personalized suggestions for a user:
http://127.0.0.1:5000/get_meal_suggestions?restaurant=Nagarjunasuites&user_phone_number=916383728873 -
Get suggestions based on items in the cart:
http://127.0.0.1:5000/get_meal_suggestions?restaurant=Nagarjunasuites&items_in_cart=Dal%20Tadka,Plain%20Rice