Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

Β 

History

History
141 lines (81 loc) Β· 2.42 KB

File metadata and controls

141 lines (81 loc) Β· 2.42 KB

πŸš— Used Cars Price Prediction

A Flask-based web application that predicts the resale price of used cars based on features such as manufacturing year, kilometers driven, company, and fuel type. The app uses a trained machine learning model to provide accurate predictions through a simple and user-friendly web interface.

πŸ“Œ Features

βœ… Predicts used car prices based on input parameters

βœ… Flask backend with machine learning integration

βœ… Input validation and error handling

βœ… REST API endpoint (/predict) for JSON-based predictions

βœ… Simple, responsive frontend using HTML (index.html)

πŸ› οΈ Tech Stack

Python 3.x

Flask – Web framework

NumPy – Numerical computations

Pickle – Model serialization

HTML/CSS/JS – Frontend UI

πŸ“‚ Project Structure Used-Car-Price-Prediction/ β”‚ β”œβ”€β”€ static/ # Static files (CSS, JS, images) β”œβ”€β”€ templates/ # HTML templates (frontend UI) β”‚ └── index.html β”‚ β”œβ”€β”€ car_price_model.pkl # Trained ML model (serialized) β”œβ”€β”€ app.py # Main Flask application β”œβ”€β”€ requirements.txt # Required dependencies └── README.md # Project documentation

βš™οΈ Installation & Setup

Clone the repository

git clone https://github.com/your-username/used-car-price-prediction.git cd used-car-price-prediction

Create & activate virtual environment (optional but recommended)

python -m venv venv source venv/bin/activate # Linux/Mac venv\Scripts\activate # Windows

Install dependencies

pip install -r requirements.txt

Run the application

python app.py

Access the app in your browser

http://127.0.0.1:5000/

πŸ“Š Usage

Open the app in your browser.

Enter the required details:

Year of the car

Kilometers Driven

Company (as encoded value)

Fuel Type (as encoded value)

Click Predict.

The app will display the predicted car price.

πŸ”Œ API Endpoint POST /predict

Request (Form Data):

{ "year": 2018, "kms_driven": 45000, "company": 2, "fuel_type": 1 }

Response (JSON):

{ "price": 450000.75 }

Error Example:

{ "error": "All fields are required. Please fill in all values." }

πŸ“¦ Dependencies

Add these to requirements.txt:

Flask numpy pickle-mixin

πŸš€ Deployment

You can deploy this app on:

Heroku

PythonAnywhere

Render

AWS / Azure / GCP

πŸ“œ License

This project is licensed under the MIT License.

πŸ‘¨β€πŸ’» Author

Anuj Kumar πŸ“§ [email protected]