https://github.com/rikcav/api-ml-model
This project implements a simple Flask API for predicting BMI (Body Mass Index) categories based on input data. The API uses a RandomForestClassifier model trained on a dataset containing BMI information.
https://github.com/rikcav/api-ml-model
api bmi flask ml random-forest-classifier
Last synced: 3 months ago
JSON representation
This project implements a simple Flask API for predicting BMI (Body Mass Index) categories based on input data. The API uses a RandomForestClassifier model trained on a dataset containing BMI information.
- Host: GitHub
- URL: https://github.com/rikcav/api-ml-model
- Owner: rikcav
- Created: 2024-02-11T02:28:16.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-20T11:07:14.000Z (about 1 year ago)
- Last Synced: 2025-01-21T11:30:33.828Z (5 months ago)
- Topics: api, bmi, flask, ml, random-forest-classifier
- Language: Python
- Homepage:
- Size: 841 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BMI Prediction API
This project implements a simple Flask API for predicting BMI (Body Mass Index) categories based on input data. The API uses a RandomForestClassifier model trained on a dataset containing BMI information.
## Files in the Project
- **app.py**: Contains the Flask API implementation with two endpoints, one for testing the API (`/`) and another for getting the BMI prediction output (`/getPredictionOutput`).
- **model.py**: Contains the code for loading the dataset, preprocessing the data, training the RandomForestClassifier model using Grid Search for hyperparameter tuning, and saving the best model to a file.
- **prediction.py**: Contains a function for loading the trained model and making predictions based on input data.## Usage
1. Clone this repository to your local machine.
2. Install the required dependencies using `pip install -r requirements.txt`.
3. Run the Flask API using `python app.py`. The API will be available at `http://localhost:5000`.
4. Use a tool like Postman or curl to test the API endpoints. You can send a POST request to `/getPredictionOutput` with JSON data containing the features required for prediction.## Example Request
```json
{
"Gender": 1,
"Height": 170,
"Weight": 70,
"Age": 25
}
```## Example Response
```json
{
"predict": "Normal"
}
```