File size: 4,239 Bytes
c33448f
 
088f179
c33448f
088f179
c33448f
 
 
 
 
088f179
c33448f
 
 
 
 
088f179
6ce8c6e
 
c33448f
088f179
c33448f
 
 
088f179
c33448f
 
6ce8c6e
87119af
6ce8c6e
 
c33448f
 
 
 
088f179
c33448f
 
 
fb18007
088f179
c33448f
fb18007
 
 
 
088f179
fb18007
c33448f
 
 
 
 
 
 
088f179
c33448f
 
 
088f179
c33448f
 
87119af
088f179
87119af
088f179
87119af
 
088f179
 
 
c33448f
 
87119af
c33448f
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
INTRODUCTION_MD = """
                <h1 style="text-align: center;">
                🐢Giskard Evaluator - Text Classification
                </h1>
                Welcome to the Giskard Evaluator Space! Get a model vulnerability report immediately by simply sharing your model and dataset id below.
                """
CONFIRM_MAPPING_DETAILS_MD = """
                            <h1 style="text-align: center;">
                            Confirm Pre-processing Details
                            </h1>
                            Make sure the output variable's labels and the input variable's name are accurately mapped across both the dataset and the model.
                            """
CONFIRM_MAPPING_DETAILS_FAIL_MD = """
                            <h1 style="text-align: center;">
                            Confirm Pre-processing Details
                            </h1>
                            We're unable to automatically map the input variable's name and output variable's labels of your dataset with the model's. <b>Please manually check the mapping below.</b>
                            """

CONFIRM_MAPPING_DETAILS_FAIL_RAW = """
                            We're unable to automatically map the input variable's name and output variable's labels of your dataset with the model's. <b>Please manually check the mapping below.</b>
                            """

CHECK_CONFIG_OR_SPLIT_RAW = """
                            We're unanle to extract labels or features from your dataset. Please check your dataset config or split selection.
                            """

CHECK_LOG_SECTION_RAW = """
                          Your have successfully submitted a Giskard evaluation. Further details are available in the Logs tab. You can find your report will be posted to your model's community discussion.
                        """

PREDICTION_SAMPLE_MD = """
                        <h1 style="text-align: center;">
                        Model Prediction Sample
                        </h1>
                        Here's a sample of your model's prediction on an example from the dataset.
                        """

MAPPING_STYLED_ERROR_WARNING = """
                        <h3 style="text-align: center;color: orange; background-color: #fff0f3; border-radius: 8px; padding: 10px; ">
                        ⚠️ We're unable to automatically map the input variable's name and output variable's labels of your dataset with the model's. <b>Please manually check the mapping below.</b>
                        </h3>
                        """

UNMATCHED_MODEL_DATASET_STYLED_ERROR = """
                        <h3 style="text-align: center;color: #fa5f5f; background-color: #fbe2e2; border-radius: 8px; padding: 10px; ">
                        ❌ Your model and dataset have different numbers of labels. Please double check your model and dataset.
                        </h3>
                        """

NOT_TEXT_CLASSIFICATION_MODEL_RAW = """
                        Your model does not fall under the category of text classification. This page is specifically designated for the evaluation of text classification models.  
                      """

USE_INFERENCE_API_TIP = """
                To speed up the evaluation, we recommend using the
                <a href="https://huggingface.co/docs/api-inference/detailed_parameters#text-classification-task">
                    Hugging Face Inference API
                </a>
                . Please input your <a href="https://huggingface.co/settings/tokens">Hugging Face token</a> to do so.
            """

HF_TOKEN_INVALID_STYLED= """
                <p style="text-align: left;color: red; ">
                Your Hugging Face token is invalid. Please double check your token.
                </p>
                """

def get_dataset_fetch_error_raw(error):
    return f"""Sorry you cannot use this dataset because {error}. Contact HF team to support this dataset."""

def get_styled_input(input):
    return f"""<h3 style="text-align: center;color: #4ca154; background-color: #e2fbe8; border-radius: 8px; padding: 10px; ">
            Your model and dataset have been validated! <br /> Sample input: {input}
            </h3>"""