This is a RESTful API designed for use with the Line-Chatbot project. It provides predictions for employee status using an ensemble machine learning model. The API receives user input from the chatbot and returns a prediction of whether an employee will stay or leave based on certain features.
- Receives JSON input with employee attributes
- Uses a pre-trained ensemble machine learning model to predict employee status
- Returns a prediction result in JSON format
- Deployed on Render for public access
This API is hosted on Render along with the Line-Chatbot project. Both services must be deployed together for full functionality.
Ensure you have the following dependencies installed:
flask
flask-cors
gunicorn
numpy
pandas
joblib
scikit-learn==1.6.1
- URL:
/
- Method:
GET
- Response:
{ "message": "Welcome to the Employee Status Prediction API!" }
- URL:
/predict
- Method:
POST
- Request Body (JSON):
{ "age": 30, "length_of_service": 5, "salary": 30000, "gender": 0, "marital_status": 1 }
- Response (JSON):
{ "prediction": "ยังคงทำงานอยู่", "age": 30, "length_of_service": 5, "salary": 30000, "gender": 0, "marital_status": 1 }
- Clone the repository:
git clone https://github.com/your-repo/BOT-RESTful-API.git
- Navigate to the project directory:
cd BOT-RESTful-API
- Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Mac/Linux venv\Scripts\activate # On Windows
- Install dependencies:
pip install -r requirements.txt
- Run the application:
python app.py
- The API should now be running on
http://127.0.0.1:5000/
To deploy this project on Render:
- Push your code to a GitHub repository.
- Go to Render.
- Create a new Web Service and connect it to your repository.
- Set the Start Command to:
gunicorn app:app
- Deploy the service and obtain the Render-hosted API URL.
- Line-Chatbot: This API works together with the chatbot to provide predictions.
- Python-Web-Application-Ensemble_Techniques: The original model training project.
This project is licensed under the MIT License.