forked from recodehive/machine-learning-repos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request recodehive#181 from manikumarreddyu/crop
Crop-Recommendation-System
- Loading branch information
Showing
19 changed files
with
3,509 additions
and
0 deletions.
There are no files selected for viewing
2,201 changes: 2,201 additions & 0 deletions
2,201
Crop-Recommendation-System/Crop_recommendation.csv
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Crop-Recommendation-system- | ||
## Introduction: | ||
|
||
In the realm of agriculture, where traditional knowledge meets cutting-edge technology, the Crop Recommendation System is revolutionizing how farmers choose crops. By taking into account the mineral composition of the soil, including potassium, nitrogen, and phosphorous, as well as factors like humidity, temperature, and rainfall, this data-driven project is empowering farmers with precise recommendations. In this blog, we'll delve deeper into how these critical factors play a pivotal role in the decision-making process. | ||
|
||
## The Role of Soil Minerals: | ||
1. Potassium: Potassium is a vital nutrient for plant growth, contributing to root development, disease resistance, and overall plant health. Soil tests reveal potassium levels, helping the system suggest crops that thrive in either high or low potassium conditions. | ||
2. Nitrogen: Nitrogen is essential for chlorophyll production and overall plant growth. Soil nitrogen content influences crop recommendations, as different crops have varying nitrogen requirements. | ||
3. Phosphorous: Phosphorous is crucial for root development and flowering. Soil phosphorous levels guide the system in suggesting crops that can optimize the available phosphorous. | ||
|
||
|
||
## Environmental Variables: | ||
1. Humidity: Crop success is closely tied to humidity levels. High humidity can lead to moisture-related diseases, while low humidity can result in stress for certain crops. The Crop Recommendation System factors in local humidity conditions to make precise recommendations. | ||
2. Temperature: Temperature affects the rate of plant growth and flowering. Some crops thrive in cooler conditions, while others prefer warmer climates. The system considers local temperature data for tailored suggestions. | ||
3. Rainfall: Rainfall during the growing season is essential for crop success. The Crop Recommendation System accounts for historical rainfall patterns and monsoon data to provide recommendations that align with local water availability. | ||
|
||
## Conclusion: | ||
The Crop Recommendation System represents the pinnacle of data-driven agriculture. By accounting for soil minerals, humidity, temperature, and rainfall, it empowers farmers to make informed decisions about crop selection. This approach not only boosts productivity but also contributes to more sustainable and resilient farming practices, which are essential for the future of agriculture in an ever-changing world. As technology continues to advance, projects like these demonstrate the transformative power of data in agriculture. | ||
|
||
|
Binary file added
BIN
+447 Bytes
Crop-Recommendation-System/crop_app/__pycache__/app.cpython-310.pyc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import joblib | ||
from flask import Flask, render_template, request, redirect | ||
app = Flask(__name__) | ||
|
||
@app.route('/') | ||
def home(): | ||
return render_template('Home_1.html') | ||
|
||
@app.route('/Predict') | ||
def prediction(): | ||
return render_template('Index.html') | ||
|
||
@app.route('/form', methods=["POST"]) | ||
def brain(): | ||
Nitrogen=float(request.form['Nitrogen']) | ||
Phosphorus=float(request.form['Phosphorus']) | ||
Potassium=float(request.form['Potassium']) | ||
Temperature=float(request.form['Temperature']) | ||
Humidity=float(request.form['Humidity']) | ||
Ph=float(request.form['ph']) | ||
Rainfall=float(request.form['Rainfall']) | ||
|
||
values=[Nitrogen,Phosphorus,Potassium,Temperature,Humidity,Ph,Rainfall] | ||
|
||
if Ph>0 and Ph<=14 and Temperature<100 and Humidity>0: | ||
joblib.load('crop_appp','r') | ||
model = joblib.load(open('crop_appp','rb')) | ||
arr = [values] | ||
acc = model.predict(arr) | ||
# print(acc) | ||
return render_template('prediction.html', prediction=str(acc)) | ||
else: | ||
return "Sorry... Error in entered values in the form Please check the values and fill it again" | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
app.run(debug=True) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+145 KB
Crop-Recommendation-System/crop_app/static/style/Screenshot 2023-01-25 210741.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 73 additions & 0 deletions
73
Crop-Recommendation-System/crop_app/static/style/first.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
body { | ||
background-image: url(prediction_back.jpg); | ||
background-size: cover; | ||
background-repeat: no-repeat; | ||
background-position: center; | ||
margin: 0; | ||
font-family: 'Arial', sans-serif; | ||
} | ||
|
||
form { | ||
width: 80%; | ||
max-width: 500px; | ||
margin: 20px auto; | ||
text-align: center; | ||
padding: 30px; | ||
background-color: rgba(255, 255, 255, 0.9); | ||
border-radius: 15px; | ||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
input[type="text"] { | ||
width: calc(100% - 20px); | ||
padding: 12px; | ||
margin-top: 15px; | ||
border-radius: 8px; | ||
border: 2px solid #ddd; | ||
box-sizing: border-box; | ||
transition: border-color 0.3s ease; | ||
} | ||
|
||
input[type="text"]:focus { | ||
border-color: #4CAF50; /* Highlight border on focus */ | ||
} | ||
|
||
input[type="submit"] { | ||
width: 100%; | ||
padding: 12px; | ||
margin-top: 20px; | ||
border-radius: 8px; | ||
border: none; | ||
background-color: #4CAF50; | ||
color: white; | ||
cursor: pointer; | ||
transition: background-color 0.3s ease; | ||
} | ||
|
||
input[type="submit"]:hover { | ||
background-color: #45a049; | ||
} | ||
|
||
label { | ||
font-size: 18px; | ||
margin-top: 25px; | ||
display: block; | ||
} | ||
|
||
/* Responsive Design */ | ||
@media screen and (max-width: 768px) { | ||
form { | ||
padding: 20px; | ||
} | ||
|
||
input[type="text"] { | ||
width: 100%; | ||
} | ||
} | ||
|
||
@media screen and (max-width: 480px) { | ||
form { | ||
width: 90%; | ||
max-width: 100%; | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 112 additions & 0 deletions
112
Crop-Recommendation-System/crop_app/static/style/myhomee.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* Reset some default styles */ | ||
body, h1, h2, h3, p, ul, li { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
/* Global styles */ | ||
body { | ||
font-family: 'Arial', sans-serif; | ||
background-color: #f5f5f5; | ||
color: #333; | ||
} | ||
|
||
/* Header styles */ | ||
header { | ||
background-color: #4CAF50; | ||
color: white; | ||
text-align: center; | ||
padding: 1em 0; | ||
} | ||
|
||
nav { | ||
background-color: #4CAF50; | ||
padding: 10px 0; | ||
} | ||
|
||
nav ul { | ||
list-style: none; | ||
margin: 0; | ||
padding: 0; | ||
text-align: center; | ||
} | ||
|
||
nav ul li { | ||
display: inline-block; | ||
margin-right: 20px; | ||
} | ||
|
||
nav a { | ||
text-decoration: none; | ||
color: #fff; | ||
font-size: 16px; | ||
font-weight: bold; | ||
padding: 10px 15px; | ||
border-radius: 5px; | ||
transition: color 0.3s, background-color 0.3s; | ||
} | ||
|
||
nav a:hover { | ||
color: #333; | ||
background-color: #fff; | ||
} | ||
|
||
main { | ||
text-align: center; | ||
padding: 50px; | ||
} | ||
|
||
h1 { | ||
color: #4CAF50; | ||
font-size: 36px; | ||
margin-bottom: 20px; | ||
} | ||
|
||
h2, h3 { | ||
color: #333; | ||
} | ||
|
||
p { | ||
color: #555; | ||
font-size: 18px; | ||
line-height: 1.6; | ||
} | ||
|
||
/* Add a subtle shadow to h1 for a nice effect */ | ||
h1 { | ||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2); | ||
} | ||
|
||
/* Button styles */ | ||
form { | ||
text-align: center; | ||
} | ||
|
||
/* Base styles for the submit button */ | ||
input[type="submit"] { | ||
background-color: #4CAF50; | ||
color: white; | ||
padding: 10px 20px; | ||
font-size: 16px; | ||
border: none; | ||
font-style: bold; | ||
font-weight: 300; | ||
border-radius: 5px; /* Add rounded corners */ | ||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Add a subtle box shadow for depth */ | ||
cursor: pointer; | ||
transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s; | ||
} | ||
|
||
/* Hover effect for the submit button */ | ||
input[type="submit"]:hover { | ||
background-color: #0d8f13; | ||
transform: scale(1.05); /* Slightly reduce the scaling on hover for a more subtle effect */ | ||
box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2); /* Increase the box shadow on hover for a lifted appearance */ | ||
} | ||
|
||
/* Focus effect for better accessibility */ | ||
input[type="submit"]:focus { | ||
outline: none; /* Remove default focus outline */ | ||
box-shadow: 0 0 0 3px rgba(75, 204, 50, 0.4); /* Add a green border on focus */ | ||
} | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions
52
Crop-Recommendation-System/crop_app/static/style/prdiction_css.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* body { | ||
font-family: Arial, sans-serif; | ||
background-image: url('image.jpg'); | ||
background-size: cover; | ||
margin: 0; | ||
padding: 0; | ||
} */ | ||
/* prediction_css.css */ | ||
|
||
body { | ||
background-image: url('image.jpg'); | ||
background-size: cover; | ||
height: 100vh; | ||
margin: 0; | ||
|
||
align-items: center; | ||
justify-content: center; | ||
font-size: 36px; | ||
color: white; | ||
font-family: 'Arial', sans-serif; | ||
text-shadow: 2px 2px 4px #333; /* Enhance text shadow for better visibility */ | ||
} | ||
|
||
/* Optional: Add a semi-transparent overlay to improve text readability on the background */ | ||
body::before { | ||
content: ''; | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background: rgba(0, 0, 0, 0.5); /* Adjust the opacity as needed */ | ||
z-index: -1; /* Place the overlay behind the text */ | ||
} | ||
|
||
h5 { | ||
|
||
margin-top: 100px; | ||
color: #f5f8f6; /* Set the desired text color */ | ||
text-align: center; | ||
text-shadow: 1px 1px 2px #333; /* Enhance text shadow for better visibility */ | ||
} | ||
|
||
.prediction { | ||
text-align: center; | ||
margin-top: 10px; /* Adjust the margin as needed */ | ||
} | ||
|
||
.prediction h4 { | ||
font-size: 24px; /* Set the desired font size for the prediction text */ | ||
color: #78fdb0; /* Set the desired text color */ | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Mani AgroTech</title> | ||
<link rel="stylesheet" href="{{url_for('static',filename='style/myhomee.css')}}"> | ||
</head> | ||
|
||
<body> | ||
<header> | ||
<nav> | ||
<ul> | ||
<li><a href="#">Home</a></li> | ||
<li><a href="#">About</a></li> | ||
<li><a href="#">Services</a></li> | ||
<li><a href="#">Contact</a></li> | ||
</ul> | ||
</nav> | ||
</header> | ||
<main> | ||
<h1>Mani AgroTech</h1> | ||
<p style="color: black;">Mani AgroTech Welcomes you on our website, Hope you are earning well from your farm | ||
but we are here for you to provide some suggetions about your crop cultivation | ||
We recommends you to which crop you should grow in your farm for better yields. Its | ||
very easy to predict which crop you should grow on the basis of your soil nutrients | ||
just you need to know your soil nutrients for this you can test your soil in lab.</p> | ||
<br> | ||
<h3 style="color: black;">Let's Start New Journey With Mani AgroTech</h3> | ||
<br> | ||
<h2 style="color: black;">Click following button for Crop recommandation</h2> | ||
</main> | ||
<form action="/Predict"> | ||
<input type="submit" id="Predict" name="Predict" action="/Predict" value="Predict"> | ||
</form> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Patil Agrotech</title> | ||
<link rel="stylesheet" href="{{url_for('static',filename='style/first.css')}}"> | ||
</head> | ||
<body> | ||
<form action="form" method="post"> | ||
<label for="Nitrogen">Nirogen:</label> | ||
<input type="text" id="Nirogen" name="Nitrogen" min="0" max="100" placeholder="Nitrogen" required> | ||
|
||
<label for="Phosphorus">Phosphorus:</label> | ||
<input type="text" id="Phosphorus" name="Phosphorus" min="0" max="100" placeholder="Phosphorus" required> | ||
|
||
<label for="Potassium">Potassium:</label> | ||
<input type="text" id="Potassium" name="Potassium" min="0" max="100" placeholder="Potassium" required> | ||
|
||
<label for="Temperature">Temperature:</label> | ||
<input type="text" id="Temperature" name="Temperature" min="0" max="100" placeholder="Temperature in Degree Celcius" required> | ||
|
||
<label for="Humidity">Humidity:</label> | ||
<input type="text" id="Humidity" name="Humidity" min="0" max="100" placeholder="Relative Humidity in Percentage" required> | ||
|
||
<label for="ph">ph:</label> | ||
<input type="text" id="ph" name="ph" min="0" max="14" placeholder="ph should be in between 0-14" required> | ||
|
||
<label for="Rainfall">Rainfall:</label> | ||
<input type="text" id="Rainfall" name="Rainfall" placeholder="Rainfall in MM" required min="0" max="10000"> | ||
|
||
<input type="submit" id="submit" name="submit" value="Predict Your Crop"> | ||
</form> | ||
|
||
</body> | ||
</html> | ||
|
Oops, something went wrong.