ccookie commited on
Commit
cc2bcdb
·
verified ·
1 Parent(s): 0f2f323

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +589 -19
  3. prompts.txt +2 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Orange
3
- emoji: 🏆
4
- colorFrom: blue
5
- colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: orange
3
+ emoji: 🐳
4
+ colorFrom: pink
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,589 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Citrus Classification System</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .gradient-bg {
11
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
12
+ }
13
+ .citrus-card {
14
+ transition: all 0.3s ease;
15
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
16
+ }
17
+ .citrus-card:hover {
18
+ transform: translateY(-5px);
19
+ box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
20
+ }
21
+ .grade-A {
22
+ border-left: 5px solid #10B981;
23
+ }
24
+ .grade-B {
25
+ border-left: 5px solid #F59E0B;
26
+ }
27
+ .grade-C {
28
+ border-left: 5px solid #EF4444;
29
+ }
30
+ .slider-thumb::-webkit-slider-thumb {
31
+ -webkit-appearance: none;
32
+ appearance: none;
33
+ width: 20px;
34
+ height: 20px;
35
+ border-radius: 50%;
36
+ cursor: pointer;
37
+ }
38
+ #sizeSlider::-webkit-slider-thumb {
39
+ background: #3B82F6;
40
+ }
41
+ #colorSlider::-webkit-slider-thumb {
42
+ background: #F59E0B;
43
+ }
44
+ #smoothnessSlider::-webkit-slider-thumb {
45
+ background: #10B981;
46
+ }
47
+ #photoPreview {
48
+ max-height: 300px;
49
+ object-fit: contain;
50
+ }
51
+ .dropzone {
52
+ border: 2px dashed #cbd5e0;
53
+ transition: all 0.3s;
54
+ }
55
+ .dropzone.active {
56
+ border-color: #3b82f6;
57
+ background-color: #ebf4ff;
58
+ }
59
+ .analysis-progress {
60
+ height: 6px;
61
+ background-color: #e5e7eb;
62
+ }
63
+ .analysis-progress-bar {
64
+ height: 100%;
65
+ background-color: #3b82f6;
66
+ transition: width 0.3s ease;
67
+ }
68
+ </style>
69
+ </head>
70
+ <body class="gradient-bg min-h-screen">
71
+ <div class="container mx-auto px-4 py-8">
72
+ <!-- Header -->
73
+ <header class="text-center mb-12">
74
+ <h1 class="text-4xl font-bold text-gray-800 mb-2">
75
+ <i class="fas fa-lemon text-yellow-400 mr-2"></i>
76
+ Citrus Classification System
77
+ </h1>
78
+ <p class="text-lg text-gray-600 max-w-2xl mx-auto">
79
+ Analyze citrus fruits through manual input or photo analysis for quality grading
80
+ </p>
81
+ </header>
82
+
83
+ <!-- Main Content -->
84
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
85
+ <!-- Input Panel -->
86
+ <div class="bg-white rounded-xl shadow-lg p-6 lg:col-span-1">
87
+ <h2 class="text-2xl font-semibold text-gray-800 mb-6 flex items-center">
88
+ <i class="fas fa-sliders-h text-blue-500 mr-2"></i>
89
+ Classification Parameters
90
+ </h2>
91
+
92
+ <!-- Tab Navigation -->
93
+ <div class="flex border-b mb-6">
94
+ <button id="manualTab" class="flex-1 py-2 px-4 font-medium text-blue-600 border-b-2 border-blue-500">
95
+ <i class="fas fa-keyboard mr-2"></i>Manual Input
96
+ </button>
97
+ <button id="photoTab" class="flex-1 py-2 px-4 font-medium text-gray-500">
98
+ <i class="fas fa-camera mr-2"></i>Photo Analysis
99
+ </button>
100
+ </div>
101
+
102
+ <!-- Manual Input Section -->
103
+ <div id="manualInputSection">
104
+ <!-- Size Input -->
105
+ <div class="mb-6">
106
+ <label for="sizeSlider" class="block text-sm font-medium text-gray-700 mb-2 flex items-center">
107
+ <i class="fas fa-ruler-vertical text-blue-400 mr-2"></i>
108
+ Size (Diameter in cm)
109
+ </label>
110
+ <input type="range" id="sizeSlider" min="5" max="10" step="0.1" value="7.5"
111
+ class="w-full h-2 bg-gray-200 rounded-lg slider-thumb">
112
+ <div class="flex justify-between text-xs text-gray-500 mt-1">
113
+ <span>5 cm</span>
114
+ <span id="sizeValue">7.5 cm</span>
115
+ <span>10 cm</span>
116
+ </div>
117
+ </div>
118
+
119
+ <!-- Color Input -->
120
+ <div class="mb-6">
121
+ <label for="colorSlider" class="block text-sm font-medium text-gray-700 mb-2 flex items-center">
122
+ <i class="fas fa-palette text-yellow-400 mr-2"></i>
123
+ Color (Green to Orange)
124
+ </label>
125
+ <input type="range" id="colorSlider" min="0" max="100" value="50"
126
+ class="w-full h-2 bg-gray-200 rounded-lg slider-thumb">
127
+ <div class="flex justify-between text-xs text-gray-500 mt-1">
128
+ <span>Green</span>
129
+ <span id="colorValue">50%</span>
130
+ <span>Orange</span>
131
+ </div>
132
+ </div>
133
+
134
+ <!-- Smoothness Input -->
135
+ <div class="mb-8">
136
+ <label for="smoothnessSlider" class="block text-sm font-medium text-gray-700 mb-2 flex items-center">
137
+ <i class="fas fa-hand-paper text-green-400 mr-2"></i>
138
+ Skin Smoothness
139
+ </label>
140
+ <input type="range" id="smoothnessSlider" min="0" max="100" value="50"
141
+ class="w-full h-2 bg-gray-200 rounded-lg slider-thumb">
142
+ <div class="flex justify-between text-xs text-gray-500 mt-1">
143
+ <span>Rough</span>
144
+ <span id="smoothnessValue">50%</span>
145
+ <span>Smooth</span>
146
+ </div>
147
+ </div>
148
+ </div>
149
+
150
+ <!-- Photo Analysis Section -->
151
+ <div id="photoAnalysisSection" class="hidden">
152
+ <div class="mb-4">
153
+ <div id="dropzone" class="dropzone rounded-lg p-6 text-center cursor-pointer">
154
+ <div class="flex flex-col items-center justify-center py-8">
155
+ <i class="fas fa-cloud-upload-alt text-3xl text-gray-400 mb-2"></i>
156
+ <p class="text-sm text-gray-600 mb-1">Drag & drop citrus photo here</p>
157
+ <p class="text-xs text-gray-500">or click to browse files</p>
158
+ </div>
159
+ <input type="file" id="photoInput" accept="image/*" class="hidden">
160
+ </div>
161
+ </div>
162
+
163
+ <div id="photoPreviewContainer" class="hidden mb-4">
164
+ <div class="relative">
165
+ <img id="photoPreview" src="#" alt="Preview" class="w-full rounded-lg">
166
+ <button id="removePhotoBtn" class="absolute top-2 right-2 bg-white rounded-full p-2 shadow-md hover:bg-gray-100">
167
+ <i class="fas fa-times text-gray-600"></i>
168
+ </button>
169
+ </div>
170
+ </div>
171
+
172
+ <div id="analysisProgress" class="hidden">
173
+ <div class="flex justify-between text-sm text-gray-600 mb-1">
174
+ <span>Analyzing image...</span>
175
+ <span id="progressPercent">0%</span>
176
+ </div>
177
+ <div class="analysis-progress rounded-full overflow-hidden">
178
+ <div id="progressBar" class="analysis-progress-bar" style="width: 0%"></div>
179
+ </div>
180
+ </div>
181
+
182
+ <div id="analysisResults" class="hidden">
183
+ <div class="bg-gray-50 rounded-lg p-4 mb-4">
184
+ <h4 class="font-medium text-gray-700 mb-2">Photo Analysis Results</h4>
185
+ <div class="grid grid-cols-3 gap-2 text-sm">
186
+ <div>
187
+ <p class="text-gray-500">Size</p>
188
+ <p id="photoSize" class="font-medium">-</p>
189
+ </div>
190
+ <div>
191
+ <p class="text-gray-500">Color</p>
192
+ <p id="photoColor" class="font-medium">-</p>
193
+ </div>
194
+ <div>
195
+ <p class="text-gray-500">Smoothness</p>
196
+ <p id="photoSmoothness" class="font-medium">-</p>
197
+ </div>
198
+ </div>
199
+ </div>
200
+ </div>
201
+ </div>
202
+
203
+ <!-- Classify Button -->
204
+ <button id="classifyBtn" class="w-full bg-blue-500 hover:bg-blue-600 text-white font-medium py-3 px-4 rounded-lg transition duration-300 flex items-center justify-center">
205
+ <i class="fas fa-cogs mr-2"></i>
206
+ Classify Citrus
207
+ </button>
208
+ </div>
209
+
210
+ <!-- Results Panel -->
211
+ <div class="bg-white rounded-xl shadow-lg p-6 lg:col-span-2">
212
+ <h2 class="text-2xl font-semibold text-gray-800 mb-6 flex items-center">
213
+ <i class="fas fa-chart-bar text-purple-500 mr-2"></i>
214
+ Classification Results
215
+ </h2>
216
+
217
+ <!-- Grade Standards -->
218
+ <div class="mb-8">
219
+ <h3 class="text-lg font-medium text-gray-700 mb-3">Grading Standards</h3>
220
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
221
+ <div class="bg-gray-50 p-4 rounded-lg grade-A">
222
+ <h4 class="font-semibold text-green-600 flex items-center">
223
+ <i class="fas fa-star mr-2"></i> Grade A (Premium)
224
+ </h4>
225
+ <ul class="text-sm text-gray-600 mt-2 space-y-1">
226
+ <li><i class="fas fa-check-circle text-green-400 mr-1"></i> Size: 8-10 cm</li>
227
+ <li><i class="fas fa-check-circle text-green-400 mr-1"></i> Color: 70-100% orange</li>
228
+ <li><i class="fas fa-check-circle text-green-400 mr-1"></i> Smoothness: 80-100%</li>
229
+ </ul>
230
+ </div>
231
+ <div class="bg-gray-50 p-4 rounded-lg grade-B">
232
+ <h4 class="font-semibold text-yellow-600 flex items-center">
233
+ <i class="fas fa-star-half-alt mr-2"></i> Grade B (Standard)
234
+ </h4>
235
+ <ul class="text-sm text-gray-600 mt-2 space-y-1">
236
+ <li><i class="fas fa-check-circle text-yellow-400 mr-1"></i> Size: 6-8 cm</li>
237
+ <li><i class="fas fa-check-circle text-yellow-400 mr-1"></i> Color: 30-70% orange</li>
238
+ <li><i class="fas fa-check-circle text-yellow-400 mr-1"></i> Smoothness: 50-80%</li>
239
+ </ul>
240
+ </div>
241
+ <div class="bg-gray-50 p-4 rounded-lg grade-C">
242
+ <h4 class="font-semibold text-red-600 flex items-center">
243
+ <i class="far fa-star mr-2"></i> Grade C (Utility)
244
+ </h4>
245
+ <ul class="text-sm text-gray-600 mt-2 space-y-1">
246
+ <li><i class="fas fa-check-circle text-red-400 mr-1"></i> Size: 5-6 cm</li>
247
+ <li><i class="fas fa-check-circle text-red-400 mr-1"></i> Color: 0-30% orange</li>
248
+ <li><i class="fas fa-check-circle text-red-400 mr-1"></i> Smoothness: 0-50%</li>
249
+ </ul>
250
+ </div>
251
+ </div>
252
+ </div>
253
+
254
+ <!-- Results Display -->
255
+ <div id="resultsContainer" class="hidden">
256
+ <h3 class="text-lg font-medium text-gray-700 mb-3">Current Classification</h3>
257
+ <div class="bg-gray-50 rounded-lg p-6">
258
+ <div class="flex flex-col md:flex-row items-center justify-between">
259
+ <div class="flex items-center mb-4 md:mb-0">
260
+ <div id="citrusVisual" class="w-20 h-20 rounded-full bg-orange-300 border-4 border-orange-200 mr-4"></div>
261
+ <div>
262
+ <h4 id="gradeTitle" class="text-xl font-semibold"></h4>
263
+ <p id="gradeDescription" class="text-sm text-gray-600"></p>
264
+ </div>
265
+ </div>
266
+ <div id="gradeBadge" class="px-4 py-2 rounded-full text-white font-medium text-lg"></div>
267
+ </div>
268
+
269
+ <div class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-4">
270
+ <div class="bg-white p-3 rounded-lg shadow-sm">
271
+ <p class="text-xs text-gray-500">Size</p>
272
+ <p id="resultSize" class="font-medium"></p>
273
+ <div class="w-full bg-gray-200 rounded-full h-2 mt-1">
274
+ <div id="sizeBar" class="h-2 rounded-full bg-blue-500"></div>
275
+ </div>
276
+ </div>
277
+ <div class="bg-white p-3 rounded-lg shadow-sm">
278
+ <p class="text-xs text-gray-500">Color</p>
279
+ <p id="resultColor" class="font-medium"></p>
280
+ <div class="w-full bg-gray-200 rounded-full h-2 mt-1">
281
+ <div id="colorBar" class="h-2 rounded-full bg-yellow-500"></div>
282
+ </div>
283
+ </div>
284
+ <div class="bg-white p-3 rounded-lg shadow-sm">
285
+ <p class="text-xs text-gray-500">Smoothness</p>
286
+ <p id="resultSmoothness" class="font-medium"></p>
287
+ <div class="w-full bg-gray-200 rounded-full h-2 mt-1">
288
+ <div id="smoothnessBar" class="h-2 rounded-full bg-green-500"></div>
289
+ </div>
290
+ </div>
291
+ </div>
292
+ </div>
293
+ </div>
294
+
295
+ <!-- MATLAB-style Visualization -->
296
+ <div id="matlabViz" class="mt-8 hidden">
297
+ <h3 class="text-lg font-medium text-gray-700 mb-3">Classification Visualization</h3>
298
+ <div class="bg-gray-800 rounded-lg p-4">
299
+ <div class="flex items-center text-green-400 font-mono text-sm mb-2">
300
+ <span class="mr-2">>></span>
301
+ <span>Citrus Classification Algorithm Output:</span>
302
+ </div>
303
+ <div id="matlabOutput" class="bg-black text-green-400 p-3 rounded font-mono text-sm overflow-x-auto"></div>
304
+ </div>
305
+ </div>
306
+ </div>
307
+ </div>
308
+
309
+ <!-- Footer -->
310
+ <footer class="mt-12 text-center text-gray-500 text-sm">
311
+ <p>© 2023 Citrus Classification System | Designed with MATLAB-inspired interface</p>
312
+ </footer>
313
+ </div>
314
+
315
+ <script>
316
+ // Update slider values in real-time
317
+ document.getElementById('sizeSlider').addEventListener('input', function() {
318
+ document.getElementById('sizeValue').textContent = this.value + ' cm';
319
+ });
320
+
321
+ document.getElementById('colorSlider').addEventListener('input', function() {
322
+ document.getElementById('colorValue').textContent = this.value + '%';
323
+ });
324
+
325
+ document.getElementById('smoothnessSlider').addEventListener('input', function() {
326
+ document.getElementById('smoothnessValue').textContent = this.value + '%';
327
+ });
328
+
329
+ // Tab switching
330
+ document.getElementById('manualTab').addEventListener('click', function() {
331
+ document.getElementById('manualInputSection').classList.remove('hidden');
332
+ document.getElementById('photoAnalysisSection').classList.add('hidden');
333
+ this.classList.add('text-blue-600', 'border-blue-500');
334
+ this.classList.remove('text-gray-500');
335
+ document.getElementById('photoTab').classList.add('text-gray-500');
336
+ document.getElementById('photoTab').classList.remove('text-blue-600', 'border-blue-500');
337
+ });
338
+
339
+ document.getElementById('photoTab').addEventListener('click', function() {
340
+ document.getElementById('manualInputSection').classList.add('hidden');
341
+ document.getElementById('photoAnalysisSection').classList.remove('hidden');
342
+ this.classList.add('text-blue-600', 'border-blue-500');
343
+ this.classList.remove('text-gray-500');
344
+ document.getElementById('manualTab').classList.add('text-gray-500');
345
+ document.getElementById('manualTab').classList.remove('text-blue-600', 'border-blue-500');
346
+ });
347
+
348
+ // Photo upload functionality
349
+ const dropzone = document.getElementById('dropzone');
350
+ const photoInput = document.getElementById('photoInput');
351
+ const photoPreview = document.getElementById('photoPreview');
352
+ const photoPreviewContainer = document.getElementById('photoPreviewContainer');
353
+ const removePhotoBtn = document.getElementById('removePhotoBtn');
354
+ const analysisProgress = document.getElementById('analysisProgress');
355
+ const analysisResults = document.getElementById('analysisResults');
356
+
357
+ // Handle drag and drop events
358
+ ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
359
+ dropzone.addEventListener(eventName, preventDefaults, false);
360
+ });
361
+
362
+ function preventDefaults(e) {
363
+ e.preventDefault();
364
+ e.stopPropagation();
365
+ }
366
+
367
+ ['dragenter', 'dragover'].forEach(eventName => {
368
+ dropzone.addEventListener(eventName, highlight, false);
369
+ });
370
+
371
+ ['dragleave', 'drop'].forEach(eventName => {
372
+ dropzone.addEventListener(eventName, unhighlight, false);
373
+ });
374
+
375
+ function highlight() {
376
+ dropzone.classList.add('active');
377
+ }
378
+
379
+ function unhighlight() {
380
+ dropzone.classList.remove('active');
381
+ }
382
+
383
+ // Handle dropped files
384
+ dropzone.addEventListener('drop', handleDrop, false);
385
+
386
+ function handleDrop(e) {
387
+ const dt = e.dataTransfer;
388
+ const files = dt.files;
389
+ handleFiles(files);
390
+ }
391
+
392
+ // Handle clicked files
393
+ photoInput.addEventListener('change', function() {
394
+ handleFiles(this.files);
395
+ });
396
+
397
+ dropzone.addEventListener('click', function() {
398
+ photoInput.click();
399
+ });
400
+
401
+ // Remove photo
402
+ removePhotoBtn.addEventListener('click', function(e) {
403
+ e.stopPropagation();
404
+ photoPreview.src = '#';
405
+ photoPreviewContainer.classList.add('hidden');
406
+ analysisProgress.classList.add('hidden');
407
+ analysisResults.classList.add('hidden');
408
+ });
409
+
410
+ function handleFiles(files) {
411
+ if (files.length > 0) {
412
+ const file = files[0];
413
+ if (file.type.match('image.*')) {
414
+ const reader = new FileReader();
415
+
416
+ reader.onload = function(e) {
417
+ photoPreview.src = e.target.result;
418
+ photoPreviewContainer.classList.remove('hidden');
419
+ analyzeImage(file);
420
+ }
421
+
422
+ reader.readAsDataURL(file);
423
+ }
424
+ }
425
+ }
426
+
427
+ // Simulate image analysis
428
+ function analyzeImage(file) {
429
+ analysisProgress.classList.remove('hidden');
430
+ analysisResults.classList.add('hidden');
431
+
432
+ let progress = 0;
433
+ const progressInterval = setInterval(() => {
434
+ progress += Math.random() * 10;
435
+ if (progress > 100) progress = 100;
436
+
437
+ document.getElementById('progressBar').style.width = `${progress}%`;
438
+ document.getElementById('progressPercent').textContent = `${Math.floor(progress)}%`;
439
+
440
+ if (progress === 100) {
441
+ clearInterval(progressInterval);
442
+ setTimeout(() => {
443
+ // Simulate analysis results
444
+ const simulatedSize = (5 + Math.random() * 5).toFixed(1);
445
+ const simulatedColor = Math.floor(Math.random() * 100);
446
+ const simulatedSmoothness = Math.floor(Math.random() * 100);
447
+
448
+ document.getElementById('photoSize').textContent = `${simulatedSize} cm`;
449
+ document.getElementById('photoColor').textContent = `${simulatedColor}% orange`;
450
+ document.getElementById('photoSmoothness').textContent = `${simulatedSmoothness}% smooth`;
451
+
452
+ // Update sliders with analyzed values
453
+ document.getElementById('sizeSlider').value = simulatedSize;
454
+ document.getElementById('colorSlider').value = simulatedColor;
455
+ document.getElementById('smoothnessSlider').value = simulatedSmoothness;
456
+
457
+ document.getElementById('sizeValue').textContent = `${simulatedSize} cm`;
458
+ document.getElementById('colorValue').textContent = `${simulatedColor}%`;
459
+ document.getElementById('smoothnessValue').textContent = `${simulatedSmoothness}%`;
460
+
461
+ analysisProgress.classList.add('hidden');
462
+ analysisResults.classList.remove('hidden');
463
+ }, 500);
464
+ }
465
+ }, 100);
466
+ }
467
+
468
+ // Classification function
469
+ document.getElementById('classifyBtn').addEventListener('click', function() {
470
+ // Get input values
471
+ const size = parseFloat(document.getElementById('sizeSlider').value);
472
+ const color = parseInt(document.getElementById('colorSlider').value);
473
+ const smoothness = parseInt(document.getElementById('smoothnessSlider').value);
474
+
475
+ // Determine grade
476
+ let grade, title, description, badgeClass;
477
+
478
+ if ((size >= 8 && size <= 10) && (color >= 70 && color <= 100) && (smoothness >= 80 && smoothness <= 100)) {
479
+ grade = 'A';
480
+ title = 'Premium Quality Citrus';
481
+ description = 'Excellent size, color, and texture. Ideal for fresh consumption.';
482
+ badgeClass = 'bg-green-500';
483
+ }
484
+ else if ((size >= 6 && size < 8) && (color >= 30 && color < 70) && (smoothness >= 50 && smoothness < 80)) {
485
+ grade = 'B';
486
+ title = 'Standard Quality Citrus';
487
+ description = 'Good quality, suitable for both fresh consumption and processing.';
488
+ badgeClass = 'bg-yellow-500';
489
+ }
490
+ else if ((size >= 5 && size < 6) && (color >= 0 && color < 30) && (smoothness >= 0 && smoothness < 50)) {
491
+ grade = 'C';
492
+ title = 'Utility Grade Citrus';
493
+ description = 'Best suited for processing into juices or other products.';
494
+ badgeClass = 'bg-red-500';
495
+ }
496
+ else {
497
+ grade = 'B';
498
+ title = 'Standard Quality Citrus (Mixed Characteristics)';
499
+ description = 'Some characteristics meet premium standards while others are utility grade.';
500
+ badgeClass = 'bg-yellow-500';
501
+ }
502
+
503
+ // Update citrus visual
504
+ const citrusVisual = document.getElementById('citrusVisual');
505
+ const colorValue = color / 100;
506
+ const orangeHue = 30 + (colorValue * 30); // Range from 30 (greenish) to 60 (orange)
507
+ citrusVisual.style.backgroundColor = `hsl(${orangeHue}, 100%, ${70 - (smoothness/100 * 20)}%)`;
508
+
509
+ // Update results
510
+ document.getElementById('gradeTitle').textContent = title;
511
+ document.getElementById('gradeDescription').textContent = description;
512
+ document.getElementById('gradeBadge').textContent = `Grade ${grade}`;
513
+ document.getElementById('gradeBadge').className = `px-4 py-2 rounded-full text-white font-medium text-lg ${badgeClass}`;
514
+
515
+ // Update metric displays
516
+ document.getElementById('resultSize').textContent = `${size.toFixed(1)} cm`;
517
+ document.getElementById('resultColor').textContent = `${color}% orange`;
518
+ document.getElementById('resultSmoothness').textContent = `${smoothness}% smooth`;
519
+
520
+ // Update progress bars
521
+ document.getElementById('sizeBar').style.width = `${((size - 5) / 5) * 100}%`;
522
+ document.getElementById('colorBar').style.width = `${color}%`;
523
+ document.getElementById('smoothnessBar').style.width = `${smoothness}%`;
524
+
525
+ // Show results
526
+ document.getElementById('resultsContainer').classList.remove('hidden');
527
+
528
+ // Generate MATLAB-style output
529
+ generateMatlabOutput(size, color, smoothness, grade);
530
+ document.getElementById('matlabViz').classList.remove('hidden');
531
+ });
532
+
533
+ function generateMatlabOutput(size, color, smoothness, grade) {
534
+ const output = document.getElementById('matlabOutput');
535
+ output.innerHTML = `
536
+ <div>>> citrus_features = [${size.toFixed(1)}, ${color}, ${smoothness}];</div>
537
+ <div>>> grade = classifyCitrus(citrus_features);</div>
538
+ <div class="mt-2">Processing feature vector...</div>
539
+ <div>Size component: ${size.toFixed(1)} cm → ${getSizeCategory(size)}</div>
540
+ <div>Color component: ${color}% orange → ${getColorCategory(color)}</div>
541
+ <div>Smoothness component: ${smoothness}% → ${getSmoothnessCategory(smoothness)}</div>
542
+ <div class="mt-2 font-bold">Classification result: Grade ${grade}</div>
543
+ <div class="mt-1">Confidence: ${calculateConfidence(size, color, smoothness, grade).toFixed(1)}%</div>
544
+ `;
545
+ }
546
+
547
+ function getSizeCategory(size) {
548
+ if (size >= 8) return 'Premium range';
549
+ if (size >= 6) return 'Standard range';
550
+ return 'Utility range';
551
+ }
552
+
553
+ function getColorCategory(color) {
554
+ if (color >= 70) return 'Premium color';
555
+ if (color >= 30) return 'Standard color';
556
+ return 'Utility color';
557
+ }
558
+
559
+ function getSmoothnessCategory(smoothness) {
560
+ if (smoothness >= 80) return 'Premium texture';
561
+ if (smoothness >= 50) return 'Standard texture';
562
+ return 'Utility texture';
563
+ }
564
+
565
+ function calculateConfidence(size, color, smoothness, grade) {
566
+ // Simple confidence calculation based on how close features are to grade center
567
+ let sizeScore, colorScore, smoothnessScore;
568
+
569
+ if (grade === 'A') {
570
+ sizeScore = Math.min(100, Math.max(0, (size - 8) / 2 * 100));
571
+ colorScore = Math.min(100, Math.max(0, (color - 70) / 30 * 100));
572
+ smoothnessScore = Math.min(100, Math.max(0, (smoothness - 80) / 20 * 100));
573
+ }
574
+ else if (grade === 'B') {
575
+ sizeScore = 100 - Math.abs(size - 7) / 1 * 100;
576
+ colorScore = 100 - Math.abs(color - 50) / 20 * 100;
577
+ smoothnessScore = 100 - Math.abs(smoothness - 65) / 15 * 100;
578
+ }
579
+ else {
580
+ sizeScore = Math.min(100, Math.max(0, (6 - size) / 1 * 100));
581
+ colorScore = Math.min(100, Math.max(0, (30 - color) / 30 * 100));
582
+ smoothnessScore = Math.min(100, Math.max(0, (50 - smoothness) / 50 * 100));
583
+ }
584
+
585
+ return (sizeScore + colorScore + smoothnessScore) / 3;
586
+ }
587
+ </script>
588
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=ccookie/orange" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
589
+ </html>
prompts.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ 设计一个使用matlab对柑橘进行分类系统,根据柑橘的大小、色泽,表皮光滑度来设计分级标准,标准自拟,共分三级
2
+ 在现有基础上增加输入照片的选项,评估照片的各种参数来实现分级