agentsay commited on
Commit
1af162f
·
verified ·
1 Parent(s): e77b32a

Create templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +85 -0
templates/index.html ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.0">
6
+ <title>Crop Yield & Loan Prediction</title>
7
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css">
8
+ <style>
9
+ body {
10
+ background-color: #f8f9fa;
11
+ }
12
+ .result-box {
13
+ background: #ffffff;
14
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
15
+ padding: 20px;
16
+ border-radius: 10px;
17
+ }
18
+ .highlight {
19
+ font-weight: bold;
20
+ padding: 5px 10px;
21
+ border-radius: 5px;
22
+ }
23
+ .good { background-color: #28a745; color: white; }
24
+ .average { background-color: #ffc107; color: black; }
25
+ .poor { background-color: #dc3545; color: white; }
26
+ </style>
27
+ </head>
28
+ <body>
29
+ <div class="container mt-5">
30
+ <h2 class="text-center text-primary">🌾 Crop Yield & Loan Prediction 🌾</h2>
31
+ <p class="text-center text-muted">Enter your details below to get an estimate.</p>
32
+
33
+ <form action="/predict" method="post" class="mt-4 border p-4 bg-white shadow-sm rounded">
34
+ <div class="mb-3">
35
+ <label for="crop" class="form-label">Select Crop:</label>
36
+ <select name="crop" id="crop" class="form-control" required>
37
+ {% for crop in crops %}
38
+ <option value="{{ crop }}">{{ crop }}</option>
39
+ {% endfor %}
40
+ </select>
41
+ </div>
42
+ <div class="mb-3">
43
+ <label for="district" class="form-label">Enter District:</label>
44
+ <input type="text" name="district" id="district" class="form-control" required>
45
+ </div>
46
+ <div class="mb-3">
47
+ <label for="land_area" class="form-label">Land Area (in hectares):</label>
48
+ <input type="number" name="land_area" id="land_area" class="form-control" step="0.1" required>
49
+ </div>
50
+ <button type="submit" class="btn btn-primary w-100">Predict</button>
51
+ </form>
52
+
53
+ {% if result %}
54
+ <div class="mt-5 result-box">
55
+ <h4 class="text-center text-success">📊 Prediction Results 📊</h4>
56
+ <hr>
57
+ <p><strong>Crop:</strong> {{ result.crop }}</p>
58
+ <p><strong>District:</strong> {{ result.district }}</p>
59
+ <p><strong>Predicted Yield:</strong> {{ result.predicted_yield }}
60
+ <span class="highlight {% if result.yield_category == 'Highly Recommended Crop' %}good
61
+ {% elif result.yield_category == 'Good Crop' %}average
62
+ {% else %}poor{% endif %}">
63
+ {{ result.yield_cat }}
64
+ </span>
65
+ </p>
66
+ <p><strong>Soil Health:</strong> {{ result.soil_health }}</p>
67
+ <p><strong>Climate Score:</strong> {{ result.climate_score }}/100</p>
68
+ <p><strong>Predicted Loan Amount:</strong> <span class="text-primary fw-bold">₹{{ result.loan_amount }}</span></p>
69
+ <p><strong>Suitable Crop For Your area:</strong><span style="color: green; font-weight:bold;"> {{ result.best_crop }} </span></p>
70
+ {% if image_path %}
71
+ <img src="{{ image_path }}" alt="Forecast Plot" class="img-fluid mt-3 rounded">
72
+
73
+ {% endif %}
74
+ <br>
75
+ {% if image_path2 %}
76
+ <img src="{{ image_path2 }}" alt="Forecast Plot" class="img-fluid mt-3 rounded">
77
+
78
+ {% endif %}
79
+ </div>
80
+ {% endif %}
81
+ </div>
82
+
83
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/js/bootstrap.bundle.min.js"></script>
84
+ </body>
85
+ </html>