/Salary-Price-Prediction

Salary Prediction API using Flask predicts salaries for freshers joining organizations based on factors like past experience, company switches, courses completed, and academic marks. This Flask-based API allows users to input their details and receive a salary prediction. With no user interface, it's designed for integration into other applications

Primary LanguagePython

Salary Price Prediction in Flask API

Description

The Salary Prediction API using Flask is a tool that predicts salaries for freshers joining organizations based on factors such as past experience, company switches, courses completed, and academic marks. Developed using Flask, this API enables users to input their details and receive a salary prediction in return. Without a user interface, it's specifically designed for seamless integration into other applications.

Use Case

Imagine a scenario where HR departments of various companies want to streamline their salary prediction process for new hires. This API can be integrated into their existing systems, allowing HR managers to input candidate details and quickly obtain salary estimates. By automating this process, companies can save time and resources while ensuring fair and data-driven salary offers to potential employees.

Table of Contents

  1. Description
  2. Use Case
  3. Usage
  4. API Endpoint
  5. Code
  6. Dependencies
  7. License

Usage

To utilize this API, follow these steps:

  1. Ensure you have Python installed on your system.

  2. Install the necessary dependencies by running:

    pip install flask numpy xgboost
    
  3. Clone or download the repository to your local machine.

  4. Navigate to the project directory.

  5. Run the Flask application by executing the following command:

    python app.py
    
  6. Once the Flask server is up and running, you can send POST requests to the endpoint (/) with the required input data in JSON format. The API will respond with the predicted salary.

API Endpoint

  • URL: /
  • Method: POST
  • Input Data: JSON object containing the following parameters:
    • SEX: Gender of the candidate (string)
    • DESIGNATION: Designation of the candidate (string)
    • AGE: Age of the candidate (integer)
    • UNIT: Work unit of the candidate (string)
    • LEAVES USED: Number of leaves used by the candidate (integer)
    • LEAVES REMAINING: Number of leaves remaining for the candidate (integer)
    • RATING: Performance rating of the candidate (float)
    • PAST EXP: Past experience of the candidate (float)
  • Output: Predicted salary (JSON format)

Code

The core functionality of the API is implemented in Python using the Flask web framework. Below is a brief overview of the main components of the code:

  • app.py: This file contains the Flask application setup, including loading the trained model (xgb_pipeline.pkl) using pickle, defining the API endpoint, and handling incoming requests to predict salaries based on input data.

Dependencies

  • Flask: A lightweight WSGI web application framework in Python.
  • NumPy: A library for numerical computing with Python.
  • XGBoost: An optimized distributed gradient boosting library designed for efficient and flexible machine learning.

License

This project is licensed under the MIT License.