Greening the Future: Introducing Eco-Tree, an AI-Powered Agricultural Solution
Published: 2023-02-24 14:40:03

## Greening the Future: Introducing Eco-Tree, an AI-Powered Agricultural Solution

As we strive for a more sustainable future, the need for innovative solutions to support the agriculture industry is more pressing than ever. That's where Eco-Tree comes in - a machine learning-based web application that revolutionizes the way we approach crop and fertilizer recommendations.
Built with Angular-14 and Flask, Eco-tree harnesses the power of three advanced predictive models to provide accurate recommendations based on soil features. The implementation for these models can be found in the accompanying python notebooks, available in the "All Links" section of this article.
Eco-Tree's API, built using Flask and deployed on AWS, takes these recommendations to the next level by allowing users to access them in real-time. Simply send your soil data as a POST request to the API, and receive the predictions in a clear and concise JSON format.
The frontend of Eco-Tree is as beautiful as it is functional, thanks to the use of Angular-14 and the Material UI NPM package. With its clean and intuitive design, Eco-Tree makes it easy for users to access the information they need to make informed decisions about their crops and fertilizers.
In conclusion, Eco-Tree is a game-changer for the agriculture industry, providing valuable insights and recommendations to support sustainable farming practices. Whether you're a farmer, agronomist, or simply someone looking to make a positive impact on the environment, Eco-Tree is the solution you've been looking for.
Deployed Web Application 

Link: http://ecotree-app.s3-website.ap-south-1.amazonaws.com/

## Flask API End Points

1.Crop Recommendation End Point: http://ecotreeappfive-env.eba-hphdscvg.ap-south-1.elasticbeanstalk.com/predict_crop

2.Fertilizer Recommendation End Point: http://ecotreeappfive-env.eba-hphdscvg.ap-south-1.elasticbeanstalk.com/predict_fertilizer

## About Data returned by Flask API

The data is returned in JSON format:

1.For Crop Recommendation

```
{
    xgb_model_prediction: "rice",
    xgb_model_probability: 99.2%,
    rf_model_prediction: "rice",
    rf_model_probability: 99.3%,
    knn_model_prediction: "rice",
    knn_model_probability: 99.5%,
    final_prediction: "rice",
}
```

2.For Fertilizer Recommendation


```
{
    xgb_model_prediction: "Urea",
    xgb_model_probability: 99.2%,
    rf_model_prediction: "Urea",
    rf_model_probability: 99.3%,
    svm_model_prediction: "Urea",
    svm_model_probability: 99.5%,
    final_prediction: "Urea",
}
```

Note: This API can be used in your Web Application or Mobile Application by just sending a POST request with the necessary input data to the above-mentioned endpoints.

## Steps to run the Angular-14 Application in local

1. Clone this repo.
2. Open the command prompt in the source folder in frontend
3. Install all the NPM packages


```
npm install
```

Start the application


```
ng serve --open
```

The Application Runs on localhost:3000

## Steps to run the Flask API in local

1. Clone this repo
2. Open command prompt in "Flask_API"
3. Create a virtual environment


```
mkvirtualenv environment_name
```

Install all the packages

```
pip install -r requirements.txt
```

Run the app.py file

```
python app.py
```

## All Links

1. [Crop Recommender Notebook Link](https://www.kaggle.com/code/pazindushane/crop-recommendation)
2. [Fertilizer Recommender Notebook Link](https://www.kaggle.com/code/pazindushane/fertilizers-recommendation)
3. [Crop Dataset Link](https://www.kaggle.com/atharvaingle/crop-recommendation-dataset)
4. [Fertilizer Dataset Link](https://www.kaggle.com/gdabhishek/fertilizer-prediction)
5. [Deployed Web Application Link](http://ecotree-app.s3-website.ap-south-1.amazonaws.com/)

NOTE: Please do support by up voting the Kaggle notebooks if you liked my work.