File size: 1,180 Bytes
11bd448
25bf2cc
11bd448
 
 
25bf2cc
 
 
11bd448
 
25bf2cc
b4f5e30
11bd448
25bf2cc
11bd448
 
25bf2cc
 
 
11bd448
 
 
 
25bf2cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11bd448
25bf2cc
 
 
 
 
11bd448
25bf2cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import gradio as gr

from compliance_checks import (
    ComplianceSuite,
    ModelProviderIdentityCheck,
    IntendedPurposeCheck,
    GeneralLimitationsCheck,
    ComputationalRequirementsCheck,
)

from bloom_card import bloom_card


def run_compliance_check(model_card: str):
    suite = ComplianceSuite(checks=[
        ModelProviderIdentityCheck(),
        IntendedPurposeCheck(),
        GeneralLimitationsCheck(),
        ComputationalRequirementsCheck(),
    ])

    results = suite.run(model_card)

    return str([r[0] for r in results])


with gr.Blocks() as demo:
    gr.Markdown("""\
    # Model Card Validator
    Following Article 13 of the EU AI Act
    """)

    with gr.Row():
        with gr.Column():
            model_card_box = gr.TextArea()
            populate_sample = gr.Button(value="Populate Sample")
            submit = gr.Button()

        with gr.Column():
            results_list = gr.Text()

    submit.click(
        fn=run_compliance_check,
        inputs=[model_card_box],
        outputs=[results_list]
    )

    populate_sample.click(
        fn=lambda: bloom_card,
        inputs=[],
        outputs=[model_card_box]
    )

demo.launch()