This project provides a RESTful API for predicting Big Five Personality traits based on input data using a pre-trained TensorFlow model. It uses Flask as the web framework.
This API takes an array of 50 numerical values representing user responses, processes them through a machine learning model, and returns predictions for the five personality traits based on the Big Five Personality framework:
- Keterbukaan Sosial, Energi, dan Antusiasme (Extroversion)
- Kestabilan Emosi (Neuroticism)
- Kesepakatan (Agreeableness)
- Ketelitian (Conscientiousness)
- Keterbukaan terhadap Pengalaman (Openness)
- Python 3.8 or higher
- TensorFlow 2.x
- Flask
- NumPy
- Clone this repository:
git clone https://github.com/C242-PS142/StudyPath-ML.git
cd StudyPath-ML- Install the dependencies:
pip install -r requirements.txt- Ensure the
model.h5file is in the project root directory. This is the pre-trained TensorFlow model.
To start the Flask server locally:
python app.pyThe server will run on http://127.0.0.1:5000.
Description: Predicts the Big Five Personality traits based on input data.
Request Body:
- Content-Type: application/json
- Parameters: A JSON object with an input field containing an array of 50 numerical values.
{
"input": [0.5, 1.2, 3.4, ..., 2.1] // 50 values in total
}{
"prediction": {
"Keterbukaan Sosial, Energi, dan Antusiasme": 3.75,
"Kestabilan Emosi": 2.45,
"Kesepakatan": 4.20,
"Ketelitian": 3.80,
"Keterbukaan terhadap Pengalaman": 4.10
}
}