a1c00l commited on
Commit
b3b6bc5
·
verified ·
1 Parent(s): 80e0598

Delete templates/improved_scoring_template.html

Browse files
templates/improved_scoring_template.html DELETED
@@ -1,262 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>AIBOM Generated - Improved Scoring</title>
6
- <style>
7
- body { font-family: Arial, sans-serif; margin: 20px; color: #333; }
8
- h2, h3 { color: #2c3e50; }
9
-
10
- /* Table styles */
11
- table { border-collapse: collapse; width: 100%; margin: 15px 0 25px 0; }
12
- th, td { border: 1px solid #ddd; padding: 12px; text-align: left; }
13
- th { background-color: #f4f4f4; }
14
-
15
- /* Progress bar styles */
16
- .progress-container {
17
- width: 100%;
18
- background-color: #f1f1f1;
19
- border-radius: 5px;
20
- margin: 5px 0;
21
- }
22
- .progress-bar {
23
- height: 24px;
24
- border-radius: 5px;
25
- display: flex;
26
- align-items: center;
27
- justify-content: center;
28
- color: white;
29
- font-weight: bold;
30
- transition: width 1s;
31
- }
32
- .excellent { background-color: #27ae60; }
33
- .good { background-color: #2980b9; }
34
- .fair { background-color: #f39c12; }
35
- .poor { background-color: #e74c3c; }
36
-
37
- /* Field checklist styles */
38
- .field-list { list-style: none; padding-left: 0; }
39
- .missing { color: #e74c3c; }
40
- .present { color: #27ae60; }
41
-
42
- /* Improvement section styles */
43
- .improvement {
44
- color: #2c3e50;
45
- background-color: #ecf0f1;
46
- padding: 15px;
47
- border-radius: 5px;
48
- margin-bottom: 20px;
49
- }
50
- .improvement-value { color: #27ae60; font-weight: bold; }
51
- .ai-badge {
52
- background-color: #3498db;
53
- color: white;
54
- padding: 3px 8px;
55
- border-radius: 3px;
56
- font-size: 0.8em;
57
- margin-left: 10px;
58
- }
59
-
60
- /* Score explanation styles */
61
- .score-explanation {
62
- background-color: #f8f9fa;
63
- border: 1px solid #e9ecef;
64
- border-radius: 5px;
65
- padding: 15px;
66
- margin: 20px 0;
67
- }
68
- .calculation-step {
69
- font-family: monospace;
70
- margin: 5px 0;
71
- }
72
- .weight-indicator {
73
- font-size: 0.9em;
74
- color: #7f8c8d;
75
- margin-left: 5px;
76
- }
77
-
78
- /* Collapsible section styles */
79
- .collapsible {
80
- background-color: #f1f1f1;
81
- color: #444;
82
- cursor: pointer;
83
- padding: 18px;
84
- width: 100%;
85
- border: none;
86
- text-align: left;
87
- outline: none;
88
- font-size: 15px;
89
- border-radius: 5px;
90
- margin: 10px 0;
91
- }
92
- .active, .collapsible:hover {
93
- background-color: #e0e0e0;
94
- }
95
- .content {
96
- padding: 0 18px;
97
- max-height: 0;
98
- overflow: hidden;
99
- transition: max-height 0.2s ease-out;
100
- background-color: #f9f9f9;
101
- border-radius: 0 0 5px 5px;
102
- }
103
- </style>
104
- </head>
105
- <body>
106
- <a href="/">Generate another AI SBOM</a>
107
- <h2>AI SBOM Generated for {{ model_id }}</h2>
108
-
109
- {% if enhancement_report and enhancement_report.ai_enhanced %}
110
- <div class="improvement">
111
- <h3>AI Enhancement Results</h3>
112
- <p>This AIBOM was enhanced using <strong>{{ enhancement_report.ai_model }}</strong></p>
113
-
114
- <p>Original Score:
115
- <div class="progress-container">
116
- <div class="progress-bar {% if enhancement_report.original_score.total_score >= 80 %}excellent{% elif enhancement_report.original_score.total_score >= 60 %}good{% elif enhancement_report.original_score.total_score >= 40 %}fair{% else %}poor{% endif %}"
117
- style="width: {{ enhancement_report.original_score.total_score }}%">
118
- {{ enhancement_report.original_score.total_score }}%
119
- </div>
120
- </div>
121
- </p>
122
-
123
- <p>Enhanced Score:
124
- <div class="progress-container">
125
- <div class="progress-bar {% if enhancement_report.final_score.total_score >= 80 %}excellent{% elif enhancement_report.final_score.total_score >= 60 %}good{% elif enhancement_report.final_score.total_score >= 40 %}fair{% else %}poor{% endif %}"
126
- style="width: {{ enhancement_report.final_score.total_score }}%">
127
- {{ enhancement_report.final_score.total_score }}%
128
- </div>
129
- </div>
130
- </p>
131
-
132
- <p>Improvement: <span class="improvement-value">+{{ enhancement_report.improvement }} points</span></p>
133
- </div>
134
- {% endif %}
135
-
136
- <h3>Overall AIBOM Completeness
137
- {% if enhancement_report and enhancement_report.ai_enhanced %}
138
- <span class="ai-badge">AI Enhanced</span>
139
- {% endif %}
140
- </h3>
141
-
142
- <div class="progress-container">
143
- <div class="progress-bar {% if completeness_score.total_score >= 80 %}excellent{% elif completeness_score.total_score >= 60 %}good{% elif completeness_score.total_score >= 40 %}fair{% else %}poor{% endif %}"
144
- style="width: {{ completeness_score.total_score }}%">
145
- {{ completeness_score.total_score }}%
146
- </div>
147
- </div>
148
-
149
- <p>
150
- {% if completeness_score.total_score >= 80 %}
151
- <strong>Excellent:</strong> This AIBOM is very comprehensive and provides thorough documentation.
152
- {% elif completeness_score.total_score >= 60 %}
153
- <strong>Good:</strong> This AIBOM contains most essential information but could be improved.
154
- {% elif completeness_score.total_score >= 40 %}
155
- <strong>Fair:</strong> This AIBOM has basic information but is missing several important details.
156
- {% else %}
157
- <strong>Needs Improvement:</strong> This AIBOM is missing critical information and requires significant enhancement.
158
- {% endif %}
159
- </p>
160
-
161
- <h3>Section Completion</h3>
162
- <table>
163
- <thead>
164
- <tr>
165
- <th>Section</th>
166
- <th>Completion</th>
167
- <th>Weight</th>
168
- <th>Contribution</th>
169
- </tr>
170
- </thead>
171
- <tbody>
172
- {% for section, score in completeness_score.section_scores.items() %}
173
- {% set max_score = completeness_score.max_scores[section] %}
174
- {% set percentage = (score / max_score * 100) | round %}
175
- {% set weight = 0.2 if section == 'required_fields' else 0.2 if section == 'metadata' else 0.2 if section == 'component_basic' else 0.3 if section == 'component_model_card' else 0.1 %}
176
- {% set contribution = (score * weight) | round(1) %}
177
- <tr>
178
- <td>{{ section | replace('_', ' ') | title }}</td>
179
- <td>
180
- <div class="progress-container">
181
- <div class="progress-bar {% if percentage >= 80 %}excellent{% elif percentage >= 60 %}good{% elif percentage >= 40 %}fair{% else %}poor{% endif %}"
182
- style="width: {{ percentage }}%">
183
- {{ score }}/{{ max_score }} ({{ percentage }}%)
184
- </div>
185
- </div>
186
- </td>
187
- <td>{{ (weight * 100) | int }}%</td>
188
- <td>{{ contribution }} points</td>
189
- </tr>
190
- {% endfor %}
191
- </tbody>
192
- </table>
193
-
194
- <button class="collapsible">How is the score calculated?</button>
195
- <div class="content">
196
- <div class="score-explanation">
197
- <h4>Score Calculation Breakdown</h4>
198
- <p>The overall score is a weighted average of section scores:</p>
199
-
200
- <div class="calculation-step">Required Fields: {{ completeness_score.section_scores.required_fields }} × 0.20 = {{ (completeness_score.section_scores.required_fields * 0.2) | round(1) }} points</div>
201
- <div class="calculation-step">Metadata: {{ completeness_score.section_scores.metadata }} × 0.20 = {{ (completeness_score.section_scores.metadata * 0.2) | round(1) }} points</div>
202
- <div class="calculation-step">Component Basic: {{ completeness_score.section_scores.component_basic }} × 0.20 = {{ (completeness_score.section_scores.component_basic * 0.2) | round(1) }} points</div>
203
- <div class="calculation-step">Model Card: {{ completeness_score.section_scores.component_model_card }} × 0.30 = {{ (completeness_score.section_scores.component_model_card * 0.3) | round(1) }} points</div>
204
- <div class="calculation-step">External References: {{ completeness_score.section_scores.external_references }} × 0.10 = {{ (completeness_score.section_scores.external_references * 0.1) | round(1) }} points</div>
205
- <div class="calculation-step"><strong>Total: {{ completeness_score.total_score }} points</strong></div>
206
-
207
- <p>Each section has a different weight in the final calculation to reflect its importance:</p>
208
- <ul>
209
- <li>Required Fields: 20% weight</li>
210
- <li>Metadata: 20% weight</li>
211
- <li>Component Basic: 20% weight</li>
212
- <li>Model Card: 30% weight (higher weight as it contains critical AI information)</li>
213
- <li>External References: 10% weight</li>
214
- </ul>
215
- </div>
216
- </div>
217
-
218
- <h3>Field Checklist</h3>
219
- <ul class="field-list">
220
- {% for field, status in completeness_score.field_checklist.items() %}
221
- {% if status == "✔" %}
222
- <li class="present">{{ status }} {{ field }}</li>
223
- {% else %}
224
- <li class="missing">{{ status }} {{ field }}</li>
225
- {% endif %}
226
- {% endfor %}
227
- </ul>
228
-
229
- <h3>
230
- Download AI SBOM in CycloneDX format for {{ model_id }}
231
- <button onclick="downloadJSON()">Download JSON</button>
232
- </h3>
233
-
234
- <pre id="aibom-json">{{ aibom | tojson(indent=2) }}</pre>
235
-
236
- <script>
237
- function downloadJSON() {
238
- const dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(document.getElementById('aibom-json').textContent);
239
- const downloadAnchorNode = document.createElement('a');
240
- downloadAnchorNode.setAttribute("href", dataStr);
241
- downloadAnchorNode.setAttribute("download", "{{ model_id }}-aibom.json");
242
- document.body.appendChild(downloadAnchorNode);
243
- downloadAnchorNode.click();
244
- downloadAnchorNode.remove();
245
- }
246
-
247
- // Collapsible sections
248
- var coll = document.getElementsByClassName("collapsible");
249
- for (var i = 0; i < coll.length; i++) {
250
- coll[i].addEventListener("click", function() {
251
- this.classList.toggle("active");
252
- var content = this.nextElementSibling;
253
- if (content.style.maxHeight) {
254
- content.style.maxHeight = null;
255
- } else {
256
- content.style.maxHeight = content.scrollHeight + "px";
257
- }
258
- });
259
- }
260
- </script>
261
- </body>
262
- </html>