ZeroCommand commited on
Commit
c680d9a
1 Parent(s): 4b59401

add persistent error code when number of labels not matching

Browse files
Files changed (2) hide show
  1. text_classification_ui_helpers.py +2 -3
  2. wordings.py +7 -5
text_classification_ui_helpers.py CHANGED
@@ -23,7 +23,7 @@ from wordings import (
23
  CONFIRM_MAPPING_DETAILS_FAIL_RAW,
24
  MAPPING_STYLED_ERROR_WARNING,
25
  NOT_TEXT_CLASSIFICATION_MODEL_RAW,
26
- UNMATCHED_MODEL_DATASET,
27
  CHECK_LOG_SECTION_RAW,
28
  get_styled_input,
29
  )
@@ -257,9 +257,8 @@ def align_columns_and_show_prediction(
257
  )
258
 
259
  if len(ds_labels) != len(model_labels):
260
- gr.Warning(UNMATCHED_MODEL_DATASET)
261
  return (
262
- gr.update(visible=False),
263
  gr.update(visible=False),
264
  gr.update(visible=False, open=False),
265
  gr.update(interactive=False),
 
23
  CONFIRM_MAPPING_DETAILS_FAIL_RAW,
24
  MAPPING_STYLED_ERROR_WARNING,
25
  NOT_TEXT_CLASSIFICATION_MODEL_RAW,
26
+ UNMATCHED_MODEL_DATASET_STYLED_ERROR,
27
  CHECK_LOG_SECTION_RAW,
28
  get_styled_input,
29
  )
 
257
  )
258
 
259
  if len(ds_labels) != len(model_labels):
 
260
  return (
261
+ gr.update(value=UNMATCHED_MODEL_DATASET_STYLED_ERROR, visible=True),
262
  gr.update(visible=False),
263
  gr.update(visible=False, open=False),
264
  gr.update(interactive=False),
wordings.py CHANGED
@@ -17,10 +17,6 @@ CONFIRM_MAPPING_DETAILS_FAIL_MD = """
17
  Sorry, we cannot align the input/output of your dataset with the model. <b>Pleaser double check your model and dataset.</b>
18
  """
19
 
20
- UNMATCHED_MODEL_DATASET = """
21
- Model prediction labels do not align with the labels present in the dataset. Please double check your model and dataset.
22
- """
23
-
24
  CONFIRM_MAPPING_DETAILS_FAIL_RAW = """
25
  Sorry, we cannot auto-align the input/output of your dataset with the model.
26
  """
@@ -41,11 +37,17 @@ PREDICTION_SAMPLE_MD = """
41
  """
42
 
43
  MAPPING_STYLED_ERROR_WARNING = """
44
- <h3 style="text-align: center;color: coral; background-color: #fff0f3; border-radius: 8px; padding: 10px; ">
45
  Sorry, we cannot auto-align the labels/features of your dataset and model. Please double check.
46
  </h3>
47
  """
48
 
 
 
 
 
 
 
49
  NOT_TEXT_CLASSIFICATION_MODEL_RAW = """
50
  Your model does not fall under the category of text classification. This page is specifically designated for the evaluation of text classification models.
51
  """
 
17
  Sorry, we cannot align the input/output of your dataset with the model. <b>Pleaser double check your model and dataset.</b>
18
  """
19
 
 
 
 
 
20
  CONFIRM_MAPPING_DETAILS_FAIL_RAW = """
21
  Sorry, we cannot auto-align the input/output of your dataset with the model.
22
  """
 
37
  """
38
 
39
  MAPPING_STYLED_ERROR_WARNING = """
40
+ <h3 style="text-align: center;color: orange; background-color: #fff0f3; border-radius: 8px; padding: 10px; ">
41
  Sorry, we cannot auto-align the labels/features of your dataset and model. Please double check.
42
  </h3>
43
  """
44
 
45
+ UNMATCHED_MODEL_DATASET_STYLED_ERROR = """
46
+ <h3 style="text-align: center;color: #fa5f5f; background-color: #fbe2e2; border-radius: 8px; padding: 10px; ">
47
+ Your model and dataset have different numbers of labels. Please double check your model and dataset.
48
+ </h3>
49
+ """
50
+
51
  NOT_TEXT_CLASSIFICATION_MODEL_RAW = """
52
  Your model does not fall under the category of text classification. This page is specifically designated for the evaluation of text classification models.
53
  """