A Flask-based web application that recommends restaurants based on user preferences using machine learning. The application uses a KMeans clustering algorithm to provide personalized restaurant recommendations based on city, cuisine, country, cost, and rating preferences.
- User-friendly web interface
- ML-based restaurant recommendations using KMeans clustering
- Results displayed as an interactive table
- Docker support for easy deployment
- Personalized recommendations based on multiple criteria
/app
├── app.py # Flask application
├── model_utiles.py # ML model and recommendation logic
├── templates/
│ ├── index.html # Input form
│ └── results.html # Recommendation results
├── requirements.txt # Python dependencies
├── Dockerfile # Docker image setup
├── docker-compose.yml # Docker Compose config
└── README.md # Project documentation
User Input (City, Cuisine, Country, Cost, Rating)
↓
Feature Encoding (Scaler + OneHot Encoding)
↓
KMeans Clustering → Predict User Cluster
↓
Filter Restaurants in Same Cluster
↓
Compute Distance to User Vector
↓
Rank by Nearest Distance
↓
Return Top-N Recommendations
- Python 3.8+
- Flask
- pandas
- scikit-learn
- Docker (optional, for containerized deployment)
- Docker Compose (optional)
-
Clone the repository:
git clone <repository-url> cd restaurant-recommender
-
Install dependencies:
pip install -r requirements.txt
-
Run the Flask application:
python app.py
-
Access the application:
- Open your browser and navigate to the address shown in the Flask console output
- Default:
http://localhost:5000(or the port specified in your Flask app)
-
Build the Docker image:
docker build -t restaurant-recommender:latest . -
Run the Docker container:
docker run -p 5000:5000 restaurant-recommender:latest
-
Access the application:
- Open your browser at
http://localhost:5000
- Open your browser at
-
Start the application:
docker-compose up -d
-
Access the application:
- Open your browser at the port specified in
docker-compose.yml - Check the compose file for the exact port mapping
- Open your browser at the port specified in
-
Stop the application:
docker-compose down
-
Enter your preferences:
- Navigate to the home page
- Fill in the form with your preferences:
- City
- Cuisine type
- Country
- Cost range
- Minimum rating
-
Get recommendations:
- Click the submit button
- View personalized restaurant recommendations based on your inputs
-
Refine search:
- Navigate back to adjust your preferences
- Submit again for new recommendations
- Port Configuration: Modify the port in
app.pyordocker-compose.ymlas needed - Model Parameters: Adjust clustering parameters in
model_utiles.py - Debug Mode: Currently enabled in Flask; disable for production deployment
Before deployment:
- Ensure
model_utiles.pycorrectly loads your ML model and restaurant dataset - Disable Flask debug mode for production environments
- Set appropriate environment variables for production
- Configure proper logging and error handling
Docker considerations:
- Modify Dockerfile if additional services or dependencies are required
- Update docker-compose.yml for multi-service deployments
- Ensure data persistence by configuring volumes if needed
To contribute or modify the application:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly (local and Docker environments)
- Submit a pull request
- Port already in use: Change the port in Flask app or docker-compose configuration
- Model loading errors: Verify the model file path and format in
model_utiles.py - Missing dependencies: Run
pip install -r requirements.txtagain - Docker build fails: Check Dockerfile syntax and ensure all required files exist