This project integrates a Python-trained Logistic Regression Classifier model with a Spring Boot application to predict the prices of electronic devices based on their specifications. The model, trained in Python, is exposed as a Flask web service, which the Spring Boot application consumes to provide predictions through RESTful APIs.
- Java JDK 11 or later
- Maven 3.6 or later
- Python 3.7 or later
- Flask
- Pandas
- Scikit-learn
- NumPy
- Install the required Python packages:
pip install flask pandas scikit-learn numpy
- Start the Flask server:
- Navigate to the directory containing the Flask application.
- Run the application:
python app.py
1.Clone the repository:
git clone <repository-url>
cd <repository-directory>
2.Build the project with Maven:
mvn clean install
3.Run the Spring Boot application:
mvn spring-boot:run
- GET '/api/devices/': Retrieves a list of all devices.
- GET '/api/devices/{id}': Retrieves details of a specific device by ID.
- POST '/api/devices': Adds a new device.
- POST '/api/predict/{id}': Predicts the price for a specific device and updates the device entity - with the predicted price.
To predict the price of a device using the system, send a POST request with the device ID:
curl -X POST http://localhost:8080/api/predict/{id}
Replace {id} with the actual ID of the device.