🍷 Wine Quality Predictor

An interactive overview of a Flask web application that predicts the quality of red wine using a machine learning regression model.

Get Started

Key Features

🖥️

User-friendly Interface

A simple, clean web form for entering wine properties, making it accessible to all users.

🤖

Regression Model

Predicts a continuous wine quality score (e.g., from 3 to 8) for nuanced evaluation.

🖱️

Auto-fill Buttons

Allows for quick testing with predefined values for low, medium, and high-quality wines.

📱

Responsive Design

Optimized for various screen sizes, providing a seamless experience on mobile and desktop.

🏠

Landing Page

An attractive, professional introduction page to welcome users to the application.

How It Works & Technology

The Machine Learning Core

The application uses a RandomForestRegressor model, a powerful ensemble learning method, which was trained on the renowned Wine Quality Red dataset from the UCI Machine Learning Repository.

To ensure prediction accuracy, all input features are scaled using a StandardScaler before being fed into the model. This process standardizes the features to have a mean of 0 and a standard deviation of 1, preventing features with larger scales from dominating the model's learning process.

Technology Stack

Python
Flask
Scikit-learn
NumPy
Pandas
HTML/CSS/JS

Project Structure

  • 📁 your_project_folder/
    • 📄 app.py # Main Flask application
    • 📄 train_model.py # Script to train and save the model
    • 📄 winequality-red (1).csv # Dataset for training
    • 📄 requirements.txt # Python dependencies
    • 📄 .gitignore # Specifies files to ignore
    • 📁 templates/
      • 📄 index.html # The prediction form
      • 📄 index_landing.html # The landing page
    • 📁 static/
      • 📄 style.css # Custom CSS

Note: `scaler.pkl` and `wine_model_regression.pkl` are generated by `train_model.py` and are intentionally excluded from version control.

Setup & Installation Guide

1

Clone the Repository

Get the project files on your local machine.

git clone https://github.com/AliGohar2151/Wine_Prediction_System.git
cd Wine_Prediction_System
2

Create & Activate Virtual Environment

Isolate project dependencies. Run the command for your OS.

# Windows

python -m venv venv
.\\venv\\Scripts\\activate

# macOS/Linux

python -m venv venv
source venv/bin/activate
3

Install Dependencies

Install all required Python libraries from `requirements.txt`.

pip install -r requirements.txt
4

Generate Model Files

Run the training script to create `scaler.pkl` and `wine_model_regression.pkl`.

python train_model.py
5

Run the Flask App

Start the local development server.

python app.py

Access the application in your browser at http://127.0.0.1:5000/.