Dave67350 commited on
Commit
30f2036
·
verified ·
1 Parent(s): 62601ed

Update Gradio_UI.py

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +21 -6
Gradio_UI.py CHANGED
@@ -4,6 +4,7 @@ from langdetect import detect
4
  import time
5
  import importlib
6
 
 
7
  DOCUMENT_TO_MODULE = {
8
  "AI Act": {
9
  "Compliance Register": "tools.ai_act_generator",
@@ -46,24 +47,40 @@ DOCUMENT_TO_MODULE = {
46
  "System Testing Record": "tools.nis2_system_testing",
47
  "Third-Party Access Review": "tools.nis2_third_party_access_review",
48
  "Vulnerability Management Log": "tools.nis2_vulnerability_log"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
  }
51
 
52
-
53
-
54
  # === PDF Export Function ===
55
  def export_pdf(title, answers, lang="en"):
56
  pdf = FPDF()
57
  pdf.add_page()
58
  pdf.set_auto_page_break(auto=True, margin=15)
59
 
60
- # Title
61
  pdf.set_font("Arial", 'B', 16)
62
  pdf.set_text_color(0, 51, 102)
63
  pdf.cell(0, 10, title, ln=True, align='C')
64
  pdf.ln(8)
65
 
66
- # Metadata
67
  company = answers.get("What is the name of your organization?", "N/A")
68
  name = answers.get("What is your name?", "N/A")
69
  role = answers.get("What is your role?", "N/A")
@@ -76,7 +93,6 @@ def export_pdf(title, answers, lang="en"):
76
  pdf.cell(0, 8, f"Timestamp: {timestamp}", ln=True, align='C')
77
  pdf.ln(10)
78
 
79
- # Answers
80
  pdf.set_font("Arial", '', 12)
81
  pdf.set_text_color(0, 0, 0)
82
  for label, value in answers.items():
@@ -124,7 +140,6 @@ def continue_conversation(user_input):
124
  conversation_state["answers"][question] = user_input
125
  conversation_state["step"] += 1
126
 
127
- # Language detection (safe fallback)
128
  try:
129
  if user_input and len(user_input.strip()) > 3:
130
  conversation_state["lang"] = detect(user_input)
 
4
  import time
5
  import importlib
6
 
7
+ # === Map document choices to modules ===
8
  DOCUMENT_TO_MODULE = {
9
  "AI Act": {
10
  "Compliance Register": "tools.ai_act_generator",
 
47
  "System Testing Record": "tools.nis2_system_testing",
48
  "Third-Party Access Review": "tools.nis2_third_party_access_review",
49
  "Vulnerability Management Log": "tools.nis2_vulnerability_log"
50
+ },
51
+ "DORA": {
52
+ "Third-Party ICT Risk Register": "tools.nis2_third_party_access_review",
53
+ "ICT Asset Inventory": "tools.nis2_asset_inventory",
54
+ "Incident Reporting Log": "tools.nis2_incident_log",
55
+ "Risk Register": "tools.nis2_risk_register",
56
+ "Backup & Recovery": "tools.nis2_backup_recovery_log",
57
+ "Penetration Testing Summary": "tools.nis2_penetration_test_summary",
58
+ "Disaster Recovery Plan": "tools.nis2_disaster_recovery_plan",
59
+ "Security Testing Strategy": "tools.nis2_security_testing_strategy",
60
+ "ICT Risk Management Policy": "tools.dora_risk_management_policy",
61
+ "ICT Change Management Log": "tools.dora_change_management_log",
62
+ "ICT Incident Communication Strategy": "tools.dora_incident_communication_strategy",
63
+ "ICT Service Continuity Plan": "tools.dora_service_continuity_plan",
64
+ "ICT Third-Party Contract Checklist": "tools.dora_third_party_contract_checklist",
65
+ "ICT Security Policy": "tools.dora_security_policy",
66
+ "DORA Self-Assessment Checklist": "tools.dora_self_assessment",
67
+ "ICT Training Record": "tools.dora_training_record",
68
+ "Data Localization & Sovereignty Log": "tools.dora_data_localization_log",
69
+ "ICT Business Impact Assessment": "tools.dora_bia"
70
  }
71
  }
72
 
 
 
73
  # === PDF Export Function ===
74
  def export_pdf(title, answers, lang="en"):
75
  pdf = FPDF()
76
  pdf.add_page()
77
  pdf.set_auto_page_break(auto=True, margin=15)
78
 
 
79
  pdf.set_font("Arial", 'B', 16)
80
  pdf.set_text_color(0, 51, 102)
81
  pdf.cell(0, 10, title, ln=True, align='C')
82
  pdf.ln(8)
83
 
 
84
  company = answers.get("What is the name of your organization?", "N/A")
85
  name = answers.get("What is your name?", "N/A")
86
  role = answers.get("What is your role?", "N/A")
 
93
  pdf.cell(0, 8, f"Timestamp: {timestamp}", ln=True, align='C')
94
  pdf.ln(10)
95
 
 
96
  pdf.set_font("Arial", '', 12)
97
  pdf.set_text_color(0, 0, 0)
98
  for label, value in answers.items():
 
140
  conversation_state["answers"][question] = user_input
141
  conversation_state["step"] += 1
142
 
 
143
  try:
144
  if user_input and len(user_input.strip()) > 3:
145
  conversation_state["lang"] = detect(user_input)