Spaces:
Running
Running
Deploy ReguAI: Neuro-Symbolic AI GRC & Automated Conformity Assessment Engine
Browse files- app.py +244 -19
- data/active_learning_triplets.jsonl +1 -0
- data/benchmarks/README.md +31 -0
- deploy_dataset_to_hf.py +78 -0
- src/ui/graph_view.py +16 -0
app.py
CHANGED
|
@@ -61,27 +61,27 @@ def run_assessment(doc_text: str, auditor_id: str):
|
|
| 61 |
status_text = "CONFORMS (PASSED)" if report.overall_conforms else "NON-CONFORMANT (FAILED)"
|
| 62 |
|
| 63 |
exec_html = f"""
|
| 64 |
-
<div style="border:
|
| 65 |
-
<div
|
| 66 |
-
<h2
|
| 67 |
-
<span style="background: {status_color};
|
| 68 |
{status_text}
|
| 69 |
</span>
|
| 70 |
</div>
|
| 71 |
-
<p
|
| 72 |
-
<p
|
| 73 |
-
<div
|
| 74 |
-
<div
|
| 75 |
-
<div
|
| 76 |
-
<div
|
| 77 |
</div>
|
| 78 |
-
<div
|
| 79 |
-
<div
|
| 80 |
-
<div
|
| 81 |
</div>
|
| 82 |
-
<div
|
| 83 |
-
<div
|
| 84 |
-
<div
|
| 85 |
</div>
|
| 86 |
</div>
|
| 87 |
</div>
|
|
@@ -193,20 +193,245 @@ def record_triage(claim_id: str, new_status: str, new_category: str, notes: str,
|
|
| 193 |
return f"โ
Triplet sample created and recorded into active learning repository! Anchor: '{record['anchor_text'][:50]}...' -> Label: {record['positive_label']}"
|
| 194 |
|
| 195 |
|
| 196 |
-
# Custom Theme and CSS
|
| 197 |
CUSTOM_CSS = """
|
|
|
|
| 198 |
.gradio-container {
|
| 199 |
max-width: 1380px !important;
|
| 200 |
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
| 201 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
.header-badge {
|
| 203 |
background: #f1f5f9;
|
| 204 |
border: 1px solid #cbd5e1;
|
| 205 |
color: #334155;
|
| 206 |
-
padding:
|
| 207 |
border-radius: 6px;
|
| 208 |
font-size: 12px;
|
| 209 |
-
font-weight:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
}
|
| 211 |
"""
|
| 212 |
|
|
|
|
| 61 |
status_text = "CONFORMS (PASSED)" if report.overall_conforms else "NON-CONFORMANT (FAILED)"
|
| 62 |
|
| 63 |
exec_html = f"""
|
| 64 |
+
<div class="summary-card" style="border-left: 6px solid {status_color};">
|
| 65 |
+
<div class="summary-header">
|
| 66 |
+
<h2 class="summary-title">System: {report.system_metadata.name} (v{report.system_metadata.version})</h2>
|
| 67 |
+
<span class="status-pill" style="background: {status_color};">
|
| 68 |
{status_text}
|
| 69 |
</span>
|
| 70 |
</div>
|
| 71 |
+
<p class="summary-meta"><strong>Domain:</strong> {report.system_metadata.domain} | <strong>Risk Class:</strong> {report.system_metadata.eu_risk_classification}</p>
|
| 72 |
+
<p class="summary-desc">{report.executive_summary}</p>
|
| 73 |
+
<div class="metrics-grid">
|
| 74 |
+
<div class="metric-box">
|
| 75 |
+
<div class="metric-label">Conformity Index</div>
|
| 76 |
+
<div class="metric-val" style="color: {status_color};">{report.conformity_score:.1f}%</div>
|
| 77 |
</div>
|
| 78 |
+
<div class="metric-box">
|
| 79 |
+
<div class="metric-label">Requirements Evaluated</div>
|
| 80 |
+
<div class="metric-val metric-val-main">{report.passed_requirements_count} / {report.total_requirements_evaluated} Passed</div>
|
| 81 |
</div>
|
| 82 |
+
<div class="metric-box">
|
| 83 |
+
<div class="metric-label">Deterministic Violations</div>
|
| 84 |
+
<div class="metric-val" style="color: {'#ef4444' if report.violations else '#10b981'};">{len(report.violations)}</div>
|
| 85 |
</div>
|
| 86 |
</div>
|
| 87 |
</div>
|
|
|
|
| 193 |
return f"โ
Triplet sample created and recorded into active learning repository! Anchor: '{record['anchor_text'][:50]}...' -> Label: {record['positive_label']}"
|
| 194 |
|
| 195 |
|
| 196 |
+
# Custom Theme and CSS for Dark & Light Mode Contrast
|
| 197 |
CUSTOM_CSS = """
|
| 198 |
+
/* Container */
|
| 199 |
.gradio-container {
|
| 200 |
max-width: 1380px !important;
|
| 201 |
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
| 202 |
}
|
| 203 |
+
|
| 204 |
+
/* -------------------------------------------------------------
|
| 205 |
+
TABS STYLING (Dark & Light Mode High-Contrast)
|
| 206 |
+
------------------------------------------------------------- */
|
| 207 |
+
.tabs > .tab-nav button,
|
| 208 |
+
div[role="tablist"] button,
|
| 209 |
+
button[role="tab"],
|
| 210 |
+
.tab-nav button {
|
| 211 |
+
color: #334155 !important;
|
| 212 |
+
font-weight: 600 !important;
|
| 213 |
+
font-size: 13px !important;
|
| 214 |
+
padding: 10px 16px !important;
|
| 215 |
+
border-radius: 6px 6px 0 0 !important;
|
| 216 |
+
transition: all 0.15s ease-in-out !important;
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
.dark .tabs > .tab-nav button,
|
| 220 |
+
.dark div[role="tablist"] button,
|
| 221 |
+
.dark button[role="tab"],
|
| 222 |
+
.dark .tab-nav button {
|
| 223 |
+
color: #cbd5e1 !important;
|
| 224 |
+
background: transparent !important;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
.tabs > .tab-nav button:hover,
|
| 228 |
+
div[role="tablist"] button:hover,
|
| 229 |
+
button[role="tab"]:hover {
|
| 230 |
+
color: #0f172a !important;
|
| 231 |
+
background: rgba(0, 0, 0, 0.04) !important;
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
.dark .tabs > .tab-nav button:hover,
|
| 235 |
+
.dark div[role="tablist"] button:hover,
|
| 236 |
+
.dark button[role="tab"]:hover {
|
| 237 |
+
color: #ffffff !important;
|
| 238 |
+
background: rgba(255, 255, 255, 0.08) !important;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
.tabs > .tab-nav button.selected,
|
| 242 |
+
div[role="tablist"] button.selected,
|
| 243 |
+
button[role="tab"][aria-selected="true"],
|
| 244 |
+
button[role="tab"].selected {
|
| 245 |
+
color: #2563eb !important;
|
| 246 |
+
border-bottom: 3px solid #2563eb !important;
|
| 247 |
+
font-weight: 700 !important;
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
.dark .tabs > .tab-nav button.selected,
|
| 251 |
+
.dark div[role="tablist"] button.selected,
|
| 252 |
+
.dark button[role="tab"][aria-selected="true"],
|
| 253 |
+
.dark button[role="tab"].selected {
|
| 254 |
+
color: #60a5fa !important;
|
| 255 |
+
border-bottom: 3px solid #60a5fa !important;
|
| 256 |
+
background: rgba(96, 165, 250, 0.1) !important;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
/* -------------------------------------------------------------
|
| 260 |
+
BUTTONS STYLING (Dark & Light Mode High-Contrast)
|
| 261 |
+
------------------------------------------------------------- */
|
| 262 |
+
button.primary,
|
| 263 |
+
button[variant="primary"],
|
| 264 |
+
.gr-button-primary,
|
| 265 |
+
button.lg {
|
| 266 |
+
background: #2563eb !important;
|
| 267 |
+
color: #ffffff !important;
|
| 268 |
+
font-weight: 700 !important;
|
| 269 |
+
font-size: 14px !important;
|
| 270 |
+
border: none !important;
|
| 271 |
+
box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3) !important;
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
button.primary:hover,
|
| 275 |
+
button[variant="primary"]:hover,
|
| 276 |
+
button.lg:hover {
|
| 277 |
+
background: #1d4ed8 !important;
|
| 278 |
+
color: #ffffff !important;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
.dark button.primary,
|
| 282 |
+
.dark button[variant="primary"],
|
| 283 |
+
.dark .gr-button-primary {
|
| 284 |
+
background: #2563eb !important;
|
| 285 |
+
color: #ffffff !important;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
button:not(.primary):not([variant="primary"]) {
|
| 289 |
+
color: #1e293b !important;
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
.dark button:not(.primary):not([variant="primary"]) {
|
| 293 |
+
color: #f8fafc !important;
|
| 294 |
+
background: #334155 !important;
|
| 295 |
+
border-color: #475569 !important;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
.dark button:not(.primary):not([variant="primary"]):hover {
|
| 299 |
+
background: #475569 !important;
|
| 300 |
+
color: #ffffff !important;
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
/* -------------------------------------------------------------
|
| 304 |
+
SUMMARY CARD (Dark & Light Mode Dynamic Classes)
|
| 305 |
+
------------------------------------------------------------- */
|
| 306 |
+
.summary-card {
|
| 307 |
+
background: #ffffff;
|
| 308 |
+
border: 1px solid #e2e8f0;
|
| 309 |
+
border-radius: 10px;
|
| 310 |
+
padding: 18px;
|
| 311 |
+
margin-bottom: 15px;
|
| 312 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
.dark .summary-card {
|
| 316 |
+
background: #1e293b !important;
|
| 317 |
+
border-color: #334155 !important;
|
| 318 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
.summary-header {
|
| 322 |
+
display: flex;
|
| 323 |
+
justify-content: space-between;
|
| 324 |
+
align-items: center;
|
| 325 |
+
margin-bottom: 10px;
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
.summary-title {
|
| 329 |
+
margin: 0;
|
| 330 |
+
color: #0f172a;
|
| 331 |
+
font-size: 20px;
|
| 332 |
+
font-weight: 700;
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
.dark .summary-title {
|
| 336 |
+
color: #f8fafc !important;
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
.status-pill {
|
| 340 |
+
color: #ffffff !important;
|
| 341 |
+
padding: 6px 14px;
|
| 342 |
+
border-radius: 9999px;
|
| 343 |
+
font-weight: 700;
|
| 344 |
+
font-size: 13px;
|
| 345 |
+
letter-spacing: 0.5px;
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
.summary-meta {
|
| 349 |
+
margin: 4px 0;
|
| 350 |
+
color: #475569;
|
| 351 |
+
font-size: 14px;
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
.dark .summary-meta {
|
| 355 |
+
color: #94a3b8 !important;
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
.dark .summary-meta strong {
|
| 359 |
+
color: #e2e8f0 !important;
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
.summary-desc {
|
| 363 |
+
margin: 10px 0;
|
| 364 |
+
color: #334155;
|
| 365 |
+
font-size: 14px;
|
| 366 |
+
line-height: 1.6;
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
.dark .summary-desc {
|
| 370 |
+
color: #cbd5e1 !important;
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
.metrics-grid {
|
| 374 |
+
display: flex;
|
| 375 |
+
gap: 16px;
|
| 376 |
+
margin-top: 14px;
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
.metric-box {
|
| 380 |
+
background: #f8fafc;
|
| 381 |
+
border: 1px solid #e2e8f0;
|
| 382 |
+
border-radius: 8px;
|
| 383 |
+
padding: 12px 16px;
|
| 384 |
+
flex: 1;
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
.dark .metric-box {
|
| 388 |
+
background: #0f172a !important;
|
| 389 |
+
border-color: #334155 !important;
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
.metric-label {
|
| 393 |
+
font-size: 11px;
|
| 394 |
+
text-transform: uppercase;
|
| 395 |
+
color: #64748b;
|
| 396 |
+
font-weight: 600;
|
| 397 |
+
letter-spacing: 0.5px;
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
.dark .metric-label {
|
| 401 |
+
color: #94a3b8 !important;
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
.metric-val {
|
| 405 |
+
font-size: 22px;
|
| 406 |
+
font-weight: 700;
|
| 407 |
+
margin-top: 4px;
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
.metric-val-main {
|
| 411 |
+
color: #0f172a;
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
.dark .metric-val-main {
|
| 415 |
+
color: #f8fafc !important;
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
/* -------------------------------------------------------------
|
| 419 |
+
HEADER BADGES
|
| 420 |
+
------------------------------------------------------------- */
|
| 421 |
.header-badge {
|
| 422 |
background: #f1f5f9;
|
| 423 |
border: 1px solid #cbd5e1;
|
| 424 |
color: #334155;
|
| 425 |
+
padding: 5px 12px;
|
| 426 |
border-radius: 6px;
|
| 427 |
font-size: 12px;
|
| 428 |
+
font-weight: 600;
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
.dark .header-badge {
|
| 432 |
+
background: #1e293b !important;
|
| 433 |
+
border-color: #475569 !important;
|
| 434 |
+
color: #e2e8f0 !important;
|
| 435 |
}
|
| 436 |
"""
|
| 437 |
|
data/active_learning_triplets.jsonl
CHANGED
|
@@ -1,3 +1,4 @@
|
|
| 1 |
{"timestamp": "2026-09-20T18:40:55.762828+00:00", "auditor_id": "compliance_lead_01", "claim_id": "clm_test_99", "anchor_text": "Verified operational override in production dashboard.", "positive_label": "HUMAN_OVERSIGHT", "negative_label": "IRRELEVANT_TEXT", "verified_assertion_status": "IMPLEMENTED", "auditor_notes": "Verified operational override in production dashboard."}
|
| 2 |
{"timestamp": "2026-09-20T18:41:12.550631+00:00", "auditor_id": "compliance_lead_01", "claim_id": "clm_test_99", "anchor_text": "Verified operational override in production dashboard.", "positive_label": "HUMAN_OVERSIGHT", "negative_label": "IRRELEVANT_TEXT", "verified_assertion_status": "IMPLEMENTED", "auditor_notes": "Verified operational override in production dashboard."}
|
| 3 |
{"timestamp": "2026-09-20T19:17:17.024922+00:00", "auditor_id": "compliance_lead_01", "claim_id": "clm_test_99", "anchor_text": "Verified operational override in production dashboard.", "positive_label": "HUMAN_OVERSIGHT", "negative_label": "IRRELEVANT_TEXT", "verified_assertion_status": "IMPLEMENTED", "auditor_notes": "Verified operational override in production dashboard."}
|
|
|
|
|
|
| 1 |
{"timestamp": "2026-09-20T18:40:55.762828+00:00", "auditor_id": "compliance_lead_01", "claim_id": "clm_test_99", "anchor_text": "Verified operational override in production dashboard.", "positive_label": "HUMAN_OVERSIGHT", "negative_label": "IRRELEVANT_TEXT", "verified_assertion_status": "IMPLEMENTED", "auditor_notes": "Verified operational override in production dashboard."}
|
| 2 |
{"timestamp": "2026-09-20T18:41:12.550631+00:00", "auditor_id": "compliance_lead_01", "claim_id": "clm_test_99", "anchor_text": "Verified operational override in production dashboard.", "positive_label": "HUMAN_OVERSIGHT", "negative_label": "IRRELEVANT_TEXT", "verified_assertion_status": "IMPLEMENTED", "auditor_notes": "Verified operational override in production dashboard."}
|
| 3 |
{"timestamp": "2026-09-20T19:17:17.024922+00:00", "auditor_id": "compliance_lead_01", "claim_id": "clm_test_99", "anchor_text": "Verified operational override in production dashboard.", "positive_label": "HUMAN_OVERSIGHT", "negative_label": "IRRELEVANT_TEXT", "verified_assertion_status": "IMPLEMENTED", "auditor_notes": "Verified operational override in production dashboard."}
|
| 4 |
+
{"timestamp": "2026-09-20T19:21:17.032615+00:00", "auditor_id": "compliance_lead_01", "claim_id": "clm_test_99", "anchor_text": "Verified operational override in production dashboard.", "positive_label": "HUMAN_OVERSIGHT", "negative_label": "IRRELEVANT_TEXT", "verified_assertion_status": "IMPLEMENTED", "auditor_notes": "Verified operational override in production dashboard."}
|
data/benchmarks/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- text-classification
|
| 5 |
+
- feature-extraction
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
tags:
|
| 9 |
+
- legal
|
| 10 |
+
- eu-ai-act
|
| 11 |
+
- nist-ai-rmf
|
| 12 |
+
- iso-42001
|
| 13 |
+
- ai-governance
|
| 14 |
+
- knowledge-graph
|
| 15 |
+
- rdf
|
| 16 |
+
- json-ld
|
| 17 |
+
size_categories:
|
| 18 |
+
- n<1K
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# ๐ช๐บ EU AI Act Normative Knowledge Triples & Benchmark Dataset
|
| 22 |
+
|
| 23 |
+
Official benchmark dataset formalizing **Regulation (EU) 2024/1689 (EU AI Act)** obligations, prohibited practices (Article 5), and high-risk requirements (Articles 9 through 15) into semantic RDF / JSON-LD knowledge graph triples with normative cross-walks to **NIST AI RMF 1.0** and **ISO/IEC 42001:2023**.
|
| 24 |
+
|
| 25 |
+
## ๐ Dataset Structure
|
| 26 |
+
1. **`eu_ai_act_normative_triples.jsonld`**: High-fidelity RDF knowledge graph linking EU AI Act articles to W3C SHACL shape targets and NIST/ISO cross-walks.
|
| 27 |
+
2. **`conformity_ground_truth_benchmark.jsonl`**: Ground-truth labeled benchmark sentences for evaluating regulatory claim extraction and NegEx assertion triage accuracy.
|
| 28 |
+
|
| 29 |
+
## ๐๏ธ Associated Projects
|
| 30 |
+
- **Interactive Engine (Hugging Face Space):** [gitmodelmujtaba/reguai-engine](https://huggingface.co/spaces/gitmodelmujtaba/reguai-engine)
|
| 31 |
+
- **Engine Source:** [ReguAI Repository](https://github.com/gitcodemujtaba/reguAI)
|
deploy_dataset_to_hf.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Publish the EU AI Act Normative Triples Benchmark Dataset to Hugging Face Datasets Hub.
|
| 3 |
+
Repository: gitmodelmujtaba/eu-ai-act-normative-triples
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
from huggingface_hub import HfApi
|
| 8 |
+
|
| 9 |
+
PROJECT_DIR = Path(__file__).resolve().parent
|
| 10 |
+
BENCHMARK_DIR = PROJECT_DIR / "data" / "benchmarks"
|
| 11 |
+
|
| 12 |
+
def deploy_dataset():
|
| 13 |
+
api = HfApi()
|
| 14 |
+
user_info = api.whoami()
|
| 15 |
+
username = user_info["name"]
|
| 16 |
+
repo_id = f"{username}/eu-ai-act-normative-triples"
|
| 17 |
+
|
| 18 |
+
print(f"Creating / verifying Hugging Face Dataset: {repo_id}...")
|
| 19 |
+
try:
|
| 20 |
+
api.create_repo(
|
| 21 |
+
repo_id=repo_id,
|
| 22 |
+
repo_type="dataset",
|
| 23 |
+
exist_ok=True,
|
| 24 |
+
private=False,
|
| 25 |
+
)
|
| 26 |
+
print(f"Dataset repo {repo_id} verified.")
|
| 27 |
+
except Exception as e:
|
| 28 |
+
print(f"Note on create_repo: {e}")
|
| 29 |
+
|
| 30 |
+
# Create dataset README card
|
| 31 |
+
dataset_readme = f"""---
|
| 32 |
+
license: apache-2.0
|
| 33 |
+
task_categories:
|
| 34 |
+
- text-classification
|
| 35 |
+
- feature-extraction
|
| 36 |
+
language:
|
| 37 |
+
- en
|
| 38 |
+
tags:
|
| 39 |
+
- legal
|
| 40 |
+
- eu-ai-act
|
| 41 |
+
- nist-ai-rmf
|
| 42 |
+
- iso-42001
|
| 43 |
+
- ai-governance
|
| 44 |
+
- knowledge-graph
|
| 45 |
+
- rdf
|
| 46 |
+
- json-ld
|
| 47 |
+
size_categories:
|
| 48 |
+
- n<1K
|
| 49 |
+
---
|
| 50 |
+
|
| 51 |
+
# ๐ช๐บ EU AI Act Normative Knowledge Triples & Benchmark Dataset
|
| 52 |
+
|
| 53 |
+
Official benchmark dataset formalizing **Regulation (EU) 2024/1689 (EU AI Act)** obligations, prohibited practices (Article 5), and high-risk requirements (Articles 9 through 15) into semantic RDF / JSON-LD knowledge graph triples with normative cross-walks to **NIST AI RMF 1.0** and **ISO/IEC 42001:2023**.
|
| 54 |
+
|
| 55 |
+
## ๐ Dataset Structure
|
| 56 |
+
1. **`eu_ai_act_normative_triples.jsonld`**: High-fidelity RDF knowledge graph linking EU AI Act articles to W3C SHACL shape targets and NIST/ISO cross-walks.
|
| 57 |
+
2. **`conformity_ground_truth_benchmark.jsonl`**: Ground-truth labeled benchmark sentences for evaluating regulatory claim extraction and NegEx assertion triage accuracy.
|
| 58 |
+
|
| 59 |
+
## ๐๏ธ Associated Projects
|
| 60 |
+
- **Interactive Engine (Hugging Face Space):** [gitmodelmujtaba/reguai-engine](https://huggingface.co/spaces/gitmodelmujtaba/reguai-engine)
|
| 61 |
+
- **Engine Source:** [ReguAI Repository](https://github.com/gitcodemujtaba/reguAI)
|
| 62 |
+
"""
|
| 63 |
+
readme_path = BENCHMARK_DIR / "README.md"
|
| 64 |
+
readme_path.write_text(dataset_readme, encoding="utf-8")
|
| 65 |
+
|
| 66 |
+
print(f"Uploading benchmark data to {repo_id}...")
|
| 67 |
+
commit_info = api.upload_folder(
|
| 68 |
+
folder_path=str(BENCHMARK_DIR),
|
| 69 |
+
repo_id=repo_id,
|
| 70 |
+
repo_type="dataset",
|
| 71 |
+
commit_message="Publish EU AI Act Normative Triples and Ground-Truth Benchmark",
|
| 72 |
+
)
|
| 73 |
+
print(f"Successfully published dataset to Hugging Face Hub!")
|
| 74 |
+
print(f"Dataset URL: https://huggingface.co/datasets/{repo_id}")
|
| 75 |
+
print(f"Commit: {commit_info}")
|
| 76 |
+
|
| 77 |
+
if __name__ == "__main__":
|
| 78 |
+
deploy_dataset()
|
src/ui/graph_view.py
CHANGED
|
@@ -177,6 +177,22 @@ class RegulatoryGraphView:
|
|
| 177 |
display: flex;
|
| 178 |
gap: 12px;
|
| 179 |
z-index: 10;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
}}
|
| 181 |
.legend-item {{
|
| 182 |
display: flex;
|
|
|
|
| 177 |
display: flex;
|
| 178 |
gap: 12px;
|
| 179 |
z-index: 10;
|
| 180 |
+
color: #1e293b;
|
| 181 |
+
}}
|
| 182 |
+
@media (prefers-color-scheme: dark) {
|
| 183 |
+
body, html {{
|
| 184 |
+
background: #0f172a;
|
| 185 |
+
color: #f8fafc;
|
| 186 |
+
}}
|
| 187 |
+
#network {{
|
| 188 |
+
background: #1e293b;
|
| 189 |
+
border-color: #334155;
|
| 190 |
+
}}
|
| 191 |
+
.legend {{
|
| 192 |
+
background: rgba(30, 41, 59, 0.95);
|
| 193 |
+
border-color: #475569;
|
| 194 |
+
color: #f1f5f9;
|
| 195 |
+
}}
|
| 196 |
}}
|
| 197 |
.legend-item {{
|
| 198 |
display: flex;
|