Farmify is a Python-based project designed to help farmers with crop disease prediction, crop recommendation, and fertilizer suggestions. It utilizes machine learning models and Flask for web application development.
- Clone the repository:
git clone https://github.com/yourusername/farmify.git cd farmify
- Install the required packages using Conda:
conda create --name farmify_env python=3.9 conda activate farmify_env conda install --file requirements.txt
- Set up configuration:
- Add your API keys and other configurations to config.py.
- Navigate to the "Disease Prediction" page.
- Upload an image of the affected crop.
- The system predicts the disease and provides information about it.
- Visit the "Crop Recommendation" page.
- Enter soil nutrient levels, pH, rainfall, and location.
- Receive recommendations for suitable crops based on environmental factors.
- Access the "Fertilizer Suggestion" page.
- Enter the crop name and current soil nutrient levels.
- Get recommendations for appropriate fertilizers to use.
The project follows a structured format:
farmify/ │ ├── app.py ├── utils/ │ ├── disease.py │ ├── fertilizer.py │ ├── model.py │ └── ... ├── templates/ │ ├── index.html │ ├── crop.html │ ├── fertilizer.html │ ├── contact.html │ ├── faq.html │ ├── disease.html │ ├── crop-result.html │ ├── fertilizer-result.html │ ├── disease-result.html │ └── ... ├── static/ │ ├── css/ │ │ └── style.css │ ├── js/ │ │ └── script.js │ ├── images/ │ │ ├── rice.jpeg │ │ ├── maize.jpeg │ │ ├── chickpea.jpeg │ │ └── ... │ └── ... ├── models/ │ ├── plant_disease_model.pth │ └── RandomForest.pkl ├── Data/ │ ├── fertilizer.csv │ ├── cpdata.csv │ ├── FertilizerData.csv │ ├── FinalData.csv │ ├── MergeFileCrop.csv │ ├── Crop_recommendation.csv │ └── ... ├── README.md ├── requirements.txt └── config.py
- Create and activate a Conda environment for the project:
conda create --name farmify_env python=3.9 conda activate farmify_env conda install --file requirements.txt
- Install the required packages:
conda install --file requirements.txt
- Add your API keys and other configurations to config.py.
- The Flask app handles the web interface and routes for disease prediction, crop recommendation, and fertilizer suggestions.
- Contains a dictionary (disease_dic) with information about various crop diseases.
- Includes a dictionary (fertilizer_dic) with recommendations based on soil nutrient levels.
- Defines the ResNet9 model architecture for disease prediction using PyTorch.
- Utilizes the OpenWeatherMap API to fetch temperature and humidity data for crop recommendations.
- Uses a Random Forest model (RandomForest.pkl) to recommend crops based on soil and weather conditions.
- Contains HTML files for the web interface, including home, crop recommendation, fertilizer suggestion, contact, FAQ, and disease prediction pages.
- Includes CSS styles (style.css), JavaScript (script.js), and images for crop recommendations.
- To run the application:
python app.py
Open your browser and go to http://localhost:5000/ to access the Farmify web application.
- Data sourced from various repositories and kaggle.
- Weather data obtained from the OpenWeatherMap API.