Spaces:
Sleeping
Sleeping
Deploy ReguAI: Neuro-Symbolic AI GRC & Automated Conformity Assessment Engine
Browse files- app.py +339 -336
- data/active_learning_triplets.jsonl +1 -0
app.py
CHANGED
|
@@ -303,136 +303,303 @@ def record_triage(claim_id: str, new_status: str, new_category: str, notes: str,
|
|
| 303 |
return f"β
Triplet sample created and recorded into active learning repository! Anchor: '{record['anchor_text'][:50]}...' -> Label: {record['positive_label']}"
|
| 304 |
|
| 305 |
|
| 306 |
-
# Custom Theme and CSS for
|
| 307 |
CUSTOM_CSS = """
|
| 308 |
-
|
|
|
|
|
|
|
| 309 |
.gradio-container {
|
| 310 |
-
max-width:
|
| 311 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
}
|
| 313 |
|
| 314 |
/* -------------------------------------------------------------
|
| 315 |
-
|
| 316 |
------------------------------------------------------------- */
|
| 317 |
-
.
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 322 |
font-weight: 600 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
font-size: 13px !important;
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
|
|
|
|
|
|
|
|
|
| 327 |
}
|
| 328 |
|
| 329 |
-
.dark
|
| 330 |
-
|
| 331 |
-
.dark button[role="tab"],
|
| 332 |
-
.dark .tab-nav button {
|
| 333 |
-
color: #cbd5e1 !important;
|
| 334 |
-
background: transparent !important;
|
| 335 |
}
|
| 336 |
|
| 337 |
-
.tabs > .tab-nav button:hover,
|
| 338 |
-
div[role="tablist"] button:hover,
|
| 339 |
button[role="tab"]:hover {
|
| 340 |
color: #0f172a !important;
|
| 341 |
-
background: rgba(0, 0, 0, 0.
|
| 342 |
}
|
| 343 |
|
| 344 |
-
.dark .tabs > .tab-nav button:hover,
|
| 345 |
-
.dark div[role="tablist"] button:hover,
|
| 346 |
.dark button[role="tab"]:hover {
|
| 347 |
-
color: #
|
| 348 |
-
background: rgba(255, 255, 255, 0.
|
| 349 |
}
|
| 350 |
|
| 351 |
-
.tabs > .tab-nav button.selected,
|
| 352 |
-
div[role="tablist"] button.selected,
|
| 353 |
button[role="tab"][aria-selected="true"],
|
| 354 |
button[role="tab"].selected {
|
| 355 |
color: #2563eb !important;
|
| 356 |
border-bottom: 3px solid #2563eb !important;
|
|
|
|
| 357 |
font-weight: 700 !important;
|
| 358 |
}
|
| 359 |
|
| 360 |
-
.dark .tabs > .tab-nav button.selected,
|
| 361 |
-
.dark div[role="tablist"] button.selected,
|
| 362 |
.dark button[role="tab"][aria-selected="true"],
|
| 363 |
.dark button[role="tab"].selected {
|
| 364 |
color: #60a5fa !important;
|
| 365 |
-
border-bottom:
|
| 366 |
-
background: rgba(96, 165, 250, 0.1) !important;
|
| 367 |
}
|
| 368 |
|
| 369 |
/* -------------------------------------------------------------
|
| 370 |
-
|
| 371 |
------------------------------------------------------------- */
|
| 372 |
button.primary,
|
| 373 |
-
button[variant="primary"]
|
| 374 |
-
|
| 375 |
-
button.lg {
|
| 376 |
-
background: #2563eb !important;
|
| 377 |
color: #ffffff !important;
|
| 378 |
font-weight: 700 !important;
|
| 379 |
font-size: 14px !important;
|
|
|
|
|
|
|
| 380 |
border: none !important;
|
| 381 |
-
box-shadow: 0
|
|
|
|
| 382 |
}
|
| 383 |
|
| 384 |
button.primary:hover,
|
| 385 |
-
button[variant="primary"]:hover
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
}
|
| 390 |
-
|
| 391 |
-
.dark button.primary,
|
| 392 |
-
.dark button[variant="primary"],
|
| 393 |
-
.dark .gr-button-primary {
|
| 394 |
-
background: #2563eb !important;
|
| 395 |
-
color: #ffffff !important;
|
| 396 |
-
}
|
| 397 |
-
|
| 398 |
-
button:not(.primary):not([variant="primary"]) {
|
| 399 |
-
color: #1e293b !important;
|
| 400 |
-
}
|
| 401 |
-
|
| 402 |
-
.dark button:not(.primary):not([variant="primary"]) {
|
| 403 |
-
color: #f8fafc !important;
|
| 404 |
-
background: #334155 !important;
|
| 405 |
-
border-color: #475569 !important;
|
| 406 |
-
}
|
| 407 |
-
|
| 408 |
-
.dark button:not(.primary):not([variant="primary"]):hover {
|
| 409 |
-
background: #475569 !important;
|
| 410 |
-
color: #ffffff !important;
|
| 411 |
}
|
| 412 |
|
| 413 |
/* -------------------------------------------------------------
|
| 414 |
-
SUMMARY
|
| 415 |
------------------------------------------------------------- */
|
| 416 |
.summary-card {
|
| 417 |
background: #ffffff;
|
| 418 |
border: 1px solid #e2e8f0;
|
| 419 |
-
border-radius:
|
| 420 |
-
padding:
|
| 421 |
-
margin-bottom:
|
| 422 |
-
box-shadow: 0
|
| 423 |
}
|
| 424 |
|
| 425 |
.dark .summary-card {
|
| 426 |
background: #1e293b !important;
|
| 427 |
border-color: #334155 !important;
|
| 428 |
-
box-shadow: 0
|
| 429 |
}
|
| 430 |
|
| 431 |
.summary-header {
|
| 432 |
display: flex;
|
| 433 |
justify-content: space-between;
|
| 434 |
align-items: center;
|
| 435 |
-
margin-bottom:
|
|
|
|
|
|
|
| 436 |
}
|
| 437 |
|
| 438 |
.summary-title {
|
|
@@ -458,7 +625,7 @@ button:not(.primary):not([variant="primary"]) {
|
|
| 458 |
.summary-meta {
|
| 459 |
margin: 4px 0;
|
| 460 |
color: #475569;
|
| 461 |
-
font-size:
|
| 462 |
}
|
| 463 |
|
| 464 |
.dark .summary-meta {
|
|
@@ -482,16 +649,18 @@ button:not(.primary):not([variant="primary"]) {
|
|
| 482 |
|
| 483 |
.metrics-grid {
|
| 484 |
display: flex;
|
| 485 |
-
gap:
|
| 486 |
margin-top: 14px;
|
|
|
|
| 487 |
}
|
| 488 |
|
| 489 |
.metric-box {
|
| 490 |
background: #f8fafc;
|
| 491 |
border: 1px solid #e2e8f0;
|
| 492 |
-
border-radius:
|
| 493 |
-
padding: 12px
|
| 494 |
flex: 1;
|
|
|
|
| 495 |
}
|
| 496 |
|
| 497 |
.dark .metric-box {
|
|
@@ -503,8 +672,8 @@ button:not(.primary):not([variant="primary"]) {
|
|
| 503 |
font-size: 11px;
|
| 504 |
text-transform: uppercase;
|
| 505 |
color: #64748b;
|
| 506 |
-
font-weight:
|
| 507 |
-
letter-spacing: 0.
|
| 508 |
}
|
| 509 |
|
| 510 |
.dark .metric-label {
|
|
@@ -512,8 +681,8 @@ button:not(.primary):not([variant="primary"]) {
|
|
| 512 |
}
|
| 513 |
|
| 514 |
.metric-val {
|
| 515 |
-
font-size:
|
| 516 |
-
font-weight:
|
| 517 |
margin-top: 4px;
|
| 518 |
}
|
| 519 |
|
|
@@ -526,166 +695,21 @@ button:not(.primary):not([variant="primary"]) {
|
|
| 526 |
}
|
| 527 |
|
| 528 |
/* -------------------------------------------------------------
|
| 529 |
-
|
| 530 |
------------------------------------------------------------- */
|
| 531 |
-
.
|
| 532 |
-
background: #f1f5f9;
|
| 533 |
-
border: 1px solid #cbd5e1;
|
| 534 |
-
color: #334155;
|
| 535 |
-
padding: 5px 12px;
|
| 536 |
-
border-radius: 6px;
|
| 537 |
-
font-size: 12px;
|
| 538 |
-
font-weight: 600;
|
| 539 |
-
}
|
| 540 |
-
|
| 541 |
-
.dark .header-badge {
|
| 542 |
-
background: #1e293b !important;
|
| 543 |
-
border-color: #475569 !important;
|
| 544 |
-
color: #e2e8f0 !important;
|
| 545 |
-
}
|
| 546 |
-
|
| 547 |
-
/* -------------------------------------------------------------
|
| 548 |
-
FACTSHEET & PROVENANCE STYLING (Dark & Light Mode)
|
| 549 |
-
------------------------------------------------------------- */
|
| 550 |
-
.factsheet-container {
|
| 551 |
-
background: #ffffff !important;
|
| 552 |
-
border: 1px solid #cbd5e1 !important;
|
| 553 |
-
border-radius: 8px !important;
|
| 554 |
-
}
|
| 555 |
-
|
| 556 |
-
.dark .factsheet-container {
|
| 557 |
-
background: #1e293b !important;
|
| 558 |
-
border-color: #334155 !important;
|
| 559 |
-
color: #e2e8f0 !important;
|
| 560 |
-
}
|
| 561 |
-
|
| 562 |
-
.dark .factsheet-container h3 {
|
| 563 |
-
color: #f8fafc !important;
|
| 564 |
-
}
|
| 565 |
-
|
| 566 |
-
.dark .factsheet-container div[style*="background:#f8fafc"] {
|
| 567 |
-
background: #0f172a !important;
|
| 568 |
-
border-color: #334155 !important;
|
| 569 |
-
color: #cbd5e1 !important;
|
| 570 |
-
}
|
| 571 |
-
|
| 572 |
-
.dark .factsheet-container div[style*="background:#fffbeb"] {
|
| 573 |
-
background: #451a03 !important;
|
| 574 |
-
border-color: #78350f !important;
|
| 575 |
-
color: #fef3c7 !important;
|
| 576 |
-
}
|
| 577 |
-
|
| 578 |
-
/* Quick Summary Bar */
|
| 579 |
-
.quick-summary-bar {
|
| 580 |
-
background: #f8fafc !important;
|
| 581 |
border: 1px solid #e2e8f0 !important;
|
| 582 |
-
border-radius:
|
|
|
|
|
|
|
| 583 |
}
|
| 584 |
|
| 585 |
-
.dark .
|
| 586 |
-
background: #0f172a !important;
|
| 587 |
border-color: #334155 !important;
|
| 588 |
-
color: #cbd5e1 !important;
|
| 589 |
-
}
|
| 590 |
-
|
| 591 |
-
/* -------------------------------------------------------------
|
| 592 |
-
WORKFLOW STEPPER
|
| 593 |
-
------------------------------------------------------------- */
|
| 594 |
-
.workflow-stepper {
|
| 595 |
-
display: flex;
|
| 596 |
-
align-items: center;
|
| 597 |
-
justify-content: space-between;
|
| 598 |
-
background: #f8fafc;
|
| 599 |
-
border: 1px solid #e2e8f0;
|
| 600 |
-
border-radius: 10px;
|
| 601 |
-
padding: 12px 18px;
|
| 602 |
-
margin: 12px 0 16px 0;
|
| 603 |
-
gap: 8px;
|
| 604 |
-
flex-wrap: wrap;
|
| 605 |
-
}
|
| 606 |
-
|
| 607 |
-
.dark .workflow-stepper {
|
| 608 |
background: #0f172a !important;
|
| 609 |
-
border-color: #334155 !important;
|
| 610 |
}
|
| 611 |
|
| 612 |
-
|
| 613 |
-
display: flex;
|
| 614 |
-
align-items: center;
|
| 615 |
-
gap: 10px;
|
| 616 |
-
}
|
| 617 |
-
|
| 618 |
-
.step-num {
|
| 619 |
-
background: #2563eb;
|
| 620 |
-
color: #ffffff !important;
|
| 621 |
-
font-weight: 800;
|
| 622 |
-
width: 26px;
|
| 623 |
-
height: 26px;
|
| 624 |
-
border-radius: 50%;
|
| 625 |
-
display: inline-flex;
|
| 626 |
-
align-items: center;
|
| 627 |
-
justify-content: center;
|
| 628 |
-
font-size: 12px;
|
| 629 |
-
}
|
| 630 |
-
|
| 631 |
-
.step-text {
|
| 632 |
-
font-size: 12px;
|
| 633 |
-
color: #475569;
|
| 634 |
-
line-height: 1.25;
|
| 635 |
-
}
|
| 636 |
-
|
| 637 |
-
.dark .step-text {
|
| 638 |
-
color: #94a3b8 !important;
|
| 639 |
-
}
|
| 640 |
-
|
| 641 |
-
.step-text strong {
|
| 642 |
-
display: block;
|
| 643 |
-
color: #0f172a;
|
| 644 |
-
font-size: 13px;
|
| 645 |
-
}
|
| 646 |
-
|
| 647 |
-
.dark .step-text strong {
|
| 648 |
-
color: #f8fafc !important;
|
| 649 |
-
}
|
| 650 |
-
|
| 651 |
-
.step-arrow {
|
| 652 |
-
color: #94a3b8;
|
| 653 |
-
font-weight: 700;
|
| 654 |
-
font-size: 15px;
|
| 655 |
-
}
|
| 656 |
-
|
| 657 |
-
/* -------------------------------------------------------------
|
| 658 |
-
PRESET BUTTONS
|
| 659 |
-
------------------------------------------------------------- */
|
| 660 |
-
.preset-btn {
|
| 661 |
-
font-size: 12px !important;
|
| 662 |
-
font-weight: 600 !important;
|
| 663 |
-
padding: 6px 12px !important;
|
| 664 |
-
border-radius: 8px !important;
|
| 665 |
-
border: 1px solid #cbd5e1 !important;
|
| 666 |
-
background: #ffffff !important;
|
| 667 |
-
color: #1e293b !important;
|
| 668 |
-
transition: all 0.15s ease !important;
|
| 669 |
-
}
|
| 670 |
-
|
| 671 |
-
.preset-btn:hover {
|
| 672 |
-
transform: translateY(-1px) !important;
|
| 673 |
-
box-shadow: 0 2px 5px rgba(0,0,0,0.08) !important;
|
| 674 |
-
}
|
| 675 |
-
|
| 676 |
-
.dark .preset-btn {
|
| 677 |
-
background: #1e293b !important;
|
| 678 |
-
border-color: #334155 !important;
|
| 679 |
-
color: #f8fafc !important;
|
| 680 |
-
}
|
| 681 |
-
|
| 682 |
-
.dark .preset-btn:hover {
|
| 683 |
-
background: #334155 !important;
|
| 684 |
-
}
|
| 685 |
-
|
| 686 |
-
/* -------------------------------------------------------------
|
| 687 |
-
FINE LIABILITY CARD DARK MODE
|
| 688 |
-
------------------------------------------------------------- */
|
| 689 |
.dark .fine-liability-card {
|
| 690 |
background: #1e293b !important;
|
| 691 |
border-color: #334155 !important;
|
|
@@ -699,134 +723,117 @@ button:not(.primary):not([variant="primary"]) {
|
|
| 699 |
"""
|
| 700 |
|
| 701 |
with gr.Blocks(title="ReguAI: Neuro-Symbolic AI GRC Engine") as demo:
|
| 702 |
-
|
|
|
|
| 703 |
"""
|
| 704 |
-
|
| 705 |
-
|
| 706 |
-
|
| 707 |
-
|
| 708 |
-
|
| 709 |
-
<div style="display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap;">
|
| 710 |
-
<span class="header-badge">πͺπΊ EU AI Act High-Risk (Arts. 9-15)</span>
|
| 711 |
-
<span class="header-badge">π W3C SHACL Deterministic Proofs</span>
|
| 712 |
-
<span class="header-badge">π Multi-Framework Crosswalk (NIST & ISO)</span>
|
| 713 |
-
<span class="header-badge">π° Article 99 Statutory Fine Modeling</span>
|
| 714 |
-
<span class="header-badge">π W3C PROV-O Audit Ledger</span>
|
| 715 |
-
<span class="header-badge">π€ Auditor-in-the-Loop Active Learning</span>
|
| 716 |
-
</div>
|
| 717 |
-
|
| 718 |
-
<div class="workflow-stepper">
|
| 719 |
-
<div class="step-card">
|
| 720 |
-
<span class="step-num">1</span>
|
| 721 |
-
<div class="step-text">
|
| 722 |
-
<strong>Select AI Scenario</strong>
|
| 723 |
-
1-Click Preset or 11 EU Domains
|
| 724 |
-
</div>
|
| 725 |
-
</div>
|
| 726 |
-
<div class="step-arrow">β</div>
|
| 727 |
-
<div class="step-card">
|
| 728 |
-
<span class="step-num">2</span>
|
| 729 |
-
<div class="step-text">
|
| 730 |
-
<strong>Review Legal Grounding</strong>
|
| 731 |
-
EUR-Lex CELEX & W3C PROV-O
|
| 732 |
</div>
|
| 733 |
-
|
| 734 |
-
|
| 735 |
-
|
| 736 |
-
|
| 737 |
-
|
| 738 |
-
<
|
| 739 |
-
W3C SHACL Mathematical Proofs
|
| 740 |
</div>
|
| 741 |
</div>
|
| 742 |
-
<div class="
|
| 743 |
-
|
| 744 |
-
<span class="
|
| 745 |
-
<div class="
|
| 746 |
-
|
| 747 |
-
|
| 748 |
-
</
|
|
|
|
| 749 |
</div>
|
| 750 |
</div>
|
| 751 |
"""
|
| 752 |
)
|
| 753 |
|
| 754 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
| 755 |
with gr.Column(scale=5):
|
| 756 |
-
gr.
|
| 757 |
with gr.Row():
|
| 758 |
-
preset_samd = gr.Button("π₯
|
| 759 |
preset_hr = gr.Button("πΌ Failed HR AI", size="sm", elem_classes=["preset-btn"])
|
| 760 |
preset_prohibited = gr.Button("π« Prohibited AI", size="sm", elem_classes=["preset-btn"])
|
| 761 |
preset_gpai = gr.Button("π Frontier GPAI", size="sm", elem_classes=["preset-btn"])
|
| 762 |
-
preset_grid = gr.Button("β‘
|
| 763 |
|
| 764 |
with gr.Row():
|
| 765 |
domain_dropdown = gr.Dropdown(
|
| 766 |
-
label="π
|
| 767 |
choices=DOMAIN_OPTIONS,
|
| 768 |
value=DEFAULT_DOMAIN,
|
| 769 |
scale=6,
|
| 770 |
interactive=True,
|
| 771 |
-
info="11 statutory sectors under EU AI Act",
|
| 772 |
)
|
| 773 |
case_dropdown = gr.Dropdown(
|
| 774 |
-
label="π
|
| 775 |
choices=DEFAULT_CASE_TITLES,
|
| 776 |
value=DEFAULT_CASE_TITLE,
|
| 777 |
scale=6,
|
| 778 |
interactive=True,
|
| 779 |
-
info="Canonical legal scenarios with EUR-Lex provenance",
|
| 780 |
)
|
| 781 |
|
| 782 |
quick_bar_box = gr.HTML(
|
| 783 |
value=DEFAULT_QUICK_BAR,
|
| 784 |
-
label="Statutory
|
| 785 |
)
|
| 786 |
|
| 787 |
with gr.Tabs():
|
| 788 |
-
with gr.TabItem("π Technical Specification
|
| 789 |
spec_input = gr.Textbox(
|
| 790 |
label="System Technical Specification (Markdown or JSON - Fully Editable)",
|
| 791 |
-
lines=
|
| 792 |
placeholder="Paste AI system architecture or model card text...",
|
| 793 |
value=DEFAULT_SPEC_TEXT,
|
| 794 |
-
info="Grounds natural language model cards into normative RDF knowledge graph",
|
| 795 |
)
|
| 796 |
-
with gr.TabItem("π
|
| 797 |
factsheet_box = gr.HTML(
|
| 798 |
value=DEFAULT_FACTSHEET,
|
| 799 |
-
label="
|
| 800 |
)
|
| 801 |
|
| 802 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 803 |
auditor_input = gr.Textbox(
|
| 804 |
label="Auditor Identifier",
|
| 805 |
value="lead_compliance_auditor_01",
|
| 806 |
-
|
| 807 |
-
info="Embedded in W3C PROV-O audit ledger",
|
| 808 |
-
)
|
| 809 |
-
turnover_input = gr.Number(
|
| 810 |
-
label="Annual Turnover (β¬)",
|
| 811 |
-
value=50000000.0,
|
| 812 |
-
step=5000000.0,
|
| 813 |
-
scale=4,
|
| 814 |
-
info="For Art. 99 administrative fine modeling",
|
| 815 |
-
)
|
| 816 |
-
is_sme_input = gr.Checkbox(
|
| 817 |
-
label="SME Status",
|
| 818 |
-
value=False,
|
| 819 |
-
scale=3,
|
| 820 |
-
info="Art. 99(6) reduced fine caps (whichever is lower)",
|
| 821 |
)
|
| 822 |
|
| 823 |
assess_btn = gr.Button("β‘ Run Deterministic Conformity Assessment", variant="primary", size="lg")
|
| 824 |
|
|
|
|
|
|
|
|
|
|
| 825 |
with gr.Column(scale=7):
|
| 826 |
-
exec_output = gr.HTML(value=DEFAULT_ASSESSMENT[0], label="Executive Conformity Summary")
|
| 827 |
-
|
| 828 |
with gr.Tabs():
|
| 829 |
-
|
|
|
|
|
|
|
|
|
|
| 830 |
violations_table = gr.Dataframe(
|
| 831 |
headers=["Legal Article", "Normative Requirement", "Severity", "SHACL Path", "Remediation Guidance"],
|
| 832 |
datatype=["str", "str", "str", "str", "str"],
|
|
@@ -834,62 +841,58 @@ with gr.Blocks(title="ReguAI: Neuro-Symbolic AI GRC Engine") as demo:
|
|
| 834 |
label="Mathematical Proof: Non-Conformities Found",
|
| 835 |
)
|
| 836 |
|
| 837 |
-
|
| 838 |
-
|
|
|
|
|
|
|
| 839 |
frameworks_table = gr.Dataframe(
|
| 840 |
headers=["Target Framework", "Control ID", "Control Name", "Status", "Linked AI Act Article", "Audit Guidance"],
|
| 841 |
datatype=["str", "str", "str", "str", "str", "str"],
|
| 842 |
value=DEFAULT_ASSESSMENT[10],
|
| 843 |
-
label="
|
| 844 |
)
|
| 845 |
|
| 846 |
-
|
| 847 |
-
|
| 848 |
-
|
| 849 |
-
with gr.TabItem("πΈοΈ Interactive Regulatory Graph"):
|
| 850 |
-
graph_output = gr.HTML(value=DEFAULT_ASSESSMENT[3], label="Force-Directed Regulatory Dependency Network")
|
| 851 |
-
|
| 852 |
-
with gr.TabItem("π Extracted Regulatory Claims"):
|
| 853 |
claims_table = gr.Dataframe(
|
| 854 |
headers=["Claim ID", "Category", "Status", "Confidence", "Target Article", "Evidence Span"],
|
| 855 |
datatype=["str", "str", "str", "str", "str", "str"],
|
| 856 |
value=DEFAULT_ASSESSMENT[2],
|
| 857 |
-
label="
|
| 858 |
)
|
| 859 |
-
|
| 860 |
-
with gr.TabItem("π€ Auditor Triage & Active Learning"):
|
| 861 |
-
gr.Markdown("### Borderline Claims Requiring Human Auditor Review")
|
| 862 |
borderline_table = gr.Dataframe(
|
| 863 |
headers=["Claim ID", "Category", "Status", "Confidence", "Evidence Quote"],
|
| 864 |
datatype=["str", "str", "str", "str", "str"],
|
| 865 |
value=DEFAULT_ASSESSMENT[9],
|
| 866 |
)
|
| 867 |
with gr.Row():
|
| 868 |
-
triage_claim_id = gr.Textbox(label="Claim ID
|
| 869 |
-
triage_status = gr.Dropdown(label="Verified
|
| 870 |
-
triage_cat = gr.Dropdown(label="Verified
|
| 871 |
-
|
| 872 |
-
|
|
|
|
| 873 |
triage_result = gr.Markdown()
|
| 874 |
|
| 875 |
-
|
| 876 |
-
|
| 877 |
-
ledger_display = gr.Markdown(value=DEFAULT_ASSESSMENT[5])
|
| 878 |
-
|
| 879 |
-
with gr.TabItem("π Export Technical Documentation (Annex IV)"):
|
| 880 |
with gr.Tabs():
|
| 881 |
-
with gr.TabItem("π
|
| 882 |
cert_html_output = gr.HTML(value=DEFAULT_ASSESSMENT[8])
|
| 883 |
-
with gr.TabItem("Annex IV Official Report (Markdown)"):
|
| 884 |
-
report_markdown = gr.Markdown(value=DEFAULT_ASSESSMENT[7])
|
| 885 |
-
with gr.TabItem("Machine-Readable JSON-LD"):
|
| 886 |
-
jsonld_display = gr.Code(value=DEFAULT_ASSESSMENT[6], language="json", label="W3C JSON-LD Digital Certificate")
|
| 887 |
with gr.TabItem("π¦ CycloneDX 1.6 AI-BOM"):
|
| 888 |
bom_display = gr.Code(value=DEFAULT_ASSESSMENT[12], language="json", label="CycloneDX 1.6 Machine-Readable AI-BOM")
|
| 889 |
with gr.TabItem("π‘οΈ OASIS SARIF 2.1.0 Report"):
|
| 890 |
sarif_display = gr.Code(value=DEFAULT_ASSESSMENT[13], language="json", label="OASIS SARIF 2.1.0 Static Analysis Report")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 891 |
|
| 892 |
-
#
|
| 893 |
preset_outputs = [
|
| 894 |
domain_dropdown,
|
| 895 |
case_dropdown,
|
|
|
|
| 303 |
return f"β
Triplet sample created and recorded into active learning repository! Anchor: '{record['anchor_text'][:50]}...' -> Label: {record['positive_label']}"
|
| 304 |
|
| 305 |
|
| 306 |
+
# Custom Theme and CSS for Modern, Uncluttered Executive UI
|
| 307 |
CUSTOM_CSS = """
|
| 308 |
+
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');
|
| 309 |
+
|
| 310 |
+
/* Main Container */
|
| 311 |
.gradio-container {
|
| 312 |
+
max-width: 1440px !important;
|
| 313 |
+
margin: 0 auto !important;
|
| 314 |
+
font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
|
| 315 |
+
color: #1e293b;
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
.dark .gradio-container {
|
| 319 |
+
color: #f1f5f9;
|
| 320 |
}
|
| 321 |
|
| 322 |
/* -------------------------------------------------------------
|
| 323 |
+
EXECUTIVE HERO BANNER
|
| 324 |
------------------------------------------------------------- */
|
| 325 |
+
.hero-header {
|
| 326 |
+
background: linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(241, 245, 249, 0.9) 100%);
|
| 327 |
+
border: 1px solid rgba(226, 232, 240, 0.9);
|
| 328 |
+
backdrop-filter: blur(12px);
|
| 329 |
+
border-radius: 14px;
|
| 330 |
+
padding: 20px 24px;
|
| 331 |
+
margin-bottom: 20px;
|
| 332 |
+
box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.04);
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
.dark .hero-header {
|
| 336 |
+
background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.9) 100%) !important;
|
| 337 |
+
border-color: rgba(51, 65, 85, 0.9) !important;
|
| 338 |
+
box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.4) !important;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
.hero-title-row {
|
| 342 |
+
display: flex;
|
| 343 |
+
justify-content: space-between;
|
| 344 |
+
align-items: center;
|
| 345 |
+
flex-wrap: wrap;
|
| 346 |
+
gap: 16px;
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
.hero-title-group h1 {
|
| 350 |
+
font-size: 24px !important;
|
| 351 |
+
font-weight: 800 !important;
|
| 352 |
+
margin: 0 !important;
|
| 353 |
+
background: linear-gradient(135deg, #1e293b 0%, #2563eb 100%);
|
| 354 |
+
-webkit-background-clip: text;
|
| 355 |
+
-webkit-text-fill-color: transparent;
|
| 356 |
+
display: flex;
|
| 357 |
+
align-items: center;
|
| 358 |
+
gap: 10px;
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
.dark .hero-title-group h1 {
|
| 362 |
+
background: linear-gradient(135deg, #f8fafc 0%, #60a5fa 100%) !important;
|
| 363 |
+
-webkit-background-clip: text !important;
|
| 364 |
+
-webkit-text-fill-color: transparent !important;
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
.hero-subtitle {
|
| 368 |
+
font-size: 13px !important;
|
| 369 |
+
color: #64748b !important;
|
| 370 |
+
margin-top: 4px !important;
|
| 371 |
+
font-weight: 500 !important;
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
.dark .hero-subtitle {
|
| 375 |
+
color: #94a3b8 !important;
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
.hero-badges {
|
| 379 |
+
display: flex;
|
| 380 |
+
gap: 8px;
|
| 381 |
+
flex-wrap: wrap;
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
.hero-pill {
|
| 385 |
+
font-size: 11px;
|
| 386 |
+
font-weight: 700;
|
| 387 |
+
padding: 5px 12px;
|
| 388 |
+
border-radius: 9999px;
|
| 389 |
+
background: rgba(255, 255, 255, 0.85);
|
| 390 |
+
border: 1px solid #cbd5e1;
|
| 391 |
+
color: #334155;
|
| 392 |
+
letter-spacing: 0.3px;
|
| 393 |
+
display: inline-flex;
|
| 394 |
+
align-items: center;
|
| 395 |
+
gap: 5px;
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
.dark .hero-pill {
|
| 399 |
+
background: rgba(30, 41, 59, 0.85);
|
| 400 |
+
border-color: #475569;
|
| 401 |
+
color: #cbd5e1;
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
.workflow-strip {
|
| 405 |
+
display: flex;
|
| 406 |
+
align-items: center;
|
| 407 |
+
justify-content: space-between;
|
| 408 |
+
margin-top: 14px;
|
| 409 |
+
padding-top: 14px;
|
| 410 |
+
border-top: 1px solid rgba(226, 232, 240, 0.8);
|
| 411 |
+
gap: 10px;
|
| 412 |
+
flex-wrap: wrap;
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
.dark .workflow-strip {
|
| 416 |
+
border-top-color: rgba(51, 65, 85, 0.8);
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
.wf-item {
|
| 420 |
+
display: flex;
|
| 421 |
+
align-items: center;
|
| 422 |
+
gap: 8px;
|
| 423 |
+
font-size: 12px;
|
| 424 |
+
color: #475569;
|
| 425 |
+
font-weight: 500;
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
.dark .wf-item {
|
| 429 |
+
color: #94a3b8;
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
.wf-num {
|
| 433 |
+
width: 20px;
|
| 434 |
+
height: 20px;
|
| 435 |
+
border-radius: 50%;
|
| 436 |
+
background: #2563eb;
|
| 437 |
+
color: #ffffff;
|
| 438 |
+
font-weight: 700;
|
| 439 |
+
display: flex;
|
| 440 |
+
align-items: center;
|
| 441 |
+
justify-content: center;
|
| 442 |
+
font-size: 11px;
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
.wf-arrow {
|
| 446 |
+
color: #cbd5e1;
|
| 447 |
+
font-size: 12px;
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
.dark .wf-arrow {
|
| 451 |
+
color: #475569;
|
| 452 |
+
}
|
| 453 |
+
|
| 454 |
+
/* -------------------------------------------------------------
|
| 455 |
+
PRESET SCENARIO BUTTONS (Sleek & Segmented)
|
| 456 |
+
------------------------------------------------------------- */
|
| 457 |
+
.section-label {
|
| 458 |
+
font-size: 12px;
|
| 459 |
+
font-weight: 700;
|
| 460 |
+
text-transform: uppercase;
|
| 461 |
+
color: #64748b;
|
| 462 |
+
letter-spacing: 0.6px;
|
| 463 |
+
margin-bottom: 8px;
|
| 464 |
+
display: flex;
|
| 465 |
+
align-items: center;
|
| 466 |
+
gap: 6px;
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
.dark .section-label {
|
| 470 |
+
color: #94a3b8;
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
.preset-btn {
|
| 474 |
+
font-size: 12px !important;
|
| 475 |
font-weight: 600 !important;
|
| 476 |
+
padding: 7px 10px !important;
|
| 477 |
+
border-radius: 8px !important;
|
| 478 |
+
border: 1px solid #e2e8f0 !important;
|
| 479 |
+
background: #ffffff !important;
|
| 480 |
+
color: #334155 !important;
|
| 481 |
+
transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
.preset-btn:hover {
|
| 485 |
+
transform: translateY(-1px) !important;
|
| 486 |
+
border-color: #3b82f6 !important;
|
| 487 |
+
color: #2563eb !important;
|
| 488 |
+
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.12) !important;
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
.dark .preset-btn {
|
| 492 |
+
background: #1e293b !important;
|
| 493 |
+
border-color: #334155 !important;
|
| 494 |
+
color: #e2e8f0 !important;
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
.dark .preset-btn:hover {
|
| 498 |
+
background: #334155 !important;
|
| 499 |
+
border-color: #60a5fa !important;
|
| 500 |
+
color: #ffffff !important;
|
| 501 |
+
}
|
| 502 |
+
|
| 503 |
+
/* -------------------------------------------------------------
|
| 504 |
+
TAB NAVIGATION (High-Contrast & Clean Indicator)
|
| 505 |
+
------------------------------------------------------------- */
|
| 506 |
+
div[role="tablist"] {
|
| 507 |
+
gap: 6px !important;
|
| 508 |
+
border-bottom: 2px solid #e2e8f0 !important;
|
| 509 |
+
padding-bottom: 2px !important;
|
| 510 |
+
margin-bottom: 14px !important;
|
| 511 |
+
}
|
| 512 |
+
|
| 513 |
+
.dark div[role="tablist"] {
|
| 514 |
+
border-bottom-color: #334155 !important;
|
| 515 |
+
}
|
| 516 |
+
|
| 517 |
+
button[role="tab"] {
|
| 518 |
font-size: 13px !important;
|
| 519 |
+
font-weight: 600 !important;
|
| 520 |
+
padding: 8px 16px !important;
|
| 521 |
+
border-radius: 8px 8px 0 0 !important;
|
| 522 |
+
color: #64748b !important;
|
| 523 |
+
border: none !important;
|
| 524 |
+
transition: all 0.15s ease !important;
|
| 525 |
}
|
| 526 |
|
| 527 |
+
.dark button[role="tab"] {
|
| 528 |
+
color: #94a3b8 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 529 |
}
|
| 530 |
|
|
|
|
|
|
|
| 531 |
button[role="tab"]:hover {
|
| 532 |
color: #0f172a !important;
|
| 533 |
+
background: rgba(0, 0, 0, 0.03) !important;
|
| 534 |
}
|
| 535 |
|
|
|
|
|
|
|
| 536 |
.dark button[role="tab"]:hover {
|
| 537 |
+
color: #f8fafc !important;
|
| 538 |
+
background: rgba(255, 255, 255, 0.05) !important;
|
| 539 |
}
|
| 540 |
|
|
|
|
|
|
|
| 541 |
button[role="tab"][aria-selected="true"],
|
| 542 |
button[role="tab"].selected {
|
| 543 |
color: #2563eb !important;
|
| 544 |
border-bottom: 3px solid #2563eb !important;
|
| 545 |
+
background: transparent !important;
|
| 546 |
font-weight: 700 !important;
|
| 547 |
}
|
| 548 |
|
|
|
|
|
|
|
| 549 |
.dark button[role="tab"][aria-selected="true"],
|
| 550 |
.dark button[role="tab"].selected {
|
| 551 |
color: #60a5fa !important;
|
| 552 |
+
border-bottom-color: #60a5fa !important;
|
|
|
|
| 553 |
}
|
| 554 |
|
| 555 |
/* -------------------------------------------------------------
|
| 556 |
+
PRIMARY ACTION BUTTON
|
| 557 |
------------------------------------------------------------- */
|
| 558 |
button.primary,
|
| 559 |
+
button[variant="primary"] {
|
| 560 |
+
background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
|
|
|
|
|
|
|
| 561 |
color: #ffffff !important;
|
| 562 |
font-weight: 700 !important;
|
| 563 |
font-size: 14px !important;
|
| 564 |
+
border-radius: 10px !important;
|
| 565 |
+
padding: 12px 24px !important;
|
| 566 |
border: none !important;
|
| 567 |
+
box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3) !important;
|
| 568 |
+
transition: all 0.2s ease !important;
|
| 569 |
}
|
| 570 |
|
| 571 |
button.primary:hover,
|
| 572 |
+
button[variant="primary"]:hover {
|
| 573 |
+
background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
|
| 574 |
+
box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4) !important;
|
| 575 |
+
transform: translateY(-1px) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 576 |
}
|
| 577 |
|
| 578 |
/* -------------------------------------------------------------
|
| 579 |
+
EXECUTIVE SUMMARY & METRIC CARDS
|
| 580 |
------------------------------------------------------------- */
|
| 581 |
.summary-card {
|
| 582 |
background: #ffffff;
|
| 583 |
border: 1px solid #e2e8f0;
|
| 584 |
+
border-radius: 12px;
|
| 585 |
+
padding: 20px;
|
| 586 |
+
margin-bottom: 16px;
|
| 587 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
| 588 |
}
|
| 589 |
|
| 590 |
.dark .summary-card {
|
| 591 |
background: #1e293b !important;
|
| 592 |
border-color: #334155 !important;
|
| 593 |
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
|
| 594 |
}
|
| 595 |
|
| 596 |
.summary-header {
|
| 597 |
display: flex;
|
| 598 |
justify-content: space-between;
|
| 599 |
align-items: center;
|
| 600 |
+
margin-bottom: 12px;
|
| 601 |
+
flex-wrap: wrap;
|
| 602 |
+
gap: 10px;
|
| 603 |
}
|
| 604 |
|
| 605 |
.summary-title {
|
|
|
|
| 625 |
.summary-meta {
|
| 626 |
margin: 4px 0;
|
| 627 |
color: #475569;
|
| 628 |
+
font-size: 13px;
|
| 629 |
}
|
| 630 |
|
| 631 |
.dark .summary-meta {
|
|
|
|
| 649 |
|
| 650 |
.metrics-grid {
|
| 651 |
display: flex;
|
| 652 |
+
gap: 14px;
|
| 653 |
margin-top: 14px;
|
| 654 |
+
flex-wrap: wrap;
|
| 655 |
}
|
| 656 |
|
| 657 |
.metric-box {
|
| 658 |
background: #f8fafc;
|
| 659 |
border: 1px solid #e2e8f0;
|
| 660 |
+
border-radius: 10px;
|
| 661 |
+
padding: 12px 18px;
|
| 662 |
flex: 1;
|
| 663 |
+
min-width: 140px;
|
| 664 |
}
|
| 665 |
|
| 666 |
.dark .metric-box {
|
|
|
|
| 672 |
font-size: 11px;
|
| 673 |
text-transform: uppercase;
|
| 674 |
color: #64748b;
|
| 675 |
+
font-weight: 700;
|
| 676 |
+
letter-spacing: 0.6px;
|
| 677 |
}
|
| 678 |
|
| 679 |
.dark .metric-label {
|
|
|
|
| 681 |
}
|
| 682 |
|
| 683 |
.metric-val {
|
| 684 |
+
font-size: 24px;
|
| 685 |
+
font-weight: 800;
|
| 686 |
margin-top: 4px;
|
| 687 |
}
|
| 688 |
|
|
|
|
| 695 |
}
|
| 696 |
|
| 697 |
/* -------------------------------------------------------------
|
| 698 |
+
ACCORDION & CARDS
|
| 699 |
------------------------------------------------------------- */
|
| 700 |
+
.gr-accordion {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 701 |
border: 1px solid #e2e8f0 !important;
|
| 702 |
+
border-radius: 10px !important;
|
| 703 |
+
background: #f8fafc !important;
|
| 704 |
+
margin: 12px 0 !important;
|
| 705 |
}
|
| 706 |
|
| 707 |
+
.dark .gr-accordion {
|
|
|
|
| 708 |
border-color: #334155 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 709 |
background: #0f172a !important;
|
|
|
|
| 710 |
}
|
| 711 |
|
| 712 |
+
/* Fine Exposure Dark Mode */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 713 |
.dark .fine-liability-card {
|
| 714 |
background: #1e293b !important;
|
| 715 |
border-color: #334155 !important;
|
|
|
|
| 723 |
"""
|
| 724 |
|
| 725 |
with gr.Blocks(title="ReguAI: Neuro-Symbolic AI GRC Engine") as demo:
|
| 726 |
+
# 1. Executive Hero Header (Streamlined & Compact)
|
| 727 |
+
gr.HTML(
|
| 728 |
"""
|
| 729 |
+
<div class="hero-header">
|
| 730 |
+
<div class="hero-title-row">
|
| 731 |
+
<div class="hero-title-group">
|
| 732 |
+
<h1>ποΈ ReguAI</h1>
|
| 733 |
+
<div class="hero-subtitle">Deterministic Neuro-Symbolic AI GRC & Automated Conformity Assessment Engine</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 734 |
</div>
|
| 735 |
+
<div class="hero-badges">
|
| 736 |
+
<span class="hero-pill">πͺπΊ EU AI Act (2024/1689)</span>
|
| 737 |
+
<span class="hero-pill">π W3C SHACL Deterministic</span>
|
| 738 |
+
<span class="hero-pill">π W3C PROV-O</span>
|
| 739 |
+
<span class="hero-pill">π¦ CycloneDX 1.6 AI-BOM</span>
|
| 740 |
+
<span class="hero-pill">π‘οΈ OASIS SARIF 2.1.0</span>
|
|
|
|
| 741 |
</div>
|
| 742 |
</div>
|
| 743 |
+
<div class="workflow-strip">
|
| 744 |
+
<div class="wf-item"><span class="wf-num">1</span><span>Select Scenario</span></div>
|
| 745 |
+
<span class="wf-arrow">β</span>
|
| 746 |
+
<div class="wf-item"><span class="wf-num">2</span><span>Review Grounding</span></div>
|
| 747 |
+
<span class="wf-arrow">β</span>
|
| 748 |
+
<div class="wf-item"><span class="wf-num">3</span><span>Run SHACL Proofs</span></div>
|
| 749 |
+
<span class="wf-arrow">β</span>
|
| 750 |
+
<div class="wf-item"><span class="wf-num">4</span><span>Export Annex IV Package</span></div>
|
| 751 |
</div>
|
| 752 |
</div>
|
| 753 |
"""
|
| 754 |
)
|
| 755 |
|
| 756 |
with gr.Row():
|
| 757 |
+
# =============================================================
|
| 758 |
+
# LEFT COLUMN: System Configuration & Specifications (scale=5)
|
| 759 |
+
# =============================================================
|
| 760 |
with gr.Column(scale=5):
|
| 761 |
+
gr.HTML("<div class='section-label'>β‘ 1-Click Quick Scenarios</div>")
|
| 762 |
with gr.Row():
|
| 763 |
+
preset_samd = gr.Button("π₯ Medical SaMD", size="sm", elem_classes=["preset-btn"])
|
| 764 |
preset_hr = gr.Button("πΌ Failed HR AI", size="sm", elem_classes=["preset-btn"])
|
| 765 |
preset_prohibited = gr.Button("π« Prohibited AI", size="sm", elem_classes=["preset-btn"])
|
| 766 |
preset_gpai = gr.Button("π Frontier GPAI", size="sm", elem_classes=["preset-btn"])
|
| 767 |
+
preset_grid = gr.Button("β‘ Smart Grid", size="sm", elem_classes=["preset-btn"])
|
| 768 |
|
| 769 |
with gr.Row():
|
| 770 |
domain_dropdown = gr.Dropdown(
|
| 771 |
+
label="π Regulatory Sector",
|
| 772 |
choices=DOMAIN_OPTIONS,
|
| 773 |
value=DEFAULT_DOMAIN,
|
| 774 |
scale=6,
|
| 775 |
interactive=True,
|
|
|
|
| 776 |
)
|
| 777 |
case_dropdown = gr.Dropdown(
|
| 778 |
+
label="π AI Benchmark Case Study",
|
| 779 |
choices=DEFAULT_CASE_TITLES,
|
| 780 |
value=DEFAULT_CASE_TITLE,
|
| 781 |
scale=6,
|
| 782 |
interactive=True,
|
|
|
|
| 783 |
)
|
| 784 |
|
| 785 |
quick_bar_box = gr.HTML(
|
| 786 |
value=DEFAULT_QUICK_BAR,
|
| 787 |
+
label="Statutory Summary",
|
| 788 |
)
|
| 789 |
|
| 790 |
with gr.Tabs():
|
| 791 |
+
with gr.TabItem("π Technical Specification"):
|
| 792 |
spec_input = gr.Textbox(
|
| 793 |
label="System Technical Specification (Markdown or JSON - Fully Editable)",
|
| 794 |
+
lines=10,
|
| 795 |
placeholder="Paste AI system architecture or model card text...",
|
| 796 |
value=DEFAULT_SPEC_TEXT,
|
|
|
|
| 797 |
)
|
| 798 |
+
with gr.TabItem("π EUR-Lex Legal Factsheet"):
|
| 799 |
factsheet_box = gr.HTML(
|
| 800 |
value=DEFAULT_FACTSHEET,
|
| 801 |
+
label="Regulatory Factsheet & Provenance",
|
| 802 |
)
|
| 803 |
|
| 804 |
+
# Collapsible settings for decluttering secondary inputs
|
| 805 |
+
with gr.Accordion("βοΈ Corporate Exposure & Auditor Settings (Optional)", open=False):
|
| 806 |
+
with gr.Row():
|
| 807 |
+
turnover_input = gr.Number(
|
| 808 |
+
label="Annual Worldwide Turnover (β¬)",
|
| 809 |
+
value=50000000.0,
|
| 810 |
+
step=5000000.0,
|
| 811 |
+
scale=4,
|
| 812 |
+
info="Art. 99 administrative fine base",
|
| 813 |
+
)
|
| 814 |
+
is_sme_input = gr.Checkbox(
|
| 815 |
+
label="SME Status",
|
| 816 |
+
value=False,
|
| 817 |
+
scale=3,
|
| 818 |
+
info="Art. 99(6) reduced caps",
|
| 819 |
+
)
|
| 820 |
auditor_input = gr.Textbox(
|
| 821 |
label="Auditor Identifier",
|
| 822 |
value="lead_compliance_auditor_01",
|
| 823 |
+
info="Embedded into W3C PROV-O digital ledger",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 824 |
)
|
| 825 |
|
| 826 |
assess_btn = gr.Button("β‘ Run Deterministic Conformity Assessment", variant="primary", size="lg")
|
| 827 |
|
| 828 |
+
# =============================================================
|
| 829 |
+
# RIGHT COLUMN: Structured 4-Tab Results Workspace (scale=7)
|
| 830 |
+
# =============================================================
|
| 831 |
with gr.Column(scale=7):
|
|
|
|
|
|
|
| 832 |
with gr.Tabs():
|
| 833 |
+
# TAB 1: CONFORMITY & FINES
|
| 834 |
+
with gr.TabItem("βοΈ Conformity Proofs & Fines"):
|
| 835 |
+
exec_output = gr.HTML(value=DEFAULT_ASSESSMENT[0], label="Executive Summary")
|
| 836 |
+
fine_liability_output = gr.HTML(value=DEFAULT_ASSESSMENT[11], label="Article 99 Fine Liability")
|
| 837 |
violations_table = gr.Dataframe(
|
| 838 |
headers=["Legal Article", "Normative Requirement", "Severity", "SHACL Path", "Remediation Guidance"],
|
| 839 |
datatype=["str", "str", "str", "str", "str"],
|
|
|
|
| 841 |
label="Mathematical Proof: Non-Conformities Found",
|
| 842 |
)
|
| 843 |
|
| 844 |
+
# TAB 2: GRAPH & CROSSWALK
|
| 845 |
+
with gr.TabItem("πΈοΈ Regulatory Graph & Crosswalk"):
|
| 846 |
+
graph_output = gr.HTML(value=DEFAULT_ASSESSMENT[3], label="Force-Directed Knowledge Graph")
|
| 847 |
+
gr.Markdown("### πͺπΊ EU AI Act β· NIST AI RMF 1.0 β· ISO/IEC 42001:2023 β· GDPR Crosswalk")
|
| 848 |
frameworks_table = gr.Dataframe(
|
| 849 |
headers=["Target Framework", "Control ID", "Control Name", "Status", "Linked AI Act Article", "Audit Guidance"],
|
| 850 |
datatype=["str", "str", "str", "str", "str", "str"],
|
| 851 |
value=DEFAULT_ASSESSMENT[10],
|
| 852 |
+
label="Harmonized Multi-Framework Controls",
|
| 853 |
)
|
| 854 |
|
| 855 |
+
# TAB 3: CLAIMS & ACTIVE LEARNING
|
| 856 |
+
with gr.TabItem("π Claims & Active Learning Triage"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 857 |
claims_table = gr.Dataframe(
|
| 858 |
headers=["Claim ID", "Category", "Status", "Confidence", "Target Article", "Evidence Span"],
|
| 859 |
datatype=["str", "str", "str", "str", "str", "str"],
|
| 860 |
value=DEFAULT_ASSESSMENT[2],
|
| 861 |
+
label="Extracted Regulatory Claims",
|
| 862 |
)
|
| 863 |
+
gr.Markdown("### π€ Borderline Claims Requiring Human Auditor Review")
|
|
|
|
|
|
|
| 864 |
borderline_table = gr.Dataframe(
|
| 865 |
headers=["Claim ID", "Category", "Status", "Confidence", "Evidence Quote"],
|
| 866 |
datatype=["str", "str", "str", "str", "str"],
|
| 867 |
value=DEFAULT_ASSESSMENT[9],
|
| 868 |
)
|
| 869 |
with gr.Row():
|
| 870 |
+
triage_claim_id = gr.Textbox(label="Claim ID", placeholder="e.g. clm_001", scale=3)
|
| 871 |
+
triage_status = gr.Dropdown(label="Verified Status", choices=[s.value for s in AssertionStatus], value="IMPLEMENTED", scale=4)
|
| 872 |
+
triage_cat = gr.Dropdown(label="Verified Category", choices=[c.value for c in EntityCategory], value="HUMAN_OVERSIGHT", scale=5)
|
| 873 |
+
with gr.Row():
|
| 874 |
+
triage_notes = gr.Textbox(label="Auditor Rationale", placeholder="Explain reason for modification...", scale=8)
|
| 875 |
+
triage_btn = gr.Button("Submit Triplet", scale=4)
|
| 876 |
triage_result = gr.Markdown()
|
| 877 |
|
| 878 |
+
# TAB 4: EXPORT DELIVERABLES PACKAGE
|
| 879 |
+
with gr.TabItem("π¦ Export Deliverables"):
|
|
|
|
|
|
|
|
|
|
| 880 |
with gr.Tabs():
|
| 881 |
+
with gr.TabItem("π Attestation Certificate (HTML)"):
|
| 882 |
cert_html_output = gr.HTML(value=DEFAULT_ASSESSMENT[8])
|
|
|
|
|
|
|
|
|
|
|
|
|
| 883 |
with gr.TabItem("π¦ CycloneDX 1.6 AI-BOM"):
|
| 884 |
bom_display = gr.Code(value=DEFAULT_ASSESSMENT[12], language="json", label="CycloneDX 1.6 Machine-Readable AI-BOM")
|
| 885 |
with gr.TabItem("π‘οΈ OASIS SARIF 2.1.0 Report"):
|
| 886 |
sarif_display = gr.Code(value=DEFAULT_ASSESSMENT[13], language="json", label="OASIS SARIF 2.1.0 Static Analysis Report")
|
| 887 |
+
with gr.TabItem("π Annex IV Report (Markdown)"):
|
| 888 |
+
report_markdown = gr.Markdown(value=DEFAULT_ASSESSMENT[7])
|
| 889 |
+
with gr.TabItem("Machine-Readable JSON-LD"):
|
| 890 |
+
jsonld_display = gr.Code(value=DEFAULT_ASSESSMENT[6], language="json", label="W3C JSON-LD Digital Certificate")
|
| 891 |
+
with gr.TabItem("π W3C PROV-O Ledger"):
|
| 892 |
+
token_display = gr.Textbox(value=DEFAULT_ASSESSMENT[4], label="Official Digital Conformity Token", interactive=False)
|
| 893 |
+
ledger_display = gr.Markdown(value=DEFAULT_ASSESSMENT[5])
|
| 894 |
|
| 895 |
+
# Preset outputs list (19 components in exact alignment)
|
| 896 |
preset_outputs = [
|
| 897 |
domain_dropdown,
|
| 898 |
case_dropdown,
|
data/active_learning_triplets.jsonl
CHANGED
|
@@ -20,3 +20,4 @@
|
|
| 20 |
{"timestamp": "2026-09-21T14:46:20.754528+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."}
|
| 21 |
{"timestamp": "2026-09-21T14:47:50.118531+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."}
|
| 22 |
{"timestamp": "2026-09-21T14:48:40.951594+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."}
|
|
|
|
|
|
| 20 |
{"timestamp": "2026-09-21T14:46:20.754528+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."}
|
| 21 |
{"timestamp": "2026-09-21T14:47:50.118531+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."}
|
| 22 |
{"timestamp": "2026-09-21T14:48:40.951594+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."}
|
| 23 |
+
{"timestamp": "2026-09-21T15:05:44.655438+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."}
|