Skip to content

051821/Recommender-sys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 

Repository files navigation

Restaurant Recommender Web Application

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.

Features

  • 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

Project Structure

/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

Workflow

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

Requirements

  • Python 3.8+
  • Flask
  • pandas
  • scikit-learn
  • Docker (optional, for containerized deployment)
  • Docker Compose (optional)

Installation & Setup

Option 1: Run Locally

  1. Clone the repository:

    git clone <repository-url>
    cd restaurant-recommender
  2. Install dependencies:

    pip install -r requirements.txt
  3. Run the Flask application:

    python app.py
  4. 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)

Option 2: Run with Docker

  1. Build the Docker image:

    docker build -t restaurant-recommender:latest .
  2. Run the Docker container:

    docker run -p 5000:5000 restaurant-recommender:latest
  3. Access the application:

    • Open your browser at http://localhost:5000

Option 3: Run with Docker Compose

  1. Start the application:

    docker-compose up -d
  2. Access the application:

    • Open your browser at the port specified in docker-compose.yml
    • Check the compose file for the exact port mapping
  3. Stop the application:

    docker-compose down

Usage

  1. Enter your preferences:

    • Navigate to the home page
    • Fill in the form with your preferences:
      • City
      • Cuisine type
      • Country
      • Cost range
      • Minimum rating
  2. Get recommendations:

    • Click the submit button
    • View personalized restaurant recommendations based on your inputs
  3. Refine search:

    • Navigate back to adjust your preferences
    • Submit again for new recommendations

Configuration

  • Port Configuration: Modify the port in app.py or docker-compose.yml as needed
  • Model Parameters: Adjust clustering parameters in model_utiles.py
  • Debug Mode: Currently enabled in Flask; disable for production deployment

Important Notes

Before deployment:

  • Ensure model_utiles.py correctly 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

Development

To contribute or modify the application:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly (local and Docker environments)
  5. Submit a pull request

Troubleshooting

  • 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.txt again
  • Docker build fails: Check Dockerfile syntax and ensure all required files exist

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors