a1c00l commited on
Commit
18d7601
·
verified ·
1 Parent(s): ca14630

Delete src/aibom-generator/improved_score_renderer.py

Browse files
src/aibom-generator/improved_score_renderer.py DELETED
@@ -1,55 +0,0 @@
1
- import json
2
- from typing import Dict, Optional, Any
3
- from jinja2 import Template
4
-
5
- def render_improved_score_template(model_id: str, aibom: Dict[str, Any], completeness_score: Dict[str, Any], enhancement_report: Optional[Dict[str, Any]] = None) -> str:
6
- """
7
- Render the improved scoring HTML template with AIBOM data and enhancement information.
8
-
9
- Args:
10
- model_id: The Hugging Face model ID
11
- aibom: The generated AIBOM data
12
- completeness_score: The completeness score report
13
- enhancement_report: Optional enhancement report with AI improvement information
14
-
15
- Returns:
16
- Rendered HTML content
17
- """
18
- with open('/home/ubuntu/improved_scoring_template.html', 'r') as f:
19
- template_str = f.read()
20
-
21
- template = Template(template_str)
22
-
23
- # Convert scores to percentages for progress bars
24
- if completeness_score:
25
- completeness_score['total_score'] = round(completeness_score.get('total_score', 0))
26
-
27
- if enhancement_report and enhancement_report.get('original_score'):
28
- enhancement_report['original_score']['total_score'] = round(enhancement_report['original_score'].get('total_score', 0))
29
-
30
- if enhancement_report and enhancement_report.get('final_score'):
31
- enhancement_report['final_score']['total_score'] = round(enhancement_report['final_score'].get('total_score', 0))
32
-
33
- return template.render(
34
- model_id=model_id,
35
- aibom=aibom,
36
- completeness_score=completeness_score,
37
- enhancement_report=enhancement_report
38
- )
39
-
40
- def save_improved_score_html(model_id: str, aibom: Dict[str, Any], completeness_score: Dict[str, Any],
41
- output_path: str, enhancement_report: Optional[Dict[str, Any]] = None):
42
- """
43
- Save the improved scoring HTML to a file.
44
-
45
- Args:
46
- model_id: The Hugging Face model ID
47
- aibom: The generated AIBOM data
48
- completeness_score: The completeness score report
49
- output_path: Path to save the HTML file
50
- enhancement_report: Optional enhancement report with AI improvement information
51
- """
52
- html_content = render_improved_score_template(model_id, aibom, completeness_score, enhancement_report)
53
- with open(output_path, 'w', encoding='utf-8') as f:
54
- f.write(html_content)
55
- print(f"Improved scoring HTML saved to {output_path}")