Skip to content

mosh3eb/Crop_predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crop Prediction AI System

Overview

The Crop Prediction AI System is a machine learning application designed to predict optimal crop yields based on various environmental and soil parameters. By leveraging multiple predictive models, including Decision Tree, Logistic Regression, Naive Bayes Classifier, and Random Forest, this system provides accurate recommendations for farmers and agricultural stakeholders.

BEfore sending a Request

After getting a Response

Features

  • Multi-Model Prediction: Utilizes various machine learning algorithms to enhance prediction accuracy.
  • User-Friendly API: Built using FastAPI, allowing easy integration and interaction with the prediction system.
  • CORS Support: Configured to allow requests from any origin, facilitating cross-origin resource sharing.

Technologies Used

  • Python: The primary programming language used for development.
  • FastAPI: A modern web framework for building APIs with Python.
  • Pandas: A data manipulation library used for handling input data.
  • Machine Learning Libraries: Includes popular libraries for model training and prediction.

Installation

  1. Clone the repository:

    git clone https://github.com/mosh3eb/Crop_predictor.git
    cd Crop_predictor
    
    
  2. Install the required dependencies:

    pip install -r requirements.txt
    

Usage

  1. Start the FastAPI server:

    uvicorn main:app --reload
    
    
  2. Send a POST request to the /predict endpoint with the following JSON body:

    {
     "nitrogen": <value>,
     "phosphorus": <value>,
     "potassium": <value>,
     "temperature": <value>,
     "humidity": <value>,
     "ph": <value>,
     "rainfall": <value>
    }
    
    
  3. The response will include the predicted crop:

    {
     "predicted_crop": "crop_name"
    }
    

Contribution

Contributions are welcome! If you have suggestions for improvements or new features, please fork the repository and submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.