devluke commited on
Commit
7ef21d4
Β·
verified Β·
1 Parent(s): d9572ee

Upload index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +427 -61
templates/index.html CHANGED
@@ -70,23 +70,124 @@
70
  border: 2px solid var(--border);
71
  }
72
 
73
- /* ── Nav tabs ── */
74
  .nav-tabs {
75
- border-bottom: 2px solid var(--border);
 
 
 
 
 
76
  }
77
 
78
  .nav-tabs .nav-link {
79
  color: var(--muted-text);
80
  border: none;
81
  font-weight: 600;
82
- padding: 12px 20px;
83
- border-radius: 10px 10px 0 0;
 
 
 
84
  }
85
 
86
  .nav-tabs .nav-link.active {
87
- background: var(--primary-pale);
 
 
 
 
 
88
  color: var(--primary);
89
- border-bottom: 3px solid var(--primary);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
91
 
92
  /* ── Form control ── */
@@ -171,7 +272,39 @@
171
  border: 2px solid rgba(255, 255, 255, .4);
172
  }
173
 
174
- /* ── Crop image ── */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  .crop-preview {
176
  width: 110px;
177
  height: 110px;
@@ -343,9 +476,98 @@
343
  pointer-events: none;
344
  }
345
 
346
- /* ── Placeholder ── */
347
- #placeholder i {
348
- color: #93c5fd !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
  }
350
 
351
  /* ── Animations ── */
@@ -382,42 +604,61 @@
382
  <body>
383
 
384
  <div class="container py-5">
385
- <header class="text-center mb-5">
386
- <h1 class="fw-bold mb-2"><i class="fas fa-microchip me-2 text-primary"></i>Undertone Classification
387
- Dashboard</h1>
388
- <p class="text-secondary">Artificial Intelligence System Powered by ResNet50 & MobileNetV2</p>
 
 
 
 
 
 
 
389
  </header>
390
 
391
  <div class="row g-4">
392
  <div class="col-lg-6">
393
  <div class="glass-card p-4 h-100">
394
- <h5 class="mb-4"><i class="fas fa-camera me-2 text-primary"></i>Data Input Source</h5>
 
 
 
395
 
396
  <ul class="nav nav-tabs mb-4" id="inputTab" role="tablist">
397
  <li class="nav-item" role="presentation">
398
  <button class="nav-link active" id="gallery-tab" data-bs-toggle="tab"
399
  data-bs-target="#galleryTab" type="button" role="tab">
400
- <i class="fas fa-upload me-2"></i>Gallery
401
  </button>
402
  </li>
403
  <li class="nav-item" role="presentation">
404
  <button class="nav-link" id="camera-tab" data-bs-toggle="tab" data-bs-target="#cameraTab"
405
  type="button" role="tab">
406
- <i class="fas fa-video me-2"></i>Live Session
407
  </button>
408
  </li>
409
  </ul>
410
 
411
  <div class="tab-content" id="inputTabContent">
412
  <div class="tab-pane fade show active" id="galleryTab" role="tabpanel">
413
- <div class="mb-4">
414
- <label class="form-label small fw-semibold" style="color:var(--muted-text)">Select
415
- Portrait Image</label>
416
- <input type="file" id="fileInput" class="form-control">
 
 
 
 
 
 
 
 
 
417
  </div>
418
  <button id="btnGallery" onclick="uploadFile()"
419
- class="btn btn-gradient-primary w-100 py-3 fw-bold">
420
- <i class="fas fa-search me-2"></i>ANALYZE SELECTION
421
  </button>
422
  </div>
423
 
@@ -427,7 +668,8 @@
427
  </div>
428
  <button id="btnCamera" onclick="captureCamera()"
429
  class="btn btn-gradient-success w-100 py-3 fw-bold">
430
- <i class="fas fa-bolt me-2"></i>CAPTURE & PROCESS
 
431
  </button>
432
  <canvas id="canvas" style="display:none;"></canvas>
433
  </div>
@@ -440,69 +682,164 @@
440
  <div class="spinner-border mb-3" role="status">
441
  <span class="visually-hidden">Loading...</span>
442
  </div>
443
- <h5 class="text-primary">Processing Image...</h5>
444
- <p class="text-muted small">Running Deep Learning Inference</p>
445
  </div>
446
 
447
  <div class="glass-card p-4 d-none" id="resultPanel">
448
 
