Sadashiv commited on
Commit
21c2ea0
1 Parent(s): 032a78f

html files uploaded

Browse files
.gitignore CHANGED
@@ -1 +1,163 @@
1
- main.py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ #.idea/
161
+
162
+ main.py
163
+ extra_notebook
.gitmodules ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [submodule "Fertilizer-Recommendation"]
2
+ path = Fertilizer-Recommendation
3
+ url = https://github.com/07Sada/Fertilizer-Recommendation.git
.vscode/settings.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "workbench.colorTheme": "Default Dark+",
3
  "workbench.preferredDarkColorTheme": "Default Dark+",
4
  "task.allowAutomaticTasks": "on",
5
  "workbench.editorAssociations": {
 
1
  {
2
+ "workbench.colorTheme": "Cobalt2",
3
  "workbench.preferredDarkColorTheme": "Default Dark+",
4
  "task.allowAutomaticTasks": "on",
5
  "workbench.editorAssociations": {
Fertilizer-Recommendation ADDED
@@ -0,0 +1 @@
 
 
1
+ Subproject commit 8503e9c445eb912582ac34d105a2adca8d1932d9
app.py CHANGED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, request, render_template, jsonify
2
+ import requests
3
+
4
+ app = Flask(__name__)
5
+
6
+ @app.route("/")
7
+ @app.route("/home")
8
+ def home():
9
+ return render_template('index.html')
10
+
11
+ @app.route('/crop_recommendation')
12
+ def crop_recommendation():
13
+ return render_template('crop_recommendation_input.html')
14
+
15
+ @app.route('/fertilizer_recommendation')
16
+ def fertilizer_recommendation():
17
+ return render_template('fertilizer_recommendation_input.html')
18
+
19
+ @app.route('/image_classification')
20
+ def image_classification():
21
+ return render_template('image_classification_input.html')
22
+
23
+ @app.route('/market_price')
24
+ def market_price():
25
+ return render_template("market_price_input.html")
26
+
27
+ @app.route('/market_price_output', methods=['POST'])
28
+ def market_price_output():
29
+ # input field name is 'selected_state'
30
+ user_input = request.form.get('selected_state')
31
+ api_key = "579b464db66ec23bdd000001cdd3946e44ce4aad7209ff7b23ac571b"
32
+
33
+ # Make a request to the API with the user input
34
+ api_url = f'https://api.data.gov.in/resource/9ef84268-d588-465a-a308-a864a43d0070?api-key={api_key}&format=json&filters%5Bstate%5D={user_input}'
35
+ response = requests.get(api_url)
36
+
37
+ if response.status_code == 200:
38
+ data = response.json()
39
+ data = data['records']
40
+ # Return the JSON data as a response
41
+ return render_template('market_price_output.html', data=data)
42
+ else:
43
+ return jsonify({'error': 'Unable to fetch data from the API'}), 400
44
+
45
+ if __name__ == "__main__":
46
+ app.run(debug=True, host="0.0.0.0", port=8000)
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
  pymongo
2
  flask
3
  requests
4
- numpy
 
1
  pymongo
2
  flask
3
  requests
4
+ numpy
static/images/crop-recommendation-logo.png ADDED
static/images/farmer_01.jpg ADDED
static/images/farmer_02.jpg ADDED
static/images/farmer_03.jpg ADDED
static/images/farmer_04.jpg ADDED
static/images/farmer_05.jpg ADDED
static/images/fertilizer-logo.png ADDED
static/images/github-logo.png ADDED
static/images/image-classification-logo.png ADDED
static/images/india_location.png ADDED
static/images/linkedin-icon.png ADDED
static/images/logo.png ADDED
static/images/market-price-logo.png ADDED
static/images/wave1.png ADDED
static/images/wave1_mod.png ADDED
static/images/wave2.png ADDED
static/style.css ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body {
2
+
3
+ padding: 0;
4
+ margin: 0;
5
+ }
6
+
7
+ /*------------navigation bar ----------------*/
8
+ #nav-bar {
9
+ position: sticky;
10
+ top: 0;
11
+ z-index: 10;
12
+ }
13
+
14
+ .navbar {
15
+ background-image: linear-gradient(to right, #75ee71c7, #eceb84);
16
+ padding: 0 !important;
17
+ }
18
+
19
+ .navbar-nav li {
20
+ padding: 0 10px;
21
+ }
22
+
23
+ .navbar-nav li a {
24
+ font-weight: 600;
25
+ }
26
+
27
+
28
+ /*-----------------banner section----------*/
29
+ #banner {
30
+ background-image: linear-gradient(to right, #75ee71c7, #eceb84);
31
+ padding-top: 5%;
32
+ }
33
+
34
+ .promo-title {
35
+ font-size: 40px;
36
+ font-weight: 600;
37
+ margin-top: 100px;
38
+ }
39
+
40
+ .img-fluid {
41
+ border-radius: 12px;
42
+ }
43
+
44
+ .bottom-img {
45
+ width: 100%;
46
+ }
47
+
48
+ /*-----------------Services section----------*/
49
+ #services {
50
+ padding: 80px 0;
51
+ }
52
+
53
+ .service-img {
54
+ width: 100px;
55
+ margin-top: 20px;
56
+ }
57
+
58
+ .service-name {
59
+ text-align: center;
60
+ /*Center horizontally*/
61
+ }
62
+
63
+ .services {
64
+ padding: 20px;
65
+ }
66
+
67
+ .title::before {
68
+ content: "";
69
+ background: hsl(128, 84%, 66%);
70
+ height: 5px;
71
+ width: 200px;
72
+ margin-left: auto;
73
+ margin-right: auto;
74
+ display: block;
75
+ transform: translateY(63px);
76
+ }
77
+
78
+ .title::after {
79
+ content: "";
80
+ background: hsl(128, 84%, 66%);
81
+ height: 10px;
82
+ width: 50px;
83
+ margin-left: auto;
84
+ margin-right: auto;
85
+ margin-bottom: 40px;
86
+ display: block;
87
+ transform: translateY(8px);
88
+ }
89
+
90
+ /*-----------------Services section----------*/
91
+
92
+ #about-us {
93
+ padding-bottom: 50px;
94
+ padding-top: 50px;
95
+ }
96
+
97
+ #about-us ul li {
98
+ margin: 10px 0;
99
+ }
100
+
101
+ /*-----------------quotes-------------------*/
102
+ #quotes {
103
+ margin: 100px 0;
104
+ }
105
+
106
+ .quotes {
107
+ border-left: 4px solid #f1f397e3;
108
+ margin-top: 50px;
109
+ margin-bottom: 50px;
110
+ }
111
+
112
+ .quotes img {
113
+ height: 60px;
114
+ width: 60px;
115
+ border-radius: 50%;
116
+ margin: 0 10px;
117
+ }
118
+
119
+ .user-details {
120
+ display: inline-block;
121
+ font-size: 12px;
122
+ }
123
+
124
+ /*-----------------Social Media Section-------*/
125
+ #social-media {
126
+ /* background-color: #D9F8C4; */
127
+ padding: 100px 0;
128
+ }
129
+
130
+ #social-media p {
131
+ font-size: 36px;
132
+ font-weight: 600;
133
+ margin-bottom: 30px;
134
+ }
135
+
136
+ .social-icons img {
137
+ width: 120px;
138
+ transition: 0.5s;
139
+ padding: 20px;
140
+ }
141
+
142
+ .social-icons a:hover img {
143
+ transform: translateY(-10px);
144
+ }
145
+
146
+ /*---------Footer Section -------------------*/
147
+
148
+ #footer {
149
+ background-image: linear-gradient(to right, #75ee71c7, #eceb84);
150
+ color: rgb(106, 110, 110)
151
+ }
152
+
153
+ #footer img {
154
+ width: 100%;
155
+ }
156
+
157
+ .footer-box {
158
+ padding: 20px;
159
+ }
160
+
161
+ #footer .footer-box img {
162
+ width: 30%;
163
+ margin-bottom: 20px;
164
+ border-radius: 5%;
165
+ }
166
+
167
+ #footer .footer-box .addition-info {
168
+ display: inline-block;
169
+ font-size: 20px;
170
+ }
171
+
172
+ /*-----------recommendation input -----*/
173
+ .recommendation-input-container {
174
+ max-width: 800px;
175
+ /* Set the maximum width of the container */
176
+ margin: 60px auto 0;
177
+ /* Center the container horizontally and add 60px top margin */
178
+ display: flex;
179
+ align-items: center;
180
+ background-color: white;
181
+ padding: 20px;
182
+ border-radius: 15px;
183
+ /* Add 15px border-radius to all corners */
184
+ }
185
+
186
+ /*-----------image classification -----*/
187
+ .image_input {
188
+ width: 50%;
189
+ position: absolute;
190
+ top: 50%;
191
+ left: 50%;
192
+ transform: translate(-50%, -50%);
193
+ background-color: white;
194
+ padding: 30px;
195
+ border-radius: 20px;
196
+ }
197
+
198
+ /*-----------Market Input -----------*/
199
+ .market_input {
200
+ width: 40%;
201
+ position: absolute;
202
+ top: 50%;
203
+ left: 50%;
204
+ transform: translate(-50%, -50%);
205
+ background-color: white;
206
+ padding: 15px;
207
+ border-radius: 20px;
208
+ }
209
+
210
+
211
+ /*-------Crop Recommendation Output---*/
212
+ .crop-image {
213
+ background-color: white;
214
+ padding: 30px;
215
+ border-radius: 20px;
216
+ }
217
+ .crop-image img {
218
+ border-radius: 20px;
219
+ width: 100%;
220
+ }
221
+ .crop-image .text h1 {
222
+ font-size: 35px;
223
+ margin-bottom: 20px;
224
+ }
225
+
226
+ .crop-image .text p {
227
+ font-size: 18px;
228
+ }
229
+
230
+ .crop-image a{
231
+ margin-top: 20px;
232
+ }
233
+ .crop-image h2{
234
+ margin-bottom: 30px;
235
+ }
236
+
237
+
238
+ /*-------Image Classification output page---*/
239
+ .plant-image {
240
+ background-color: white;
241
+ padding: 30px;
242
+ border-radius: 20px;
243
+ width: 60%;
244
+ }
245
+ .plant-image img {
246
+ border-radius: 20px;
247
+ width: 70%;
248
+ margin: 0 auto;
249
+ display: block;
250
+ }
251
+
252
+ .plant-image a{
253
+ margin-top: 20px;
254
+
255
+ }
256
+ .plant-image h2{
257
+ margin-bottom: 30px;
258
+ }
259
+
260
+
261
+ /*-------market price output message---*/
262
+ .market_price_message{
263
+ background-color: white;
264
+ padding: 20px;
265
+ border-radius: 15px;
266
+ width: 70%;
267
+ margin-top: 5%;
268
+ }
269
+
270
+ .market_price_message a{
271
+ margin-top: 10px;
272
+ }
static/uploaded_image/plant_image.JPG ADDED
templates/base.html ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>CropGaurd</title>
7
+ <link
8
+ href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/css/bootstrap.min.css"
9
+ rel="stylesheet"
10
+ />
11
+ <link rel="stylesheet" href="/static/style.css" />
12
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"></script>
13
+ </head>
14
+ <body>
15
+ {% block body %} {% endblock %}
16
+ </body>
17
+ </html>
templates/crop_recommendation_input.html ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %} {% block body %} {% include "nav_bar.html" %}
2
+ <style>
3
+ /* Custom CSS to modify container size and background */
4
+ body {
5
+ background-image: linear-gradient(to right, #75ee71c7, #eceb84);
6
+ }
7
+ </style>
8
+ <div
9
+ class="container recommendation-input-container d-flex justify-content-center"
10
+ >
11
+ <form class="row g-3" method="GET" action="/crop_recommendation_output">
12
+ <h3 class="text-center">AI-Powered Crop Recommendations</h3>
13
+ <div class="col-md-4" name="temperature">
14
+ <label for="temperature" class="form-label">Temperature</label>
15
+ <input
16
+ type="number"
17
+ class="form-control"
18
+ id="temperature"
19
+ placeholder="Enter the temperature Value"
20
+ name="temperature"
21
+ required
22
+ />
23
+ </div>
24
+ <div class="col-md-4" name="humidity">
25
+ <label for="humidity" class="form-label">Humidity</label>
26
+ <input
27
+ type="number"
28
+ class="form-control"
29
+ id="humidity"
30
+ placeholder="Enter the Humidity Value"
31
+ name="humidity"
32
+ required
33
+ />
34
+ </div>
35
+ <div class="col-md-4" name="ph">
36
+ <label for="ph" class="form-label">ph value</label>
37
+ <input
38
+ type="number"
39
+ class="form-control"
40
+ id="ph"
41
+ placeholder="Enter the ph value Value"
42
+ name="ph"
43
+ required
44
+ />
45
+ </div>
46
+ <div class="col-md-4" name="nitrogen">
47
+ <label for="nitrogen" class="form-label">Nitrogen</label>
48
+ <input
49
+ type="number"
50
+ class="form-control"
51
+ id="nitrogen"
52
+ placeholder="Enter the Nitrogen Value"
53
+ name="nitrogen"
54
+ required
55
+ />
56
+ </div>
57
+ <div class="col-md-4" name="potassium">
58
+ <label for="potassium" class="form-label">Potassium</label>
59
+ <input
60
+ type="number"
61
+ class="form-control"
62
+ id="potassium"
63
+ placeholder="Enter the Potassium Value"
64
+ name="potassium"
65
+ required
66
+ />
67
+ </div>
68
+ <div class="col-md-4" name="phosphorous">
69
+ <label for="phosphorous" class="form-label">Phosphorous</label>
70
+ <input
71
+ type="number"
72
+ class="form-control"
73
+ id="phosphorous"
74
+ placeholder="Enter the Phosphorous Value"
75
+ name="phosphorous"
76
+ required
77
+ />
78
+ </div>
79
+ <div class="col-md-4" name="rain_fall">
80
+ <label for="rain_fall" class="form-label">Rain Fall</label>
81
+ <input
82
+ type="number"
83
+ class="form-control"
84
+ id="rain_fall"
85
+ placeholder="Enter the Rain Fall in mm"
86
+ name="rain_fall"
87
+ required
88
+ />
89
+ </div>
90
+ <div class="d-grid gap-50 d-md-block">
91
+ <button type="submit" class="btn btn-primary">Submit</button>
92
+ <button type="reset" class="btn btn-primary">Clear</button>
93
+ </div>
94
+ </form>
95
+ </div>
96
+ {% endblock %}
templates/crop_recommendation_output.html ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %} {% block body %} {% include "nav_bar.html" %}
2
+ <style>
3
+ /* Custom CSS background color*/
4
+ body {
5
+ background-image: linear-gradient(to right, #75ee71c7, #eceb84);
6
+ }
7
+ </style>
8
+
9
+ <div
10
+ class="d-flex justify-content-center align-items-center"
11
+ style="min-height: 100vh"
12
+ >
13
+ <div class="container crop-image">
14
+ <div class="row">
15
+ <h2 class="text-center">Crop Recommendation</h2>
16
+ <div class="col-md-6">
17
+ <img
18
+ src="data:image/jpeg;base64,{{ image_data_base64 }}"
19
+ alt="Image"
20
+
21
+ />
22
+ </div>
23
+ <div
24
+ class="col-md-6 text d-flex flex-column justify-content-center align-items-center"
25
+ >
26
+ <h1 class="text-center">{{input_file_name.capitalize()}}</h1>
27
+ <p class="text-center">{{crop_details}}</p>
28
+ </div>
29
+ </div>
30
+ <a href="{{url_for('crop_recommendation')}}" class="btn btn-primary" role="button"
31
+ >Check with Different Values</a
32
+ >
33
+ </div>
34
+ </div>
35
+ </div>
36
+ <div>
37
+
38
+ {% endblock %}
templates/fertilizer_recommendation_input.html ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %} {% block body %} {% include "nav_bar.html" %}
2
+ <style>
3
+ /* Custom CSS to modify container size and background */
4
+ body {
5
+ background-image: linear-gradient(to right, #75ee71c7, #eceb84);
6
+ }
7
+ </style>
8
+ <div
9
+ class="container-fluid recommendation-input-container d-flex justify-content-center"
10
+ >
11
+ <form class="row g-3" method="GET" action="/fertilizer_recommendation_output">
12
+ <h3 class="text-center">AI-Powered Fertilizer Recommendations</h3>
13
+ <div class="col-md-4" name="temperature">
14
+ <label for="temperature" class="form-label">Temperature</label>
15
+ <input
16
+ type="number"
17
+ class="form-control"
18
+ id="temperature"
19
+ name="temperature"
20
+ placeholder="Enter the temperature Value"
21
+ />
22
+ </div>
23
+ <div class="col-md-4" name="humidity">
24
+ <label for="humidity" class="form-label">Humidity</label>
25
+ <input
26
+ type="number"
27
+ class="form-control"
28
+ id="humidity"
29
+ name="humidity"
30
+ placeholder="Enter the Humidity Value"
31
+ />
32
+ </div>
33
+ <div class="col-md-4" name="moisture">
34
+ <label for="moisture" class="form-label">Moisture</label>
35
+ <input
36
+ type="number"
37
+ class="form-control"
38
+ id="moisture"
39
+ name="moisture"
40
+ placeholder="Enter the Moisture Value"
41
+ />
42
+ </div>
43
+ <div class="col-md-4" name="nitrogen">
44
+ <label for="nitrogen" class="form-label">Nitrogen</label>
45
+ <input
46
+ type="number"
47
+ class="form-control"
48
+ id="nitrogen"
49
+ name="nitrogen"
50
+ placeholder="Enter the Nitrogen Value"
51
+ />
52
+ </div>
53
+ <div class="col-md-4" name="potassium">
54
+ <label for="potassium" class="form-label">Potassium</label>
55
+ <input
56
+ type="number"
57
+ class="form-control"
58
+ id="potassium"
59
+ name="potassium"
60
+ placeholder="Enter the Potassium Value"
61
+ />
62
+ </div>
63
+ <div class="col-md-4" name="phosphorous">
64
+ <label for="phosphorous" class="form-label">Phosphorous</label>
65
+ <input
66
+ type="number"
67
+ class="form-control"
68
+ id="phosphorous"
69
+ name="phosphorous"
70
+ placeholder="Enter the Phosphorous Value"
71
+ />
72
+ </div>
73
+ <div class="col-md-6" name="soil_type">
74
+ <label for="soil_type" class="form-label">Soil Type</label>
75
+ <select id="soil_type" class="form-select" name="soil_type">
76
+ <option selected>Select the Soil Type from the dropdown</option>
77
+ <option value="Sandy">Sandy</option>
78
+ <option value="Loamy">Loamy</option>
79
+ <option value="Black">Black</option>
80
+ <option value="Red">Red</option>
81
+ <option value="Clayey">Clayey</option>
82
+ </select>
83
+ </div>
84
+ <div class="col-md-6" name="crop_type">
85
+ <label for="crop_type" class="form-label">Crop Type</label>
86
+ <select id="crop_type" class="form-select" name="crop_type">
87
+ <option selected>Select the Crop Type from the dropdown</option>
88
+ <option value="Maize">Maize</option>
89
+ <option value="Sugarcane">Sugarcane</option>
90
+ <option value="Cotton">Cotton</option>
91
+ <option value="Tobacco">Tobacco</option>
92
+ <option value="Paddy">Paddy</option>
93
+ <option value="Barley">Barley</option>
94
+ <option value="Wheat">Wheat</option>
95
+ <option value="Millets">Millets</option>
96
+ <option value="Oil seeds">Oil seeds</option>
97
+ <option value="Pulses">Pulses</option>
98
+ <option value="Ground Nuts">Ground Nuts</option>
99
+ </select>
100
+ </div>
101
+ <div class="d-grid gap-50 d-md-block">
102
+ <button type="submit" class="btn btn-primary">Submit</button>
103
+ <button type="reset" class="btn btn-primary">Clear</button>
104
+ </div>
105
+ </form>
106
+ </div>
107
+
108
+ {% endblock %}
templates/fertilizer_recommendation_ouput.html ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %} {% block body %} {% include "nav_bar.html" %}
2
+ <style>
3
+ /* Custom CSS background color*/
4
+ body {
5
+ background-image: linear-gradient(to right, #75ee71c7, #eceb84);
6
+ }
7
+ </style>
8
+ <div
9
+ class="d-flex justify-content-center align-items-center"
10
+ style="min-height: 100vh"
11
+ >
12
+ <div class="container crop-image">
13
+ <div class="row">
14
+ <h2 class="text-center">Fertilizer Recommendation</h2>
15
+ <div class="col-md-6">
16
+ <img
17
+ src="data:image/jpeg;base64,{{ image_data_base64 }}"
18
+ alt="Image"
19
+
20
+ />
21
+ </div>
22
+ <div
23
+ class="col-md-6 text d-flex flex-column justify-content-center align-items-center"
24
+ >
25
+ <h1 class="text-center">{{input_file_name.upper()}}</h1>
26
+ <p class="text-center">{{crop_details}}</p>
27
+ </div>
28
+ </div>
29
+ <a href="{{url_for('fertilizer_recommendation')}}" class="btn btn-primary" role="button"
30
+ >Check with Different Values</a
31
+ >
32
+ </div>
33
+ </div>
34
+ </div>
35
+ <div>
36
+
37
+ {% endblock %}
templates/image_classification_input.html ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %} {% block body %} {% include "nav_bar.html" %}
2
+ <style>
3
+ /* Custom CSS to modify container size and background */
4
+ body {
5
+ background-image: linear-gradient(to right, #75ee71c7, #eceb84);
6
+ }
7
+ </style>
8
+
9
+ <div class="container image_input">
10
+ <div class="input">
11
+ <form
12
+ method="POST"
13
+ action="/image_classification_output"
14
+ enctype="multipart/form-data"
15
+ class="upload_space"
16
+ >
17
+ <h4>Please upload the image</h4>
18
+ <div class="input-group mb-3">
19
+ <input
20
+ type="file"
21
+ name="image_file"
22
+ class="form-control"
23
+ id="inputGroupFile02"
24
+ />
25
+ </div>
26
+ <div class="d-grid gap-50 d-md-block">
27
+ <button type="submit" class="btn btn-primary">Submit</button>
28
+ <button type="reset" class="btn btn-primary">Clear</button>
29
+ </div>
30
+ </form>
31
+ </div>
32
+ </div>
33
+ {% endblock %}
templates/image_classification_output.html ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %} {% block body %} {% include "nav_bar.html" %}
2
+ <style>
3
+ /* Custom CSS background color*/
4
+ body {
5
+ background-image: linear-gradient(to right, #75ee71c7, #eceb84);
6
+ }
7
+
8
+
9
+ </style>
10
+ <div
11
+ class="d-flex justify-content-center align-items-center"
12
+ style="min-height: 100vh"
13
+ >
14
+ <div class="container plant-image">
15
+ <div class="row">
16
+ <h2 class="text-center">Image Classification</h2>
17
+ <div class="col-md-6">
18
+ <img
19
+ src="/static/uploaded_image/plant_image.JPG"
20
+ alt="Image"
21
+
22
+ />
23
+ </div>
24
+ <div
25
+ class="col-md-6 text d-flex flex-column justify-content-center align-items-center"
26
+ >
27
+ <h4 class="text-center">{{model_prediction}}</h4>
28
+ <p class="text-center">{{diseases_details}}</p>
29
+ </div>
30
+ </div>
31
+ <a href="{{url_for('image_classification')}}" class="btn btn-primary" role="button"
32
+ >Check with different image</a
33
+ >
34
+ </div>
35
+ </div>
36
+ </div>
37
+ <div>
38
+ {%endblock %}
templates/index.html ADDED
@@ -0,0 +1,329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %} {% block body %} {% include "nav_bar.html" %}
2
+ <!----------banner Section------------------>
3
+ <section id="banner">
4
+ <div class="container">
5
+ <div class="row">
6
+ <div class="col-md-6">
7
+ <p class="promo-title">Empowering Farmers With Data Driven Decisions</p>
8
+ </div>
9
+ <div class="col-md-6 text-center">
10
+ <img src="/static/images/farmer_01.jpg" class="img-fluid" alt="" />
11
+ </div>
12
+ </div>
13
+ </div>
14
+ <img src="/static/images/wave1.png" class="bottom-img" alt="" />
15
+ </section>
16
+ <!----------Services Section---------------->
17
+ <section id="services">
18
+ <div class="container text-center">
19
+ <h1 class="title">What We Do ?</h1>
20
+ <div class="row text-center">
21
+ <div class="col-md-3 services">
22
+ <img
23
+ src="/static/images/crop-recommendation-logo.png"
24
+ class="service-img"
25
+ alt=""
26
+ />
27
+ <h4 class="service-name">Crop<br />Recommendation</h4>
28
+ </div>
29
+ <div class="col-md-3 services">
30
+ <img
31
+ src="/static//images/fertilizer-logo.png"
32
+ class="service-img"
33
+ alt=""
34
+ />
35
+ <h4 class="service-name">Fertilizer<br />Recommendation</h4>
36
+ </div>
37
+ <div class="col-md-3 services">
38
+ <img
39
+ src="/static/images/image-classification-logo.png"
40
+ class="service-img"
41
+ alt=""
42
+ />
43
+ <h4 class="service-name">Dieases<br />Classification</h4>
44
+ </div>
45
+ <div class="col-md-3 services">
46
+ <img
47
+ src="/static/images/market-price-logo.png"
48
+ class="service-img"
49
+ alt=""
50
+ />
51
+ <h4 class="service-name">Market<br />Price</h4>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </section>
56
+ <!----------About Us------------------------>
57
+ <section id="about-us">
58
+ <div class="container">
59
+ <h1 class="title text-center">Why We Do It.</h1>
60
+ <div class="row">
61
+ <div class="col-md-6 about-us">
62
+ <ul>
63
+ <li>
64
+ The purpose of our website is to assist farmers in making better
65
+ decisions for their crops.
66
+ </li>
67
+ <li>
68
+ Every soil has unique fertilizer requirements and suits specific
69
+ crops, making <b>personalized recommendations</b> essential.
70
+ </li>
71
+ <li>
72
+ By <b>harnessing the power of technology</b>, we aim to bridge the
73
+ gap between agricultural practices and data-driven insights.
74
+ </li>
75
+ <li>
76
+ We aim to provide a comprehensive one-stop solution to cater to all
77
+ the needs of farmers.
78
+ </li>
79
+ </ul>
80
+ </div>
81
+ <div class="col-md-6">
82
+ <img src="/static/images/farmer_02.jpg" class="img-fluid" alt="" />
83
+ </div>
84
+ </div>
85
+ </div>
86
+ </section>
87
+ <!----------How We Do It-------------------->
88
+ <section id="about-us">
89
+ <div class="container">
90
+ <h1 class="title text-center">How We Do It.</h1>
91
+ <div class="row">
92
+ <div class="col-md-6 about-us">
93
+ <ul>
94
+ <li>
95
+ Our website integrates cutting-edge machine learning and deep
96
+ learning algorithms to facilitate informed decision-making.
97
+ </li>
98
+ <li>
99
+ These algorithms are trained on vast and diverse datasets, ensuring
100
+ accurate and reliable recommendations.
101
+ </li>
102
+ <li>
103
+ We leverage the power of data-driven insights to deliver valuable
104
+ suggestions to farmers.
105
+ </li>
106
+ </ul>
107
+ </div>
108
+ <div class="col-md-6">
109
+ <img src="/static/images/farmer_03.jpg" class="img-fluid" alt="" />
110
+ </div>
111
+ </div>
112
+ </div>
113
+ </section>
114
+ <!----------What We Do ?-------------------->
115
+ <section id="about-us">
116
+ <div class="container">
117
+ <h1 class="title text-center">What We Do ?</h1>
118
+ <div class="row">
119
+ <div class="col-md-6 about-us">
120
+ <ul>
121
+ <li>
122
+ Our website is a <b> farmer-centric platform </b>that offers a range
123
+ of services based on user inputs.
124
+ </li>
125
+ <li>
126
+ <b>Crop Recommendation:</b> Using soil analysis and other relevant
127
+ factors, we suggest the most suitable crops for a specific plot of
128
+ land.
129
+ </li>
130
+ <li>
131
+ <b>Fertilizer Recommendation:</b> We provide tailored fertilizer
132
+ suggestions based on the soil's unique needs and crop choice.
133
+ </li>
134
+ <li>
135
+ <b>Plant Health Assessment:</b> Our computer vision technology
136
+ analyzes leaf images to determine the plant's health status and
137
+ identify potential diseases.
138
+ </li>
139
+ <li>
140
+ <b>Market Price Information:</b> Farmers can access current market
141
+ prices for their crops using data fetched from the Indian
142
+ government's API.
143
+ </li>
144
+ </ul>
145
+ </div>
146
+ <div class="col-md-6">
147
+ <img src="/static/images/farmer_04.jpg" class="img-fluid" alt="" />
148
+ </div>
149
+ </div>
150
+ </div>
151
+ </section>
152
+ <!----------How It Benefits Farmers ?------->
153
+ <section id="about-us">
154
+ <div class="container">
155
+ <h1 class="title text-center">How It Benefits Farmers ?</h1>
156
+ <div class="row">
157
+ <div class="col-md-6 about-us">
158
+ <ul>
159
+ <li>
160
+ <b>Empowering Decision Making:</b> By receiving personalized
161
+ recommendations, farmers can make informed choices for their crops
162
+ and fertilizers.
163
+ </li>
164
+ <li>
165
+ <b>Crop Yield:</b> Tailored suggestions lead to optimal crop choices
166
+ and better fertilizer usage, resulting in increased yields.
167
+ </li>
168
+ <li>
169
+ <b>Early Disease Detection:</b> Our plant health assessment helps
170
+ detect diseases at an early stage, allowing farmers to take timely
171
+ action and prevent losses.
172
+ </li>
173
+ <li>
174
+ <b>Market Awareness:</b> Access to real-time market prices enables
175
+ farmers to sell their produce at the most favorable rates.
176
+ </li>
177
+ </ul>
178
+ </div>
179
+ <div class="col-md-6">
180
+ <img src="/static/images/farmer_05.jpg" class="img-fluid" alt="" />
181
+ </div>
182
+ </div>
183
+ </div>
184
+ </section>
185
+ <!----------Quotes-------------------------->
186
+ <section id="quotes">
187
+ <div class="container">
188
+ <h1 class="title text-center">Quotes</h1>
189
+ <div class="row offset-1">
190
+ <div class="col-md-4 offset-md-1 quotes">
191
+ <p>
192
+ Agriculture is knowledge, it is skill, and it is the instrument of the
193
+ economic transformation of the country.
194
+ </p>
195
+ <img
196
+ src="https://th.bing.com/th/id/R.f23778460df068a070243104345e2f0b?rik=rM8Ugybe1GQ7cA&riu=http%3a%2f%2f4.bp.blogspot.com%2f-ds227LvoTqk%2fThCuNYcoGYI%2fAAAAAAAAAGQ%2fG5NQZ-zxPsM%2fs1600%2fgandhi_sepia.jpg&ehk=CRuSyVWpifSU1qOmjk0plACK05crrzh55FquZl%2fzWHQ%3d&risl=&pid=ImgRaw&r=0"
197
+ alt=""
198
+ />
199
+ <p class="user-details"><b>Mahatma Gandhi</b></p>
200
+ </div>
201
+ <div class="col-md-4 offset-md-2 quotes">
202
+ <p>
203
+ We must harness the power of technology and science to revolutionize
204
+ agriculture and improve the lives of farmers.
205
+ </p>
206
+ <img
207
+ src="https://th.bing.com/th/id/R.7d12f24287ff1834f10ee0a49b252dbb?rik=dVjWCy6RA4BF5w&riu=http%3a%2f%2fwww.internationalinside.com%2fwp-content%2fuploads%2f2015%2f07%2fdr_apj_abdul_kalam_wallpapers.jpg&ehk=pBnhFHfJEDkAPhHpw9kiCwSEGA8w14WMRRO1C9TH7ss%3d&risl=&pid=ImgRaw&r=0"
208
+ alt=""
209
+ />
210
+ <p class="user-details">
211
+ <b>A. P. J. Abdul Kalam</b><br />The former President of India
212
+ </p>
213
+ </div>
214
+ </div>
215
+ </div>
216
+ </section>
217
+ <!----------Sevice Cards-------------------->
218
+ <section>
219
+ <h1 class="title text-center">Services</h1>
220
+ <div class="container-fluid d-flex justify-content-center">
221
+ <div class="row row-cols-1 row-cols-md-4 g-3 gy-3">
222
+ <div class="col">
223
+ <div class="card" style="width: 18rem">
224
+ <img
225
+ src="https://images.unsplash.com/photo-1597916829826-02e5bb4a54e0?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=687&q=80"
226
+ class="card-img-top"
227
+ alt="..."
228
+ />
229
+ <div class="card-body">
230
+ <h5 class="card-title">Crop Recommendation</h5>
231
+ <p class="card-text">
232
+ Some quick example text to build on the card title and make up the
233
+ bulk of the card's content.
234
+ </p>
235
+ <a href="{{url_for('crop_recommendation')}}" class="btn btn-primary"
236
+ >Visit Page</a
237
+ >
238
+ </div>
239
+ </div>
240
+ </div>
241
+ <div class="col">
242
+ <div class="card" style="width: 18rem">
243
+ <img
244
+ src="https://images.unsplash.com/photo-1492496913980-501348b61469?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=687&q=80"
245
+ class="card-img-top"
246
+ alt="..."
247
+ />
248
+ <div class="card-body">
249
+ <h5 class="card-title">Fertilizer Recommendation</h5>
250
+ <p class="card-text">
251
+ Some quick example text to build on the card title and make up the
252
+ bulk of the card's content.
253
+ </p>
254
+ <a
255
+ href="{{url_for('fertilizer_recommendation')}}"
256
+ class="btn btn-primary"
257
+ >Visit Page</a
258
+ >
259
+ </div>
260
+ </div>
261
+ </div>
262
+ <div class="col">
263
+ <div class="card" style="width: 18rem">
264
+ <img
265
+ src="https://images.unsplash.com/photo-1580982327559-c1202864eb05?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=687&q=80"
266
+ class="card-img-top"
267
+ alt="..."
268
+ />
269
+ <div class="card-body">
270
+ <h5 class="card-title">Dieases Classification</h5>
271
+ <p class="card-text">
272
+ Some quick example text to build on the card title and make up the
273
+ bulk of the card's content.
274
+ </p>
275
+ <a
276
+ href="{{url_for('image_classification')}}"
277
+ class="btn btn-primary"
278
+ >Visit Page</a
279
+ >
280
+ </div>
281
+ </div>
282
+ </div>
283
+ <div class="col">
284
+ <div class="card" style="width: 18rem">
285
+ <img
286
+ src="https://images.unsplash.com/photo-1550989460-0adf9ea622e2?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=687&q=80"
287
+ class="card-img-top"
288
+ alt="..."
289
+ />
290
+ <div class="card-body">
291
+ <h5 class="card-title">Market Price</h5>
292
+ <p class="card-text">
293
+ Some quick example text to build on the card title and make up the
294
+ bulk of the card's content.
295
+ </p>
296
+ <a href="{{url_for('market_price')}}" class="btn btn-primary"
297
+ >Visit Page</a
298
+ >
299
+ </div>
300
+ </div>
301
+ </div>
302
+ </div>
303
+ </div>
304
+ </section>
305
+ <!----------Social Media Section------------>
306
+ <section id="social-media">
307
+ <div class="container text-center">
308
+ <p>Connect on Social Media</p>
309
+ <div class="social-icons">
310
+ <a href="#"><img src="/static/images/github-logo.png" alt="" /></a>
311
+ <a href="#"><img src="/static/images/linkedin-icon.png" alt="" /></a>
312
+ </div>
313
+ </div>
314
+ </section>
315
+ <!----------Footer Section------------------>
316
+ <section id="footer">
317
+ <img src="/static/images/wave1_mod.png" class="footer-img" alt="" />
318
+ <div class="container">
319
+ <div class="row">
320
+ <div class="col-md-4 footer-box">
321
+ <img src="/static/images/logo.png" alt="" />
322
+ <p class="addition-info">
323
+ Please Try all the features and comment and share
324
+ </p>
325
+ </div>
326
+ </div>
327
+ </div>
328
+ </section>
329
+ {% endblock %}
templates/input.html ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %} {% block body %} {% include "nav_bar.html" %}
2
+ <style>
3
+ body {
4
+ background-image: linear-gradient(to right, #75ee71c7, #eceb84);
5
+ }
6
+ </style>
7
+ <div class="container image_input">
8
+ <!-- Form is centered within the .form-container div -->
9
+ <form action="/result" method="post" class="input_class">
10
+ <h1 class="text-center">This is input page</h1>
11
+ <label for="input_file_name" class="form-label">File name</label>
12
+ <input
13
+ type="text"
14
+ class="form-control"
15
+ id="input_file_name"
16
+ name="input_file_name"
17
+ placeholder="Enter the file name"
18
+ />
19
+ <br>
20
+ <div class="d-grid gap-50 d-md-block">
21
+ <button type="submit" class="btn btn-primary">Submit</button>
22
+ <button type="reset" class="btn btn-primary">Clear</button>
23
+ </div>
24
+ </form>
25
+ </div>
26
+ {% endblock %}
templates/market_price_input.html ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %} {% block body %} {% include "nav_bar.html" %}
2
+ <style>
3
+ /* Custom CSS background color*/
4
+ body {
5
+ background-image: linear-gradient(to right, #75ee71c7, #eceb84);
6
+ }
7
+ </style>
8
+
9
+ <div class="container market_input d-flex justify-content-center">
10
+ <form class="row g-3" method="POST" action="/market_price_output">
11
+ <h3 class="text-center">Please select the state</h3>
12
+ <div class="col">
13
+ <label for="inputState" class="form-label">State</label>
14
+ <select
15
+ id="inputState"
16
+ name="selected_state"
17
+ class="form-select"
18
+ required
19
+ >
20
+ <option selected>Select state from dropdown</option>
21
+ <option value="Andhra%20Pradesh">Andhra Pradesh</option>
22
+ <option value="Arunachal%20Pradesh">Arunachal Pradesh</option>
23
+ <option value="Assam">Assam</option>
24
+ <option value="Bihar">Bihar</option>
25
+ <option value="Chhattisgarh">Chhattisgarh</option>
26
+ <option value="Goa">Goa</option>
27
+ <option value="Gujarat">Gujarat</option>
28
+ <option value="Haryana">Haryana</option>
29
+ <option value="Himachal%20Pradesh">Himachal Pradesh</option>
30
+ <option value="Jharkhand">Jharkhand</option>
31
+ <option value="Karnataka">Karnataka</option>
32
+ <option value="Kerala">Kerala</option>
33
+ <option value="Madhya%20Pradesh">Madhya Pradesh</option>
34
+ <option value="Maharashtra">Maharashtra</option>
35
+ <option value="Manipur">Manipur</option>
36
+ <option value="Meghalaya">Meghalaya</option>
37
+ <option value="Mizoram">Mizoram</option>
38
+ <option value="Nagaland">Nagaland</option>
39
+ <option value="Odisha">Odisha</option>
40
+ <option value="Punjab">Punjab</option>
41
+ <option value="Rajasthan">Rajasthan</option>
42
+ <option value="Sikkim">Sikkim</option>
43
+ <option value="Tamil%20Nadu">Tamil Nadu</option>
44
+ <option value="Telangana">Telangana</option>
45
+ <option value="Tripura">Tripura</option>
46
+ <option value="Uttar%20Pradesh">Uttar Pradesh</option>
47
+ <option value="Uttarakhand">Uttarakhand</option>
48
+ <option value="West%20Bengal">West Bengal</option>
49
+ <option value="Andaman%20and%20Nicobar%20Islands">
50
+ Andaman and Nicobar Islands
51
+ </option>
52
+ <option value="Chandigarh">Chandigarh</option>
53
+ <option value="Dadra%20and%20Nagar%20Haveli%20and%20Daman%20and%20Diu">
54
+ Dadra and Nagar Haveli and Daman and Diu
55
+ </option>
56
+ <option value="Lakshadweep">Lakshadweep</option>
57
+ <option value="Delhi">Delhi</option>
58
+ <option value="Puducherry">Puducherry</option>
59
+ </select>
60
+ <div class="invalid-feedback">Please select a valid state.</div>
61
+ </div>
62
+ <div class="d-grid gap-50 d-md-block">
63
+ <button type="submit" class="btn btn-primary">Submit</button>
64
+ <button type="reset" class="btn btn-primary">Clear</button>
65
+ </div>
66
+ </form>
67
+ </div>
68
+ {% endblock %}
templates/market_price_no_data.html ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %} {% block body %} {% include "nav_bar.html" %}
2
+ <style>
3
+ /* Custom CSS background color*/
4
+ body {
5
+ background-image: linear-gradient(to right, #75ee71c7, #eceb84);
6
+ }
7
+
8
+ </style>
9
+
10
+ <div class="container market_price_message ">
11
+ <h5> Commodity prices for the selected state are currently unavailable from the Government API.
12
+ Please consider trying again later or selecting a different state. </h5>
13
+ <div>
14
+ <a href="{{url_for('market_price')}}" class="btn btn-primary" role="button"
15
+ >Choose Different State</a
16
+ >
17
+ </div>
18
+ </div>
19
+
20
+ {% endblock %}
templates/market_price_output.html ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %} {% block body %} {% include "nav_bar.html" %}
2
+ <style>
3
+ .table {
4
+ border-spacing: 0;
5
+ background-color: #f5f5f5;
6
+ border-radius: 15px;
7
+ border: 2px solid aqua;
8
+ }
9
+
10
+ .table-header {
11
+ text-align: left;
12
+ }
13
+ .table-cell {
14
+ padding: 8px;
15
+ }
16
+ </style>
17
+ <div class="container">
18
+ <h2 class="text-center">Commodity Prices</h2>
19
+ <table class="table">
20
+ <tr class="table-header">
21
+ {% for header in data[0] %}
22
+ <th class="table-cell">{{header|upper}}</th>
23
+ {% endfor %}
24
+ </tr>
25
+ {% set data_length = data|length %} {% for index_value in range(data_length)
26
+ %}
27
+ <tr class="table-row">
28
+ {% for row in data[index_value].values() %}
29
+ <td class="table-cell">{{row}}</td>
30
+ {% endfor %}
31
+ </tr>
32
+ {% endfor %}
33
+ </table>
34
+ <!-- <div class="d-grid gap-50 d-md-block">
35
+ <button type="submit" class="btn btn-primary">Submit</button>
36
+ <button type="reset" class="btn btn-primary">Clear</button>
37
+ </div> -->
38
+ <div>
39
+ <a href="{{url_for('market_price')}}" class="btn btn-primary" role="button"
40
+ >Choose Different State</a
41
+ >
42
+ </div>
43
+ </div>
44
+ {% endblock %}
templates/nav_bar.html ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <section id="nav-bar">
2
+ <nav class="navbar navbar-expand-lg">
3
+ <div class="container-fluid">
4
+ <a class="navbar-brand" href="{{url_for('home')}}">
5
+ <img
6
+ src="/static/images/logo.png"
7
+ alt="Logo"
8
+ width="30"
9
+ height="30"
10
+ class="d-inline-block align-text-top"
11
+ />
12
+ CropGuard
13
+ </a>
14
+ <button
15
+ class="navbar-toggler"
16
+ type="button"
17
+ data-bs-toggle="collapse"
18
+ data-bs-target="#navbarSupportedContent"
19
+ aria-controls="navbarSupportedContent"
20
+ aria-expanded="false"
21
+ aria-label="Toggle navigation"
22
+ >
23
+ <span class="navbar-toggler-icon"></span>
24
+ </button>
25
+ <div class="collapse navbar-collapse" id="navbarSupportedContent">
26
+ <ul class="navbar-nav ms-auto">
27
+ <li class="nav-item">
28
+ <a
29
+ class="nav-link active"
30
+ aria-current="page"
31
+ href="{{url_for('crop_recommendation')}}"
32
+ >Crop Recommendation</a
33
+ >
34
+ </li>
35
+ <li class="nav-item">
36
+ <a
37
+ class="nav-link active"
38
+ aria-current="page"
39
+ href="{{url_for('fertilizer_recommendation')}}"
40
+ >Fertilizer Recommendation</a
41
+ >
42
+ </li>
43
+ <li class="nav-item">
44
+ <a
45
+ class="nav-link active"
46
+ aria-current="page"
47
+ href="{{url_for('image_classification')}}"
48
+ >Image Classification</a
49
+ >
50
+ </li>
51
+ <li class="nav-item">
52
+ <a
53
+ class="nav-link active"
54
+ aria-current="page"
55
+ href="{{url_for('market_price')}}"
56
+ >Market Price</a
57
+ >
58
+ </li>
59
+ <li class="nav-item">
60
+ <a class="nav-link active" aria-current="page" href="#"
61
+ >More Projects</a
62
+ >
63
+ </li>
64
+ </ul>
65
+ </div>
66
+ </div>
67
+ </nav>
68
+ </section>
templates/result_new.html ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %} {% block body %} {% include "nav_bar.html" %}
2
+ <style>
3
+ /* Custom CSS background color*/
4
+ body {
5
+ background-image: linear-gradient(to right, #75ee71c7, #eceb84);
6
+ }
7
+ </style>
8
+
9
+ <div
10
+ class="d-flex justify-content-center align-items-center"
11
+ style="min-height: 100vh"
12
+ >
13
+ <div class="container crop-image">
14
+ <div class="row">
15
+ <div class="col-md-6">
16
+ <img src="data:image/jpeg;base64,{{ image_data_base64 }}" alt="Image" />
17
+ </div>
18
+ <div
19
+ class="col-md-6 text d-flex flex-column justify-content-center align-items-center"
20
+ >
21
+ <h1 class="text-center">{{input_file_name.capitalize()}}</h1>
22
+ <p class="text-center">{{crop_details}}</p>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </div>
27
+
28
+ {% endblock %}
29
+ <!-- height="400" -->
30
+ <!-- width="600" -->
utils.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pymongo import MongoClient
2
+ from dotenv import load_dotenv
3
+ import gridfs
4
+ import pickle
5
+ import os
6
+
7
+ # Load environment variables from .env file
8
+ load_dotenv()
9
+
10
+ def load_model_and_encoders(model_path, transformer_path, target_encoder_path):
11
+ with open(model_path, 'rb') as f:
12
+ model = pickle.load(f)
13
+
14
+ with open(transformer_path, 'rb') as f:
15
+ pipeline_encoder = pickle.load(f)
16
+
17
+ with open(target_encoder_path, 'rb') as f:
18
+ label_encoder = pickle.load(f)
19
+
20
+ return model, pipeline_encoder, label_encoder
21
+
22
+
23
+ def retrieve_image_by_name_from_mongodb(file_name, database_name, collection_name):
24
+ # Establish a connection to MongoDB
25
+ client = MongoClient(os.getenv("MONGO_URL"))
26
+
27
+ # Access the specified database
28
+ db = client[database_name]
29
+
30
+ # Create a new GridFS object (a specification for storing and retrieving large binary objects)
31
+ fs = gridfs.GridFS(db, collection=collection_name)
32
+
33
+ # Find the image data using the filename in the metadata
34
+ image_data = fs.find_one({"filename": file_name})
35
+
36
+ try:
37
+ if image_data is None:
38
+ raise ValueError("image_data is None")
39
+
40
+ return image_data.read()
41
+ except Exception as e:
42
+ print(f"An error occurred: {e}")
43
+ raise # Re-raise the caught exception
44
+
45
+
46
+ def retrieve_data(database_name, collection_name, search_query):
47
+ # Connect to MongoDB
48
+ client = MongoClient(os.getenv("MONGO_URL"))
49
+ database = client[database_name]
50
+ collection = database[collection_name]
51
+
52
+ # Search for the document based on the provided query
53
+ result = collection.find_one(search_query)
54
+
55
+ client.close()
56
+ return result['crop_info']