dcavadia commited on
Commit
f1f5de1
Β·
1 Parent(s): 25cc2b8

update gradio style

Browse files
Files changed (1) hide show
  1. src/ui/styles.py +109 -39
src/ui/styles.py CHANGED
@@ -21,6 +21,35 @@ def get_custom_css() -> str:
21
  .gradio-container { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; }
22
  .gr-button { transition: all 0.2s ease; }
23
  .gr-button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  """
25
 
26
  def create_theme():
@@ -38,27 +67,42 @@ def create_theme():
38
  def get_header_html() -> str:
39
  """Get HTML for application header."""
40
  return """
41
- <div class="header">
42
- <h1 style="margin:0;">πŸ”¬ MelanoScope AI</h1>
43
- <span class="badge">Research Project</span>
44
- <span class="badge">Live Demo</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  </div>
46
- <h3 style="color: #475569; margin: 8px 0;">Advanced CNN-based Dermatoscopic Image Classification System</h3>
47
-
48
- <p style="color: #64748b; margin: 12px 0; font-size: 14px;">
49
- <strong>πŸŽ“ Research Institution:</strong> Universidad Central de Venezuela &nbsp;|&nbsp;
50
- <strong>πŸ”¬ Domain:</strong> Computer Vision in Medical Diagnostics &nbsp;|&nbsp;
51
- <strong>🎯 Achievement:</strong> 94% Classification Accuracy
52
- </p>
53
-
54
- <p style="color: #374151; margin: 12px 0;">
55
- Upload a dermatoscopic image to experience real-time CNN inference with comprehensive medical information retrieval.
56
- This system demonstrates production-ready AI deployment with sub-second latency and clinical-grade accuracy.
57
- </p>
58
-
59
- <p style="color: #dc2626; font-size: 13px; font-weight: 500; margin: 8px 0;">
60
- ⚠️ Research prototype β€’ Not for clinical diagnosis β€’ Educational purposes only
61
- </p>
62
  """
63
 
64
  def get_footer_html() -> str:
@@ -66,21 +110,45 @@ def get_footer_html() -> str:
66
  from ..config.settings import AppConfig
67
 
68
  return f"""
69
- <div style="text-align: center; padding: 20px; background: #f8fafc; border-radius: 8px; margin-top: 20px;">
70
- <p style="margin: 0 0 8px 0; color: #1e293b; font-weight: 600;">πŸŽ“ Academic Research Project</p>
71
- <p style="margin: 0 0 8px 0; font-size: 13px; color: #64748b;">
72
- <strong>Institution:</strong> {AppConfig.INSTITUTION} &nbsp;|&nbsp;
73
- <strong>Focus:</strong> Deep Learning in Medical Imaging &nbsp;|&nbsp;
74
- <strong>Thesis:</strong> CNN Architecture Optimization
75
- </p>
76
- <p style="margin: 0 0 8px 0; font-size: 13px; color: #64748b;">
77
- <strong>Technical:</strong> NFNet-L0 β†’ ONNX (3.2M params) &nbsp;|&nbsp;
78
- <strong>Performance:</strong> 94% accuracy, <50ms latency &nbsp;|&nbsp;
79
- <strong>Stack:</strong> Gradio + HuggingFace Spaces
80
- </p>
81
- <p style="margin: 0; font-size: 11px; color: #94a3b8;">
82
- Model v{AppConfig.VERSION} β€’ Updated {AppConfig.LAST_UPDATE} β€’ Research & Development by Daniel Cavadia
83
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  </div>
85
  """
86
 
@@ -88,9 +156,11 @@ def get_model_info_html() -> str:
88
  """Get HTML for model information."""
89
  from ..config.settings import AppConfig
90
  return (
91
- "- <strong>Architecture:</strong> NFNet CNN exported to ONNX format<br>"
92
- "- <strong>Training:</strong> Dermatoscopic dataset with data augmentation<br>"
93
- "- <strong>Optimization:</strong> Model quantization and runtime acceleration<br>"
94
- "- <strong>Deployment:</strong> Production-ready inference pipeline<br><br>"
 
 
95
  f"<em style='color: #dc2626;'>{AppConfig.MEDICAL_DISCLAIMER}</em>"
96
  )
 
21
  .gradio-container { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; }
22
  .gr-button { transition: all 0.2s ease; }
23
  .gr-button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
24
+
25
+ /* Professional header styling */
26
+ .project-header {
27
+ background: linear-gradient(135deg, #f8fafc, #f1f5f9);
28
+ padding: 20px;
29
+ border-radius: 12px;
30
+ border-left: 4px solid #e11d48;
31
+ margin-bottom: 20px;
32
+ }
33
+ .research-badge {
34
+ display: inline-block;
35
+ background: #dcfce7;
36
+ color: #166534;
37
+ padding: 4px 12px;
38
+ border-radius: 20px;
39
+ font-size: 12px;
40
+ font-weight: 600;
41
+ margin-left: 12px;
42
+ }
43
+ .demo-badge {
44
+ display: inline-block;
45
+ background: #fef3c7;
46
+ color: #92400e;
47
+ padding: 4px 12px;
48
+ border-radius: 20px;
49
+ font-size: 12px;
50
+ font-weight: 600;
51
+ margin-left: 8px;
52
+ }
53
  """
