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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="bn">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Fruits Prediction using Machine Learning</title>
|
7 |
+
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali&family=Poppins:wght@400;600&display=swap" rel="stylesheet">
|
8 |
+
<style>
|
9 |
+
body {
|
10 |
+
font-family: 'Noto Sans Bengali', 'Poppins', sans-serif;
|
11 |
+
background: #ffffff;
|
12 |
+
margin: 0;
|
13 |
+
padding: 20px;
|
14 |
+
min-height: 100vh;
|
15 |
+
display: flex;
|
16 |
+
justify-content: center;
|
17 |
+
align-items: center;
|
18 |
+
flex-direction: column;
|
19 |
+
background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
|
20 |
+
}
|
21 |
+
|
22 |
+
.container {
|
23 |
+
background: rgba(255, 255, 255, 0.95);
|
24 |
+
border-radius: 20px;
|
25 |
+
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
|
26 |
+
padding: 30px;
|
27 |
+
max-width: 850px;
|
28 |
+
width: 100%;
|
29 |
+
animation: fadeIn 1s ease-in-out;
|
30 |
+
border: 1px solid #e0e0e0;
|
31 |
+
}
|
32 |
+
|
33 |
+
h1 {
|
34 |
+
color: #ff6f61;
|
35 |
+
font-size: 2.5em;
|
36 |
+
text-align: center;
|
37 |
+
margin-bottom: 25px;
|
38 |
+
font-family: 'Poppins', sans-serif;
|
39 |
+
font-weight: 600;
|
40 |
+
text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
|
41 |
+
}
|
42 |
+
|
43 |
+
h2 {
|
44 |
+
color: #6b7280;
|
45 |
+
font-size: 1.7em;
|
46 |
+
margin-top: 30px;
|
47 |
+
text-align: center;
|
48 |
+
font-family: 'Poppins', sans-serif;
|
49 |
+
font-weight: 400;
|
50 |
+
}
|
51 |
+
|
52 |
+
.upload-section {
|
53 |
+
display: flex;
|
54 |
+
justify-content: center;
|
55 |
+
align-items: center;
|
56 |
+
gap: 20px;
|
57 |
+
margin-bottom: 25px;
|
58 |
+
}
|
59 |
+
|
60 |
+
input[type="file"] {
|
61 |
+
padding: 12px;
|
62 |
+
border: 2px dashed #a3bffa;
|
63 |
+
border-radius: 10px;
|
64 |
+
background: #f8fafc;
|
65 |
+
cursor: pointer;
|
66 |
+
transition: border-color 0.3s, background 0.3s;
|
67 |
+
}
|
68 |
+
|
69 |
+
input[type="file"]:hover {
|
70 |
+
border-color: #7f9cf5;
|
71 |
+
background: #eef2ff;
|
72 |
+
}
|
73 |
+
|
74 |
+
button {
|
75 |
+
padding: 12px 30px;
|
76 |
+
background: linear-gradient(45deg, #ff6f61, #feca57);
|
77 |
+
color: white;
|
78 |
+
border: none;
|
79 |
+
border-radius: 30px;
|
80 |
+
cursor: pointer;
|
81 |
+
font-size: 1.1em;
|
82 |
+
font-family: 'Poppins', sans-serif;
|
83 |
+
transition: transform 0.3s, box-shadow 0.3s;
|
84 |
+
box-shadow: 0 4px 10px rgba(255, 111, 97, 0.3);
|
85 |
+
}
|
86 |
+
|
87 |
+
button:hover {
|
88 |
+
transform: translateY(-2px);
|
89 |
+
box-shadow: 0 6px 15px rgba(255, 111, 97, 0.5);
|
90 |
+
}
|
91 |
+
|
92 |
+
.preview {
|
93 |
+
text-align: center;
|
94 |
+
margin: 20px 0;
|
95 |
+
font-size: 1.3em;
|
96 |
+
color: #4a5568;
|
97 |
+
font-weight: bold;
|
98 |
+
animation: slideIn 0.5s ease-in-out;
|
99 |
+
background: #fefcbf;
|
100 |
+
padding: 10px;
|
101 |
+
border-radius: 10px;
|
102 |
+
}
|
103 |
+
|
104 |
+
table {
|
105 |
+
width: 100%;
|
106 |
+
border-collapse: separate;
|
107 |
+
border-spacing: 0;
|
108 |
+
margin-top: 20px;
|
109 |
+
background: #ffffff;
|
110 |
+
border-radius: 15px;
|
111 |
+
overflow: hidden;
|
112 |
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
|
113 |
+
}
|
114 |
+
|
115 |
+
th, td {
|
116 |
+
padding: 15px;
|
117 |
+
text-align: left;
|
118 |
+
border-bottom: 1px solid #e2e8f0;
|
119 |
+
}
|
120 |
+
|
121 |
+
th {
|
122 |
+
background: linear-gradient(to right, #a3bffa, #93c5fd);
|
123 |
+
color: #1a202c;
|
124 |
+
font-weight: 600;
|
125 |
+
font-family: 'Poppins', sans-serif;
|
126 |
+
}
|
127 |
+
|
128 |
+
td {
|
129 |
+
color: #4a5568;
|
130 |
+
font-size: 1em;
|
131 |
+
}
|
132 |
+
|
133 |
+
tr:nth-child(even) {
|
134 |
+
background: #f7fafc;
|
135 |
+
}
|
136 |
+
|
137 |
+
tr:hover {
|
138 |
+
background: #edf2f7;
|
139 |
+
transition: background 0.3s;
|
140 |
+
}
|
141 |
+
|
142 |
+
ul {
|
143 |
+
margin: 0;
|
144 |
+
padding-left: 20px;
|
145 |
+
color: #e53e3e;
|
146 |
+
}
|
147 |
+
|
148 |
+
li {
|
149 |
+
margin: 8px 0;
|
150 |
+
font-size: 0.95em;
|
151 |
+
}
|
152 |
+
|
153 |
+
.diabetes-section {
|
154 |
+
margin-top: 30px;
|
155 |
+
}
|
156 |
+
|
157 |
+
.diabetes-table th {
|
158 |
+
background: linear-gradient(to right, #feb2b2, #fc8181);
|
159 |
+
}
|
160 |
+
|
161 |
+
@keyframes fadeIn {
|
162 |
+
from { opacity: 0; transform: translateY(20px); }
|
163 |
+
to { opacity: 1; transform: translateY(0); }
|
164 |
+
}
|
165 |
+
|
166 |
+
@keyframes slideIn {
|
167 |
+
from { transform: translateY(15px); opacity: 0; }
|
168 |
+
to { transform: translateY(0); opacity: 1; }
|
169 |
+
}
|
170 |
+
|
171 |
+
@media (max-width: 600px) {
|
172 |
+
.container {
|
173 |
+
padding: 20px;
|
174 |
+
}
|
175 |
+
h1 {
|
176 |
+
font-size: 2em;
|
177 |
+
}
|
178 |
+
h2 {
|
179 |
+
font-size: 1.4em;
|
180 |
+
}
|
181 |
+
button {
|
182 |
+
padding: 10px 20px;
|
183 |
+
font-size: 1em;
|
184 |
+
}
|
185 |
+
.upload-section {
|
186 |
+
flex-direction: column;
|
187 |
+
gap: 15px;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
</style>
|
191 |
+
</head>
|
192 |
+
<body>
|
193 |
+
<div class="container">
|
194 |
+
<h1>🍎 Fruits Prediction using Machine Learning</h1>
|
195 |
+
<div class="upload-section">
|
196 |
+
<input type="file" id="fileInput" accept="image/*">
|
197 |
+
<button onclick="uploadImage()">আপলোড ও চিনুন</button>
|
198 |
+
</div>
|
199 |
+
<div class="preview" id="preview"></div>
|
200 |
+
|
201 |
+
<h2>🍇 ফলের পুষ্টিগুণ</h2>
|
202 |
+
<table id="nutritionTable">
|
203 |
+
<tr>
|
204 |
+
<th>ভিটামিন</th>
|
205 |
+
<th>খনিজ</th>
|
206 |
+
<th>কার্বোহাইড্রেট</th>
|
207 |
+
<th>প্রোটিন</th>
|
208 |
+
<th>অ্যামিনো অ্যাসিড</th>
|
209 |
+
</tr>
|
210 |
+
</table>
|
211 |
+
|
212 |
+
<h2>🩺 স্বাস্থ্য উপকারিতা</h2>
|
213 |
+
<table id="benefitsTable">
|
214 |
+
<tr>
|
215 |
+
<th>প্রতিদিনের গ্রহণ</th>
|
216 |
+
<th>ডায়াবেটিস রোগীদের জন্য</th>
|
217 |
+
<th>উপকারিতা</th>
|
218 |
+
</tr>
|
219 |
+
</table>
|
220 |
+
|
221 |
+
<h2 class="diabetes-section">🩺 ডায়াবেটিস রোগীদের জন্য তথ্য</h2>
|
222 |
+
<table id="diabetesTable" class="diabetes-table">
|
223 |
+
<tr>
|
224 |
+
<th>গ্লাইসেমিক ইনডেক্স</th>
|
225 |
+
<th>পরিমাণ</th>
|
226 |
+
<th>সেরা সময়</th>
|
227 |
+
<th>সতর্কতা</th>
|
228 |
+
</tr>
|
229 |
+
</table>
|
230 |
+
</div>
|
231 |
+
|
232 |
+
<script>
|
233 |
+
async function uploadImage() {
|
234 |
+
const fileInput = document.getElementById('fileInput');
|
235 |
+
const file = fileInput.files[0];
|
236 |
+
if (!file) {
|
237 |
+
alert("দয়া করে একটি ছবি নির্বাচন করুন।");
|
238 |
+
return;
|
239 |
+
}
|
240 |
+
|
241 |
+
const formData = new FormData();
|
242 |
+
formData.append("file", file);
|
243 |
+
|
244 |
+
try {
|
245 |
+
const response = await fetch("/predict", {
|
246 |
+
method: "POST",
|
247 |
+
body: formData
|
248 |
+
});
|
249 |
+
|
250 |
+
if (!response.ok) {
|
251 |
+
throw new Error("চিত্র আপলোড ব্যর্থ হয়েছে।");
|
252 |
+
}
|
253 |
+
|
254 |
+
const result = await response.json();
|
255 |
+
const preview = document.getElementById("preview");
|
256 |
+
preview.innerHTML = `<p><strong>চিহ্নিত ফল:</strong> ${result.predicted_class}</p>`;
|
257 |
+
|
258 |
+
// Nutrition Table
|
259 |
+
const nutrition = result.nutrition;
|
260 |
+
const nutTable = document.getElementById("nutritionTable");
|
261 |
+
nutTable.innerHTML = `
|
262 |
+
<tr>
|
263 |
+
<th>ভিটামিন</th>
|
264 |
+
<th>খনিজ</th>
|
265 |
+
<th>কার্বোহাইড্রেট</th>
|
266 |
+
<th>প্রোটিন</th>
|
267 |
+
<th>অ্যামিনো অ্যাসিড</th>
|
268 |
+
</tr>
|
269 |
+
<tr>
|
270 |
+
<td>${nutrition.vitamin}</td>
|
271 |
+
<td>${nutrition.mineral}</td>
|
272 |
+
<td>${nutrition.carbohydrate}</td>
|
273 |
+
<td>${nutrition.protein}</td>
|
274 |
+
<td>${nutrition.amino_acid}</td>
|
275 |
+
</tr>
|
276 |
+
`;
|
277 |
+
|
278 |
+
// Benefits Table
|
279 |
+
const health = result.health;
|
280 |
+
const benefitTable = document.getElementById("benefitsTable");
|
281 |
+
benefitTable.innerHTML = `
|
282 |
+
<tr>
|
283 |
+
<th>প্রতিদিনের গ্রহণ</th>
|
284 |
+
<th>ডায়াবেটিস রোগীদের জন্য</th>
|
285 |
+
<th>উপকারিতা</th>
|
286 |
+
</tr>
|
287 |
+
<tr>
|
288 |
+
<td>${health.intake}</td>
|
289 |
+
<td>${health.diabetic}</td>
|
290 |
+
<td><ul>${health.benefits.map(b => `<li>${b}</li>`).join('')}</ul></td>
|
291 |
+
</tr>
|
292 |
+
`;
|
293 |
+
|
294 |
+
// Diabetes Table
|
295 |
+
const diabetes = result.diabetes;
|
296 |
+
const diabetesTable = document.getElementById("diabetesTable");
|
297 |
+
diabetesTable.innerHTML = `
|
298 |
+
<tr>
|
299 |
+
<th>গ্লাইসেমিক ইনডেক্স</th>
|
300 |
+
<th>পরিমাণ</th>
|
301 |
+
<th>সেরা সময়</th>
|
302 |
+
<th>সতর্কতা</th>
|
303 |
+
</tr>
|
304 |
+
<tr>
|
305 |
+
<td>${diabetes.glycemic_index}</td>
|
306 |
+
<td>${diabetes.portion_size}</td>
|
307 |
+
<td>${diabetes.best_time}</td>
|
308 |
+
<td>${diabetes.precautions}</td>
|
309 |
+
</tr>
|
310 |
+
`;
|
311 |
+
} catch (error) {
|
312 |
+
alert(error.message || "একটি ত্রুটি ঘটেছে। আবার চেষ্টা করুন।");
|
313 |
+
}
|
314 |
+
}
|
315 |
+
</script>
|
316 |
+
</body>
|
317 |
+
</html>
|