449
- <!-- β‘  Hero: crop + badge -->
450
- <div class="d-flex align-items-center gap-3 mb-4 result-anim">
451
- <img id="cropImg" class="crop-preview" src="" alt="Face crop">
452
- <div>
453
- <p class="text-secondary small mb-1"
454
- style="font-size:.72rem;letter-spacing:.08em;text-transform:uppercase">Undertone
455
- Detected</p>
456
- <div id="resBadge" class="undertone-badge mb-2">β€”</div>
 
 
 
 
 
 
 
 
 
 
 
457
  <div id="agreepill" class="agree-pill agree-yes">
458
  <i class="fas fa-check-circle"></i> <span id="agreeText">Models agree</span>
459
  </div>
460
  </div>
461
  </div>
462
 
463
- <!-- β‘‘ Radial rings + bars -->
464
- <div class="row g-3 mb-3">
465
- <div class="col-12 result-anim">
466
- <div class="model-block">
467
- <div class="model-title"><i class="fas fa-brain me-1"></i> ResNet50</div>
468
- <div id="resnetScores"></div>
469
- </div>
470
  </div>
471
- <div class="col-12 result-anim">
472
- <div class="model-block">
473
- <div class="model-title"><i class="fas fa-microchip me-1"></i> MobileNetV2</div>
474
- <div id="mobilenetScores"></div>
475
- </div>
476
  </div>
477
  </div>
478
 
479
  <!-- β‘’ Palette recommendation -->
 
 
480
  <div class="model-block result-anim" id="paletteBlock">
481
- <div class="palette-title"><i class="fas fa-palette me-1"></i> Recommended Colour Palette</div>
482
  <div id="paletteChips" class="d-flex flex-wrap gap-2"></div>
483
  <p id="paletteDesc" class="text-secondary mt-2 mb-0" style="font-size:.78rem"></p>
484
  </div>
485
 
486
  </div>
487
 
488
- <div id="placeholder"
489
- class="glass-card p-5 h-100 d-flex align-items-center justify-content-center text-center">
490
- <div>
491
- <i class="fas fa-hourglass-start fa-4x mb-4 text-secondary opacity-20"></i>
492
- <h5 class="text-secondary">Ready for Analysis</h5>
493
- <p class="text-muted small">Please provide an input image to start.</p>
 
 
 
 
 
 
 
 
 
 
 
494
  </div>
495
  </div>
496
  </div>
497
  </div>
498
  </div>
499
 
 
 
 
 
500
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
501
 
502
  <script>
503
  const video = document.getElementById('video');
504
  const canvas = document.getElementById('canvas');
505
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
506
  // ── Palette data per undertone ──────────────────────────────────────
507
  const PALETTES = {
508
  cool: {
@@ -555,10 +892,34 @@
555
  }
556
  };
557
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
558
  // ── Camera Init ─────────────────────────────────────────────────────
559
  document.getElementById('camera-tab').addEventListener('shown.bs.tab', () => {
560
  if (!video.srcObject)
561
- navigator.mediaDevices.getUserMedia({ video: true }).then(s => video.srcObject = s);
 
 
 
562
  });
563
 
564
  // ── Loading toggle ──────────────────────────────────────────────────
@@ -615,11 +976,16 @@
615
  const palette = PALETTES[resLabel] || PALETTES['neutral'];
616
  const displayLabel = palette.label; // Title-case: 'Cool'
617
 
 
 
 
 
 
618
  // Crop image + ring glow colour
619
  const cropImg = document.getElementById('cropImg');
620
- cropImg.src = `/static/uploads/${data.crop}`;
621
  cropImg.style.setProperty('--ring-color', palette.ringColor);
622
- cropImg.style.boxShadow = `0 0 0 4px ${palette.ringColor}, 0 0 30px ${palette.ringColor}55`;
623
 
624
  // Badge
625
  const badge = document.getElementById('resBadge');
@@ -632,12 +998,12 @@
632
  if (agree) {
633
  pill.className = 'agree-pill agree-yes';
634
  pill.querySelector('i').className = 'fas fa-check-circle';
635
- agreeText.textContent = 'Both models agree';
636
  } else {
637
  pill.className = 'agree-pill agree-no';
638
  pill.querySelector('i').className = 'fas fa-exclamation-circle';
639
  const mobDisplay = (PALETTES[mobLabel] || PALETTES['neutral']).label;
640
- agreeText.textContent = `ResNet: ${displayLabel} Β· MobileNet: ${mobDisplay}`;
641
  }