54
 
55
  def create_theme():
 
67
  def get_header_html() -> str:
68
  """Get HTML for application header."""
69
  return """
70
+ <div class="project-header">
71
+ <h1 style="margin: 0; color: #1e293b; font-size: 28px;">
72
+ πŸ”¬ MelanoScope AI
73
+ <span class="research-badge">UCV Thesis Research</span>
74
+ <span class="demo-badge">Production Ready</span>
75
+ </h1>
76
+
77
+ <h2 style="margin: 12px 0 8px 0; color: #475569; font-size: 18px; font-weight: 500;">
78
+ NFNet-L0 Convolutional Neural Network for Dermatoscopic Image Classification
79
+ </h2>
80
+
81
+ <p style="margin: 16px 0; color: #64748b; font-size: 14px; line-height: 1.6;">
82
+ <strong>πŸŽ“ Institution:</strong> Universidad Central de Venezuela &nbsp;β€’&nbsp;
83
+ <strong>🧠 Architecture:</strong> NFNet-L0 + Weight Standardization &nbsp;β€’&nbsp;
84
+ <strong>🎯 Validation Accuracy:</strong> 96.17% (0.961718) &nbsp;β€’&nbsp;
85
+ <strong>⚑ Optimization:</strong> ONNX Runtime Deployment
86
+ </p>
87
+
88
+ <p style="margin: 16px 0; color: #64748b; font-size: 14px; line-height: 1.6;">
89
+ <strong>πŸ“Š F1-Score:</strong> 0.96 &nbsp;β€’&nbsp;
90
+ <strong>πŸ” Specificity:</strong> 1.0 (Perfect) &nbsp;β€’&nbsp;
91
+ <strong>πŸ’Ύ Model Size:</strong> 24.1M parameters &nbsp;β€’&nbsp;
92
+ <strong>πŸš€ Inference:</strong> Sub-second latency
93
+ </p>
94
+
95
+ <p style="margin: 16px 0 8px 0; color: #374151; font-size: 14px; line-height: 1.6;">
96
+ <strong>Upload a dermatoscopic image</strong> to experience real-time CNN inference with
97
+ comprehensive medical information retrieval. This research prototype demonstrates
98
+ advanced deep learning techniques including <em>Cross Entropy Loss optimization</em>,
99
+ <em>Adam optimizer fine-tuning</em>, and <em>data augmentation strategies</em>.
100
+ </p>
101
+
102
+ <p style="margin: 8px 0 0 0; color: #dc2626; font-size: 13px; font-weight: 500;">
103
+ ⚠️ UCV Research Prototype β€’ Not for clinical diagnosis β€’ Educational purposes only
104
+ </p>
105
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  """
107
 
