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.
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.
To utilize this API, follow these steps:
-
Ensure you have Python installed on your system.
-
Install the necessary dependencies by running:
pip install flask numpy xgboost
-
Clone or download the repository to your local machine.
-
Navigate to the project directory.
-
Run the Flask application by executing the following command:
python app.py
-
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.
- 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)
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.
- 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.
This project is licensed under the MIT License.