642
 
643
  // Score bars
@@ -657,7 +1023,7 @@
657
  // ── Upload ──────────────────────────────────────────────────────────
658
  async function uploadFile() {
659
  const file = document.getElementById('fileInput').files[0];
660
- if (!file) return alert('Select an image first');
661
  toggleLoading(true);
662
  const fd = new FormData();
663
  fd.append('file', file);
@@ -666,7 +1032,7 @@
666
  const data = await res.json();
667
  if (res.ok) handleResponse(data);
668
  else { alert(data.error); toggleLoading(false); document.getElementById('placeholder').classList.remove('d-none'); }
669
- } catch { alert('Server error'); toggleLoading(false); }
670
  }
671
 
672
  // ── Camera capture ──────────────────────────────────────────���───────
@@ -684,7 +1050,7 @@
684
  const data = await res.json();
685
  if (res.ok) handleResponse(data);
686
  else { alert(data.error); toggleLoading(false); document.getElementById('placeholder').classList.remove('d-none'); }
687
- } catch { alert('Server error'); toggleLoading(false); }
688
  }
689
  </script>
690
  </body>
 
70
  border: 2px solid var(--border);
71
  }
72
 
73
+ /* ── Nav tabs (pill style) ── */
74
  .nav-tabs {
75
+ border-bottom: none;
76
+ background: #f1f5f9;
77
+ border-radius: 12px;
78
+ padding: 4px;
79
+ gap: 4px;
80
+ display: flex;
81
  }
82
 
83
  .nav-tabs .nav-link {
84
  color: var(--muted-text);
85
  border: none;
86
  font-weight: 600;
87
+ padding: 9px 18px;
88
+ border-radius: 9px;
89
+ flex: 1;
90
+ text-align: center;
91
+ transition: .2s;
92
  }
93
 
94
  .nav-tabs .nav-link.active {
95
+ background: #fff;
96
+ color: var(--primary);
97
+ box-shadow: 0 2px 8px rgba(29, 78, 216, .12);
98
+ }
99
+
100
+ .nav-tabs .nav-link:not(.active):hover {
101
  color: var(--primary);
102
+ background: rgba(255, 255, 255, .5);
103
+ }
104
+
105
+ /* ── Drag-drop zone ── */
106
+ .drop-zone {
107
+ border: 2px dashed #cbd5e1;
108
+ border-radius: 16px;
109
+ padding: 28px 16px;
110
+ text-align: center;
111
+ cursor: pointer;
112
+ transition: .2s;
113
+ background: #f8fafc;
114
+ position: relative;
115
+ }
116
+
117
+ .drop-zone:hover,
118
+ .drop-zone.drag-over {
119
+ border-color: var(--primary-light);
120
+ background: var(--primary-pale);
121
+ }
122
+
123
+ .drop-zone input[type=file] {
124
+ position: absolute;
125
+ inset: 0;
126
+ opacity: 0;
127
+ cursor: pointer;
128
+ width: 100%;
129
+ height: 100%;
130
+ }
131
+
132
+ .drop-zone-icon {
133
+ font-size: 2rem;
134
+ color: #93c5fd;
135
+ margin-bottom: 8px;
136
+ }
137
+
138
+ .drop-zone-text {
139
+ font-size: .82rem;
140
+ font-weight: 600;
141
+ color: var(--muted-text);
142
+ }
143
+
144
+ .drop-zone-sub {
145
+ font-size: .72rem;
146
+ color: #94a3b8;
147
+ }
148
+
149
+ /* ── File preview ── */
150
+ #filePreviewWrap {
151
+ display: none;
152
+ margin-top: 12px;
153
+ position: relative;
154
+ border-radius: 12px;
155
+ overflow: hidden;
156
+ }
157
+
158
+ #filePreview {
159
+ width: 100%;
160
+ max-height: 180px;
161
+ object-fit: cover;
162
+ border-radius: 12px;
163
+ display: block;
164
+ }
165
+
166
+ .preview-remove {
167
+ position: absolute;
168
+ top: 8px;
169
+ right: 8px;
170
+ background: rgba(0, 0, 0, .55);
171
+ color: #fff;
172
+ border: none;
173
+ border-radius: 50%;
174
+ width: 28px;
175
+ height: 28px;
176
+ font-size: .75rem;
177
+ cursor: pointer;
178
+ display: flex;
179
+ align-items: center;
180
+ justify-content: center;
181
+ }
182
+
183
+ .preview-name {
184
+ font-size: .72rem;
185
+ color: var(--muted-text);
186
+ margin-top: 6px;
187
+ text-align: center;
188
+ white-space: nowrap;
189
+ overflow: hidden;
190
+ text-overflow: ellipsis;
191
  }