108
  def get_footer_html() -> str:
 
110
  from ..config.settings import AppConfig
111
 
112
  return f"""
113
+ <div style="background: #f8fafc; padding: 20px; border-radius: 12px; margin-top: 24px; text-align: center;">
114
+
115
+ <div style="display: flex; justify-content: space-around; flex-wrap: wrap; gap: 20px; margin-bottom: 16px;">
116
+
117
+ <div style="min-width: 200px;">
118
+ <h4 style="color: #1e293b; margin: 0 0 8px 0; font-size: 14px;">πŸŽ“ Academic Research</h4>
119
+ <p style="margin: 0; font-size: 12px; color: #64748b; line-height: 1.4;">
120
+ <strong>Institution:</strong> {AppConfig.INSTITUTION}<br>
121
+ <strong>Thesis Advisor:</strong> Dra. Margarita Oliver Lull<br>
122
+ <strong>Research Focus:</strong> CNN Architecture Optimization
123
+ </p>
124
+ </div>
125
+
126
+ <div style="min-width: 200px;">
127
+ <h4 style="color: #1e293b; margin: 0 0 8px 0; font-size: 14px;">βš™οΈ Technical Implementation</h4>
128
+ <p style="margin: 0; font-size: 12px; color: #64748b; line-height: 1.4;">
129
+ <strong>Architecture:</strong> NFNet-L0 (24.1M params)<br>
130
+ <strong>Optimization:</strong> Weight Standardization + Adam<br>
131
+ <strong>Dataset:</strong> ISIC + Clinical Images (22,618 total)
132
+ </p>
133
+ </div>
134
+
135
+ <div style="min-width: 200px;">
136
+ <h4 style="color: #1e293b; margin: 0 0 8px 0; font-size: 14px;">πŸ“Š Performance Metrics</h4>
137
+ <p style="margin: 0; font-size: 12px; color: #64748b; line-height: 1.4;">
138
+ <strong>Precision:</strong> 96.0% &nbsp;β€’&nbsp; <strong>Recall:</strong> 96.0%<br>
139
+ <strong>F1-Score:</strong> 0.96 &nbsp;β€’&nbsp; <strong>Specificity:</strong> 1.0<br>
140
+ <strong>Cross Entropy Loss:</strong> 0.122597 (final)
141
+ </p>
142
+ </div>
143
+
144
+ </div>
145
+
146
+ <div style="border-top: 1px solid #e2e8f0; padding-top: 12px;">
147
+ <p style="margin: 0; font-size: 11px; color: #94a3b8;">
148
+ Model Version: {AppConfig.VERSION} β€’ Last Updated: {AppConfig.LAST_UPDATE} β€’
149
+ Research & Development by Daniel Cavadia β€’ TEG UCV 2025
150
+ </p>
151
+ </div>
152
  </div>
153
  """
154
 
 
156
  """Get HTML for model information."""
157
  from ..config.settings import AppConfig
158
  return (
159
+ "- <strong>Base Architecture:</strong> NFNet-L0 pre-trained on ImageNet-1k<br>"
160
+ "- <strong>Training Strategy:</strong> Fine-tuning with frozen layers + adaptive unfreezing<br>"
161
+ "- <strong>Data Augmentation:</strong> Rotations, lighting adjustments, geometric distortions<br>"
162
+ "- <strong>Loss Function:</strong> Cross Entropy Loss Flat with Adam optimizer<br>"
163
+ "- <strong>Validation Protocol:</strong> Stratified train/validation split with confusion matrix analysis<br>"
164
+ "- <strong>Export Format:</strong> ONNX (Open Neural Network Exchange) for production deployment<br><br>"
165
  f"<em style='color: #dc2626;'>{AppConfig.MEDICAL_DISCLAIMER}</em>"
166
  )