wu981526092 commited on
Commit
613718e
Β·
1 Parent(s): 674aa7e
app.py CHANGED
@@ -51,20 +51,6 @@ def initialize_data_directories():
51
  os.makedirs(EVAL_REQUESTS_PATH, exist_ok=True)
52
  os.makedirs(EVAL_RESULTS_PATH, exist_ok=True)
53
 
54
- # Create reports directory in the Gradio public directory to serve files
55
- reports_dir = os.path.join("public", "reports")
56
- os.makedirs(reports_dir, exist_ok=True)
57
-
58
- # Copy report files to the public directory
59
- src_reports_dir = "reports"
60
- if os.path.exists(src_reports_dir):
61
- for report_file in os.listdir(src_reports_dir):
62
- src_path = os.path.join(src_reports_dir, report_file)
63
- dst_path = os.path.join(reports_dir, report_file)
64
- if os.path.isfile(src_path):
65
- shutil.copy2(src_path, dst_path)
66
- print(f"Copied report file {report_file} to public directory")
67
-
68
  if LOCAL_MODE:
69
  print("Running in local mode, using local directories only")
70
  return
 
51
  os.makedirs(EVAL_REQUESTS_PATH, exist_ok=True)
52
  os.makedirs(EVAL_RESULTS_PATH, exist_ok=True)
53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  if LOCAL_MODE:
55
  print("Running in local mode, using local directories only")
56
  return
assessment-results/sample_assessment.json CHANGED
@@ -8,7 +8,7 @@
8
  "last_updated": "2025-05-01T12:00:00Z",
9
  "active_maintenance": true,
10
  "independently_verified": true,
11
- "report_url": "langchain-ai_langchain_v0.1.0.html",
12
  "scores": {
13
  "license_validation": 2.5,
14
  "security_assessment": 4.8,
 
8
  "last_updated": "2025-05-01T12:00:00Z",
9
  "active_maintenance": true,
10
  "independently_verified": true,
11
+ "report_url": "https://github.com/LibVulnWatch/reports/raw/main/langchain-ai_langchain_v0.1.0.html",
12
  "scores": {
13
  "license_validation": 2.5,
14
  "security_assessment": 4.8,
assessment-results/sample_assessment2.json CHANGED
@@ -8,7 +8,7 @@
8
  "last_updated": "2025-05-02T12:00:00Z",
9
  "active_maintenance": true,
10
  "independently_verified": true,
11
- "report_url": "pytorch_pytorch_v2.1.0.md",
12
  "scores": {
13
  "license_validation": 1.8,
14
  "security_assessment": 3.2,
 
8
  "last_updated": "2025-05-02T12:00:00Z",
9
  "active_maintenance": true,
10
  "independently_verified": true,
11
+ "report_url": "https://github.com/LibVulnWatch/reports/raw/main/pytorch_pytorch_v2.1.0.md",
12
  "scores": {
13
  "license_validation": 1.8,
14
  "security_assessment": 3.2,
assessment-results/sample_assessment3.json CHANGED
@@ -8,7 +8,7 @@
8
  "last_updated": "2025-05-03T12:00:00Z",
9
  "active_maintenance": true,
10
  "independently_verified": true,
11
- "report_url": "microsoft_autogen_v0.2.0.html",
12
  "scores": {
13
  "license_validation": 3.1,
14
  "security_assessment": 6.7,
 
8
  "last_updated": "2025-05-03T12:00:00Z",
9
  "active_maintenance": true,
10
  "independently_verified": true,
11
+ "report_url": "https://github.com/LibVulnWatch/reports/raw/main/microsoft_autogen_v0.2.0.html",
12
  "scores": {
13
  "license_validation": 3.1,
14
  "security_assessment": 6.7,
src/display/formatting.py CHANGED
@@ -15,20 +15,13 @@ def make_clickable_model(model_name):
15
  def make_clickable_report(report_url):
16
  """Create a clickable link to the assessment report
17
 
18
- If the report_url is a full URL (starts with http), use it directly
19
- Otherwise, assume it's a local file path and construct a local link
20
  """
21
  if not report_url:
22
  return ""
23
 
24
- # Check if this is a URL or local file reference
25
- if report_url.startswith("http"):
26
- # External URL
27
- return f'<a href="{report_url}" target="_blank" style="display:inline-block; padding:3px 8px; background-color:#f0f6ff; color:#0078d4; border-radius:4px; text-decoration:none; font-weight:bold;">πŸ“ View</a>'
28
- else:
29
- # Local file reference, create a relative path to the public directory
30
- report_path = f"file/reports/{report_url}"
31
- return f'<a href="{report_path}" target="_blank" style="display:inline-block; padding:3px 8px; background-color:#f0f6ff; color:#0078d4; border-radius:4px; text-decoration:none; font-weight:bold;">πŸ“ View</a>'
32
 
33
 
34
  def styled_error(error):
 
15
  def make_clickable_report(report_url):
16
  """Create a clickable link to the assessment report
17
 
18
+ Always use the report_url directly as an external URL.
 
19
  """
20
  if not report_url:
21
  return ""
22
 
23
+ # Create styled button link
24
+ return f'<a href="{report_url}" target="_blank" style="display:inline-block; padding:3px 8px; background-color:#f0f6ff; color:#0078d4; border-radius:4px; text-decoration:none; font-weight:bold;">πŸ“ View</a>'
 
 
 
 
 
 
25
 
26
 
27
  def styled_error(error):