192
 
193
  /* ── Form control ── */
 
272
  border: 2px solid rgba(255, 255, 255, .4);
273
  }
274
 
275
+ /* ── Image comparison panel ── */
276
+ .img-pair {
277
+ display: flex;
278
+ gap: 16px;
279
+ align-items: flex-start;
280
+ }
281
+
282
+ .img-slot {
283
+ display: flex;
284
+ flex-direction: column;
285
+ align-items: center;
286
+ gap: 6px;
287
+ flex: 1;
288
+ }
289
+
290
+ .img-slot-label {
291
+ font-size: .65rem;
292
+ font-weight: 700;
293
+ text-transform: uppercase;
294
+ letter-spacing: .08em;
295
+ color: var(--muted-text);
296
+ }
297
+
298
+ .img-thumb {
299
+ width: 100%;
300
+ aspect-ratio: 1 / 1;
301
+ object-fit: cover;
302
+ border-radius: 14px;
303
+ border: 3px solid #fff;
304
+ box-shadow: 0 0 0 3px var(--ring-color, #3b82f6), 0 4px 16px rgba(59, 130, 246, .2);
305
+ transition: box-shadow .4s;
306
+ }
307
+
308
  .crop-preview {
309
  width: 110px;
310
  height: 110px;
 
476
  pointer-events: none;
477
  }
478
 
479
+ /* ── Placeholder steps ── */
480
+ .step-list {
481
+ list-style: none;
482
+ padding: 0;
483
+ margin: 0;
484
+ text-align: left;
485
+ }
486
+
487
+ .step-list li {
488
+ display: flex;
489
+ align-items: center;
490
+ gap: 10px;
491
+ font-size: .8rem;
492
+ color: var(--muted-text);
493
+ padding: 6px 0;
494
+ }
495
+
496
+ .step-num {
497
+ width: 22px;
498
+ height: 22px;
499
+ border-radius: 50%;
500
+ background: var(--primary-pale);
501
+ color: var(--primary);
502
+ font-size: .7rem;
503
+ font-weight: 700;
504
+ display: flex;
505
+ align-items: center;
506
+ justify-content: center;
507
+ flex-shrink: 0;
508
+ }
509
+
510
+ /* ── Divider label ── */
511
+ .section-divider {
512
+ display: flex;
513
+ align-items: center;
514
+ gap: 10px;
515
+ margin: 12px 0;
516
+ }
517
+
518
+ .section-divider span {
519
+ font-size: .65rem;
520
+ font-weight: 700;
521
+ text-transform: uppercase;
522
+ letter-spacing: .08em;
523
+ color: var(--muted-text);
524
+ white-space: nowrap;
525
+ }
526
+
527
+ .section-divider::before,
528
+ .section-divider::after {
529
+ content: '';
530
+ flex: 1;
531
+ height: 1px;
532
+ background: #e2e8f0;
533
+ }
534
+
535
+ /* ── Score grid ── */
536
+ .scores-grid {
537
+ display: grid;
538
+ grid-template-columns: 1fr 1fr;
539
+ gap: 12px;
540
+ }
541
+
542
+ /* ── Lang toggle ── */
543
+ .lang-toggle {
544
+ display: inline-flex;
545
+ border: 2px solid var(--border);
546
+ border-radius: 50px;
547
+ overflow: hidden;
548
+ gap: 0;
549
+ }
550
+
551
+ .lang-btn {
552
+ background: none;
553
+ border: none;
554
+ padding: 5px 14px;
555
+ font-size: .72rem;
556
+ font-weight: 700;
557
+ color: var(--muted-text);
558
+ cursor: pointer;
559
+ transition: .18s;
560
+ letter-spacing: .04em;
561
+ }
562
+
563
+ .lang-btn.active {
564
+ background: var(--primary);
565
+ color: #fff;
566
+ }
567
+
568
+ .lang-btn:not(.active):hover {
569
+ background: var(--primary-pale);
570
+ color: var(--primary);
571
  }
572
 
573
  /* ── Animations ── */
 
604
  <body>
605
 
606
  <div class="container py-5">
607
+ <header class="text-center mb-5" style="position:relative">
608
+ <div style="position:absolute;right:0;top:0;">
609
+ <div class="lang-toggle">
610
+ <button class="lang-btn active" id="btnEN" onclick="setLang('en')">EN</button>
611
+ <button class="lang-btn" id="btnID" onclick="setLang('id')">ID</button>
612
+ </div>
613
+ </div>
614
+ <h1 class="fw-bold mb-2"><i class="fas fa-microchip me-2 text-primary"></i><span data-i18n="title">Undertone
615
+ Classification Dashboard</span></h1>
616
+ <p class="text-secondary" data-i18n="subtitle">Artificial Intelligence System Powered by ResNet50 &amp;
617
+ MobileNetV2</p>
618
  </header>
619
 
620
  <div class="row g-4">
621
  <div class="col-lg-6">
622
  <div class="glass-card p-4 h-100">
623
+ <h5 class="mb-1 fw-bold"><i class="fas fa-camera-retro me-2 text-primary"></i><span
624
+ data-i18n="inputTitle">Data Input Source</span></h5>
625
+ <p class="text-muted mb-3" style="font-size:.78rem" data-i18n="inputSubtitle">Upload a portrait or
626
+ use your live camera</p>
627
 
628
  <ul class="nav nav-tabs mb-4" id="inputTab" role="tablist">
629
  <li class="nav-item" role="presentation">
630
  <button class="nav-link active" id="gallery-tab" data-bs-toggle="tab"
631
  data-bs-target="#galleryTab" type="button" role="tab">
632
+ <i class="fas fa-image me-2"></i><span data-i18n="tabUpload">Upload Image</span>
633
  </button>
634
  </li>
635
  <li class="nav-item" role="presentation">
636
  <button class="nav-link" id="camera-tab" data-bs-toggle="tab" data-bs-target="#cameraTab"
637
  type="button" role="tab">
638
+ <i class="fas fa-video me-2"></i><span data-i18n="tabCamera">Live Camera</span>
639
  </button>
640
  </li>
641
  </ul>
642
 
643
  <div class="tab-content" id="inputTabContent">
644
  <div class="tab-pane fade show active" id="galleryTab" role="tabpanel">
645
+ <div class="drop-zone mb-1" id="dropZone">
646
+ <input type="file" id="fileInput" accept="image/*" onchange="onFileChange(event)">
647
+ <div class="drop-zone-icon"><i class="fas fa-cloud-upload-alt"></i></div>
648
+ <div class="drop-zone-text" data-i18n="dropText">Drag &amp; drop or click to browse
649
+ </div>
650
+ <div class="drop-zone-sub mt-1" data-i18n="dropSub">JPG, PNG, WEBP &bull; Portrait
651
+ recommended</div>
652
+ </div>
653
+ <div id="filePreviewWrap">
654
+ <img id="filePreview" src="" alt="Preview">
655
+ <button class="preview-remove" onclick="clearFile()" title="Remove"><i
656
+ class="fas fa-times"></i></button>
657
+ <div id="previewName" class="preview-name"></div>
658
  </div>
659
  <button id="btnGallery" onclick="uploadFile()"
660
+ class="btn btn-gradient-primary w-100 py-3 fw-bold mt-3">
661
+ <i class="fas fa-search me-2"></i><span data-i18n="btnAnalyze">Analyze Image</span>
662
  </button>
663
  </div>
664
 
 
668
  </div>
669
  <button id="btnCamera" onclick="captureCamera()"
670
  class="btn btn-gradient-success w-100 py-3 fw-bold">
671
+ <i class="fas fa-bolt me-2"></i><span data-i18n="btnCapture">CAPTURE &amp;
672
+ PROCESS</span>
673
  </button>
674
  <canvas id="canvas" style="display:none;"></canvas>
675
  </div>
 
682
  <div class="spinner-border mb-3" role="status">
683
  <span class="visually-hidden">Loading...</span>
684
  </div>
685
+ <h5 class="text-primary" data-i18n="loadingTitle">Processing Image...</h5>
686
+ <p class="text-muted small" data-i18n="loadingSub">Running Deep Learning Inference</p>
687
  </div>
688
 
689
  <div class="glass-card p-4 d-none" id="resultPanel">
690
 
691
+ <!-- β‘  Hero: image comparison + badge -->
692
+ <div class="mb-4 result-anim">
693
+ <!-- Image pair -->
694
+ <div class="img-pair mb-3">
695
+ <div class="img-slot">
696
+ <span class="img-slot-label"><i class="fas fa-image me-1"></i>Original</span>
697
+ <img id="originalImg" class="img-thumb" src="" alt="Original image">
698
+ </div>
699
+ <div class="img-slot">
700
+ <span class="img-slot-label"><i class="fas fa-crop-alt me-1"></i>ROI Crop</span>
701
+ <img id="cropImg" class="img-thumb" src="" alt="Face ROI crop">
702
+ </div>
703
+ </div>
704
+ <!-- Badge row -->
705
+ <div class="d-flex flex-column align-items-start gap-2">
706
+ <p class="text-secondary small mb-0"
707
+ style="font-size:.72rem;letter-spacing:.08em;text-transform:uppercase"
708
+ data-i18n="undertoneLabel">Undertone Detected</p>
709
+ <div id="resBadge" class="undertone-badge mb-1">β€”</div>
710
  <div id="agreepill" class="agree-pill agree-yes">
711
  <i class="fas fa-check-circle"></i> <span id="agreeText">Models agree</span>
712
  </div>
713
  </div>
714
  </div>
715
 
716
+ <!-- β‘‘ Model scores side by side -->
717
+ <div class="section-divider result-anim"><span><i class="fas fa-chart-bar me-1"></i><span
718
+ data-i18n="modelConfidence">Model Confidence</span></span></div>
719
+ <div class="scores-grid mb-3 result-anim">
720
+ <div class="model-block">
721
+ <div class="model-title"><i class="fas fa-brain me-1"></i>ResNet50</div>
722
+ <div id="resnetScores"></div>
723
  </div>
724
+ <div class="model-block">
725
+ <div class="model-title"><i class="fas fa-microchip me-1"></i>MobileNetV2</div>
726
+ <div id="mobilenetScores"></div>
 
 
727
  </div>
728
  </div>
729
 
730
  <!-- β‘’ Palette recommendation -->
731
+ <div class="section-divider result-anim"><span><i class="fas fa-palette me-1"></i><span
732
+ data-i18n="colourPalette">Colour Palette</span></span></div>
733
  <div class="model-block result-anim" id="paletteBlock">
 
734
  <div id="paletteChips" class="d-flex flex-wrap gap-2"></div>
735
  <p id="paletteDesc" class="text-secondary mt-2 mb-0" style="font-size:.78rem"></p>
736
  </div>
737
 
738
  </div>
739
 
740
+ <div id="placeholder" class="glass-card p-4 h-100 d-flex align-items-center justify-content-center">
741
+ <div style="max-width:280px;text-align:center">
742
+ <div
743
+ style="width:64px;height:64px;border-radius:50%;background:var(--primary-pale);display:flex;align-items:center;justify-content:center;margin:0 auto 16px;">
744
+ <i class="fas fa-face-smile fa-xl text-primary"></i>
745
+ </div>
746
+ <h5 class="fw-bold mb-1" style="font-size:1rem" data-i18n="phTitle">Ready for Analysis</h5>
747
+ <p class="text-muted mb-4" style="font-size:.78rem" data-i18n="phDesc">Upload a clear portrait
748
+ photo or use your camera to detect your skin undertone.</p>
749
+ <ul class="step-list">
750
+ <li><span class="step-num">1</span><span data-i18n="step1">Choose Upload Image or Live
751
+ Camera tab</span></li>
752
+ <li><span class="step-num">2</span><span data-i18n="step2">Select or capture a front-facing
753
+ portrait</span></li>
754
+ <li><span class="step-num">3</span><span data-i18n="step3">Click Analyze β€” AI detects your
755
+ undertone</span></li>
756
+ </ul>
757
  </div>
758
  </div>
759
  </div>
760
  </div>
761
  </div>
762
 
763
+ <footer class="text-center py-4 mt-4 text-muted" style="font-size: 0.85rem;">
764
+ &copy; 2026 Afina Putri Dzulqiyana. All rights reserved.
765
+ </footer>
766
+
767
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
768
 
769
  <script>
770
  const video = document.getElementById('video');
771
  const canvas = document.getElementById('canvas');
772
 
773
+ // ── i18n ─────────────────────────────────────────────────────────────
774
+ const TRANSLATIONS = {
775
+ en: {
776
+ title: 'Undertone Classification Dashboard',
777
+ subtitle: 'Artificial Intelligence System Powered by ResNet50 & MobileNetV2',
778
+ inputTitle: 'Data Input Source',
779
+ inputSubtitle: 'Upload a portrait or use your live camera',
780
+ tabUpload: 'Upload Image',
781
+ tabCamera: 'Live Camera',
782
+ dropText: 'Drag & drop or click to browse',
783
+ dropSub: 'JPG, PNG, WEBP β€’ Portrait recommended',
784
+ btnAnalyze: 'Analyze Image',
785
+ btnCapture: 'Capture & Analyze',
786
+ loadingTitle: 'Processing Image...',
787
+ loadingSub: 'Running Deep Learning Inference',
788
+ undertoneLabel: 'Undertone Detected',
789
+ modelConfidence: 'Model Confidence',
790
+ colourPalette: 'Colour Palette',
791
+ phTitle: 'Ready for Analysis',
792
+ phDesc: 'Upload a clear portrait photo or use your camera to detect your skin undertone.',
793
+ step1: 'Choose Upload Image or Live Camera tab',
794
+ step2: 'Select or capture a front-facing portrait',
795
+ step3: 'Click Analyze β€” AI detects your undertone',
796
+ agreeYes: 'Both models agree',
797
+ agreeNo: (r, m) => `ResNet: ${r} Β· MobileNet: ${m}`,
798
+ alertNoFile: 'Select an image first',
799
+ alertServer: 'Server error',
800
+ },
801
+ id: {
802
+ title: 'Dashboard Klasifikasi Undertone',
803
+ subtitle: 'Sistem Kecerdasan Buatan Berbasis ResNet50 & MobileNetV2',
804
+ inputTitle: 'Sumber Data Input',
805
+ inputSubtitle: 'Unggah foto wajah atau gunakan kamera langsung',
806
+ tabUpload: 'Unggah Gambar',
807
+ tabCamera: 'Kamera Langsung',
808
+ dropText: 'Seret & lepas atau klik untuk memilih',
809
+ dropSub: 'JPG, PNG, WEBP β€’ Disarankan foto wajah',
810
+ btnAnalyze: 'Analisis Gambar',
811
+ btnCapture: 'Tangkap & Analisis',
812
+ loadingTitle: 'Memproses Gambar...',
813
+ loadingSub: 'Menjalankan Inferensi Deep Learning',
814
+ undertoneLabel: 'Undertone Terdeteksi',
815
+ modelConfidence: 'Kepercayaan Model',
816
+ colourPalette: 'Palet Warna',
817
+ phTitle: 'Siap untuk Analisis',
818
+ phDesc: 'Unggah foto wajah yang jelas atau gunakan kamera untuk mendeteksi undertone kulit Anda.',
819
+ step1: 'Pilih tab Unggah Gambar atau Kamera Langsung',
820
+ step2: 'Pilih atau ambil foto wajah menghadap ke depan',
821
+ step3: 'Klik Analisis β€” AI mendeteksi undertone Anda',
822
+ agreeYes: 'Kedua model setuju',
823
+ agreeNo: (r, m) => `ResNet: ${r} Β· MobileNet: ${m}`,
824
+ alertNoFile: 'Pilih gambar terlebih dahulu',
825
+ alertServer: 'Kesalahan server',
826
+ }
827
+ };
828
+
829
+ let currentLang = 'en';
830
+
831
+ function setLang(lang) {
832
+ currentLang = lang;
833
+ const t = TRANSLATIONS[lang];
834
+ document.querySelectorAll('[data-i18n]').forEach(el => {
835
+ const key = el.getAttribute('data-i18n');
836
+ if (t[key] && typeof t[key] === 'string') el.textContent = t[key];
837
+ });
838
+ document.getElementById('btnEN').classList.toggle('active', lang === 'en');
839
+ document.getElementById('btnID').classList.toggle('active', lang === 'id');
840
+ document.documentElement.lang = lang === 'id' ? 'id' : 'en';
841
+ }
842
+
843
  // ── Palette data per undertone ──────────────────────────────────────
844
  const PALETTES = {
845
  cool: {
 
892
  }
893
  };
894
 
895
+ // ── Drag-drop ────────────────────────────────────────────────────────
896
+ const dropZone = document.getElementById('dropZone');
897
+ dropZone.addEventListener('dragover', e => { e.preventDefault(); dropZone.classList.add('drag-over'); });
898
+ dropZone.addEventListener('dragleave', () => dropZone.classList.remove('drag-over'));
899
+ dropZone.addEventListener('drop', e => { e.preventDefault(); dropZone.classList.remove('drag-over'); if (e.dataTransfer.files[0]) { document.getElementById('fileInput').files = e.dataTransfer.files; onFileChange({ target: { files: e.dataTransfer.files } }); } });
900
+
901
+ function onFileChange(e) {
902
+ const file = e.target.files[0];
903
+ if (!file) return;
904
+ const wrap = document.getElementById('filePreviewWrap');
905
+ document.getElementById('filePreview').src = URL.createObjectURL(file);
906
+ document.getElementById('previewName').textContent = file.name;
907
+ wrap.style.display = 'block';
908
+ }
909
+
910
+ function clearFile() {
911
+ document.getElementById('fileInput').value = '';
912
+ document.getElementById('filePreviewWrap').style.display = 'none';
913
+ document.getElementById('filePreview').src = '';
914
+ }
915
+
916
  // ── Camera Init ─────────────────────────────────────────────────────
917
  document.getElementById('camera-tab').addEventListener('shown.bs.tab', () => {
918
  if (!video.srcObject)
919
+ navigator.mediaDevices.getUserMedia({ video: true }).then(s => { video.srcObject = s; document.getElementById('camBadge').classList.remove('d-none'); });
920
+ });
921
+ document.getElementById('gallery-tab').addEventListener('shown.bs.tab', () => {
922
+ if (video.srcObject) { video.srcObject.getTracks().forEach(t => t.stop()); video.srcObject = null; document.getElementById('camBadge').classList.add('d-none'); }
923
  });
924
 
925
  // ── Loading toggle ──────────────────────────────────────────────────
 
976
  const palette = PALETTES[resLabel] || PALETTES['neutral'];
977
  const displayLabel = palette.label; // Title-case: 'Cool'
978
 
979
+ // Original image
980
+ const originalImg = document.getElementById('originalImg');
981
+ originalImg.src = data.original_b64;
982
+ originalImg.style.boxShadow = `0 0 0 3px ${palette.ringColor}55, 0 4px 16px rgba(0,0,0,.12)`;
983
+
984
  // Crop image + ring glow colour
985
  const cropImg = document.getElementById('cropImg');
986
+ cropImg.src = data.crop_b64;
987
  cropImg.style.setProperty('--ring-color', palette.ringColor);
988
+ cropImg.style.boxShadow = `0 0 0 3px ${palette.ringColor}, 0 0 24px ${palette.ringColor}55`;
989
 
990
  // Badge
991
  const badge = document.getElementById('resBadge');
 
998
  if (agree) {
999
  pill.className = 'agree-pill agree-yes';
1000
  pill.querySelector('i').className = 'fas fa-check-circle';
1001
+ agreeText.textContent = TRANSLATIONS[currentLang].agreeYes;
1002
  } else {
1003
  pill.className = 'agree-pill agree-no';
1004
  pill.querySelector('i').className = 'fas fa-exclamation-circle';
1005
  const mobDisplay = (PALETTES[mobLabel] || PALETTES['neutral']).label;
1006
+ agreeText.textContent = TRANSLATIONS[currentLang].agreeNo(displayLabel, mobDisplay);
1007
  }
1008
 
1009
  // Score bars
 
1023
  // ── Upload ──────────────────────────────────────────────────────────
1024
  async function uploadFile() {
1025
  const file = document.getElementById('fileInput').files[0];
1026
+ if (!file) return alert(TRANSLATIONS[currentLang].alertNoFile);
1027
  toggleLoading(true);
1028
  const fd = new FormData();
1029
  fd.append('file', file);
 
1032
  const data = await res.json();
1033
  if (res.ok) handleResponse(data);
1034
  else { alert(data.error); toggleLoading(false); document.getElementById('placeholder').classList.remove('d-none'); }
1035
+ } catch { alert(TRANSLATIONS[currentLang].alertServer); toggleLoading(false); }
1036
  }
1037
 
1038
  // ── Camera capture ──────────────────────────────────────────���───────
 
1050
  const data = await res.json();
1051
  if (res.ok) handleResponse(data);
1052
  else { alert(data.error); toggleLoading(false); document.getElementById('placeholder').classList.remove('d-none'); }
1053
+ } catch { alert(TRANSLATIONS[currentLang].alertServer); toggleLoading(false); }
1054
  }
1055
  </script>
1056
  </body>