samratghosh291 / Salary_Prediction_Backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Here's a README template for your salary prediction project:


Salary Prediction Flask App

This is a Flask web application for predicting salaries based on years of experience using a trained machine learning model.

Installation

  1. Clone the repository to your local machine:

    git clone https://github.com/your-username/salary_prediction_app.git
  2. Navigate to the project directory:

    cd salary_prediction_app
  3. Set up a virtual environment (optional but recommended):

    python3 -m venv venv
  4. Activate the virtual environment:

    • On Windows:

      venv\Scripts\activate
    • On macOS and Linux:

      source venv/bin/activate
  5. Install the required dependencies:

    pip install -r requirements.txt

Usage

  1. Ensure that you have your trained machine learning model saved as model.pkl in the app/ directory.

  2. Run the Flask app:

    python run.py
  3. Access the app in your web browser at http://127.0.0.1:5000/.

  4. Enter the years of experience in the input field and click the "Predict" button to get the predicted salary.

API Endpoints

  • GET /: Home page of the web application.
  • POST /predict: Endpoint for salary prediction.
    • Request:
      • Method: POST
      • Content-Type: application/x-www-form-urlencoded
      • Body:
        experience=<years_of_experience>
        
    • Response:
      • Content-Type: text/html
      • Body: HTML page with the predicted salary.

Folder Structure

salary_prediction_app/
│
├── app/
│   ├── __init__.py
│   ├── model.pkl
│   ├── routes.py
│   └── static/
│       └── styles.css
│   └── templates/
│       └── index.html
│
├── venv/
│
├── requirements.txt
└── run.py
  • app/: Directory containing the Flask application.
    • model.pkl: Trained machine learning model file.
    • routes.py: Flask routes for the web application.
    • static/: Static files (e.g., CSS).
      • styles.css: CSS file for styling.
    • templates/: HTML templates for the web pages.
      • index.html: HTML template for the UI.
  • venv/: Virtual environment directory.
  • requirements.txt: File containing all Python dependencies.
  • run.py: Script to run the Flask app.

Feel free to customize this README template according to your project's specific details and requirements!

About


Languages

Language:Python 54.1%Language:HTML 29.9%Language:CSS 16.0%