koesan commited on
Commit
90f9a3f
·
verified ·
1 Parent(s): ceaa0d7

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +119 -1
templates/index.html CHANGED
@@ -66,6 +66,71 @@
66
  line-height: 1.8;
67
  }
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  .upload-section {
70
  text-align: center;
71
  padding: 40px;
@@ -284,6 +349,14 @@
284
  <div class="info-box">
285
  <h3>🤖 About the Model</h3>
286
  <p>This tool uses an integrated ensemble of VGG16 and ResNet50V2 deep learning models trained on the CBIS-DDSM dataset. The model combines transfer learning with custom classification layers to analyze mammogram images and predict breast cancer classification.</p>
 
 
 
 
 
 
 
 
287
  </div>
288
 
289
  <div class="error" id="errorMessage"></div>
@@ -296,6 +369,9 @@
296
  <button class="upload-button" onclick="document.getElementById('fileInput').click()">
297
  Choose File
298
  </button>
 
 
 
299
  </div>
300
 
301
  <div class="preview-section" id="previewSection">
@@ -314,6 +390,10 @@
314
  </div>
315
 
316
  <div class="result-section" id="resultSection">
 
 
 
 
317
  <div class="result-title" id="resultTitle"></div>
318
  <div class="confidence-bar">
319
  <div class="confidence-fill" id="confidenceFill"></div>
@@ -424,12 +504,50 @@
424
  }
425
  }
426
 
427
- function showResult(data) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
  const resultSection = document.getElementById('resultSection');
429
  const resultTitle = document.getElementById('resultTitle');
430
  const confidenceFill = document.getElementById('confidenceFill');
431
  const benignProb = document.getElementById('benignProb');
432
  const malignantProb = document.getElementById('malignantProb');
 
 
 
 
 
 
 
 
 
 
 
 
433
 
434
  // Update content
435
  resultTitle.textContent = `Classification: ${data.class}`;
 
66
  line-height: 1.8;
67
  }
68
 
69
+ .github-link {
70
+ display: inline-flex;
71
+ align-items: center;
72
+ gap: 8px;
73
+ color: #667eea;
74
+ text-decoration: none;
75
+ font-weight: 600;
76
+ font-size: 1.1em;
77
+ padding: 10px 20px;
78
+ background: white;
79
+ border: 2px solid #667eea;
80
+ border-radius: 8px;
81
+ transition: all 0.3s;
82
+ margin: 20px 0;
83
+ }
84
+
85
+ .github-link:hover {
86
+ transform: translateY(-2px);
87
+ box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
88
+ background: #667eea;
89
+ color: white;
90
+ }
91
+
92
+ .test-button {
93
+ background: #6c757d;
94
+ color: white;
95
+ padding: 12px 30px;
96
+ border: none;
97
+ border-radius: 25px;
98
+ font-size: 1.1em;
99
+ cursor: pointer;
100
+ transition: transform 0.2s;
101
+ margin-left: 10px;
102
+ }
103
+
104
+ .test-button:hover {
105
+ background: #5a6268;
106
+ transform: scale(1.05);
107
+ }
108
+
109
+ .result-image-container {
110
+ position: relative;
111
+ margin-bottom: 20px;
112
+ }
113
+
114
+ .result-image {
115
+ max-width: 100%;
116
+ max-height: 300px;
117
+ border-radius: 10px;
118
+ box-shadow: 0 5px 15px rgba(0,0,0,0.2);
119
+ }
120
+
121
+ .result-overlay {
122
+ position: absolute;
123
+ top: 10px;
124
+ left: 50%;
125
+ transform: translateX(-50%);
126
+ background: rgba(0, 0, 0, 0.8);
127
+ color: white;
128
+ padding: 10px 20px;
129
+ border-radius: 8px;
130
+ font-size: 1.2em;
131
+ font-weight: bold;
132
+ }
133
+
134
  .upload-section {
135
  text-align: center;
136
  padding: 40px;
 
349
  <div class="info-box">
350
  <h3>🤖 About the Model</h3>
351
  <p>This tool uses an integrated ensemble of VGG16 and ResNet50V2 deep learning models trained on the CBIS-DDSM dataset. The model combines transfer learning with custom classification layers to analyze mammogram images and predict breast cancer classification.</p>
352
+ <div style="margin-top: 15px;">
353
+ <a href="https://github.com/koesan/Breast_Cancer_Classification" target="_blank" class="github-link">
354
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
355
+ <path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
356
+ </svg>
357
+ View on GitHub
358
+ </a>
359
+ </div>
360
  </div>
361
 
362
  <div class="error" id="errorMessage"></div>
 
369
  <button class="upload-button" onclick="document.getElementById('fileInput').click()">
370
  Choose File
371
  </button>
372
+ <button class="test-button" onclick="testExample()">
373
+ 🧪 Test Example
374
+ </button>
375
  </div>
376
 
377
  <div class="preview-section" id="previewSection">
 
390
  </div>
391
 
392
  <div class="result-section" id="resultSection">
393
+ <div class="result-image-container" id="resultImageContainer" style="display: none;">
394
+ <img id="resultImage" class="result-image" alt="Result">
395
+ <div class="result-overlay" id="resultOverlay"></div>
396
+ </div>
397
  <div class="result-title" id="resultTitle"></div>
398
  <div class="confidence-bar">
399
  <div class="confidence-fill" id="confidenceFill"></div>
 
504
  }
505
  }
506
 
507
+ function testExample() {
508
+ // Show loading
509
+ document.getElementById('loading').style.display = 'block';
510
+ document.getElementById('uploadSection').style.display = 'none';
511
+ document.getElementById('previewSection').style.display = 'none';
512
+ document.getElementById('resultSection').style.display = 'none';
513
+ document.getElementById('errorMessage').style.display = 'none';
514
+
515
+ fetch('/test-example', {
516
+ method: 'POST'
517
+ })
518
+ .then(response => response.json())
519
+ .then(data => {
520
+ document.getElementById('loading').style.display = 'none';
521
+ if (data.error) {
522
+ showError(data.error);
523
+ } else {
524
+ showResult(data, true);
525
+ }
526
+ })
527
+ .catch(error => {
528
+ document.getElementById('loading').style.display = 'none';
529
+ showError('Failed to analyze example: ' + error.message);
530
+ });
531
+ }
532
+
533
+ function showResult(data, showImage = false) {
534
  const resultSection = document.getElementById('resultSection');
535
  const resultTitle = document.getElementById('resultTitle');
536
  const confidenceFill = document.getElementById('confidenceFill');
537
  const benignProb = document.getElementById('benignProb');
538
  const malignantProb = document.getElementById('malignantProb');
539
+ const resultImageContainer = document.getElementById('resultImageContainer');
540
+ const resultImage = document.getElementById('resultImage');
541
+ const resultOverlay = document.getElementById('resultOverlay');
542
+
543
+ // Show image if available
544
+ if (showImage && data.image) {
545
+ resultImage.src = data.image;
546
+ resultOverlay.textContent = data.class;
547
+ resultImageContainer.style.display = 'block';
548
+ } else {
549
+ resultImageContainer.style.display = 'none';
550
+ }
551
 
552
  // Update content
553
  resultTitle.textContent = `Classification: ${data.class}`;