ZeroCommand commited on
Commit
40a3acd
1 Parent(s): 96a1184

fix layout and prediction token

Browse files
Files changed (2) hide show
  1. text_classification_ui_helpers.py +1 -10
  2. wordings.py +2 -0
text_classification_ui_helpers.py CHANGED
@@ -21,7 +21,6 @@ from text_classification import (
21
  preload_hf_inference_api,
22
  get_example_prediction,
23
  get_labels_and_features_from_dataset,
24
- check_hf_token_validity,
25
  HuggingFaceInferenceAPIResponse,
26
  )
27
  from wordings import (
@@ -271,11 +270,9 @@ def align_columns_and_show_prediction(
271
  dropdown_placement = [
272
  gr.Dropdown(visible=False) for _ in range(MAX_LABELS + MAX_FEATURES)
273
  ]
274
-
275
- hf_token = os.environ.get(HF_WRITE_TOKEN, default="")
276
 
277
  prediction_input, prediction_response = get_example_prediction(
278
- model_id, dataset_id, dataset_config, dataset_split, hf_token
279
  )
280
 
281
  if prediction_input is None or prediction_response is None:
@@ -412,12 +409,6 @@ def construct_label_and_feature_mapping(all_mappings, ds_labels, ds_features, la
412
  feature_mapping.update({"label": label_keys[0]})
413
  return label_mapping, feature_mapping
414
 
415
- def show_hf_token_info(token):
416
- valid = check_hf_token_validity(token)
417
- if not valid:
418
- return gr.update(visible=True)
419
- return gr.update(visible=False)
420
-
421
  def try_submit(m_id, d_id, config, split, uid, profile: gr.OAuthProfile | None, oath_token: gr.OAuthToken | None):
422
  all_mappings = read_column_mapping(uid)
423
  if not check_column_mapping_keys_validity(all_mappings):
 
21
  preload_hf_inference_api,
22
  get_example_prediction,
23
  get_labels_and_features_from_dataset,
 
24
  HuggingFaceInferenceAPIResponse,
25
  )
26
  from wordings import (
 
270
  dropdown_placement = [
271
  gr.Dropdown(visible=False) for _ in range(MAX_LABELS + MAX_FEATURES)
272
  ]
 
 
273
 
274
  prediction_input, prediction_response = get_example_prediction(
275
+ model_id, dataset_id, dataset_config, dataset_split, oauth_token.token
276
  )
277
 
278
  if prediction_input is None or prediction_response is None:
 
409
  feature_mapping.update({"label": label_keys[0]})
410
  return label_mapping, feature_mapping
411
 
 
 
 
 
 
 
412
  def try_submit(m_id, d_id, config, split, uid, profile: gr.OAuthProfile | None, oath_token: gr.OAuthToken | None):
413
  all_mappings = read_column_mapping(uid)
414
  if not check_column_mapping_keys_validity(all_mappings):
wordings.py CHANGED
@@ -6,9 +6,11 @@ INTRODUCTION_MD = """
6
  You can also checkout our library documentation <a href="https://docs.giskard.ai/en/latest/getting_started/quickstart/index.html">here</a>.
7
  """
8
  CONFIRM_MAPPING_DETAILS_MD = """
 
9
  <h1 style="text-align: center;">
10
  Confirm Pre-processing Details
11
  </h1>
 
12
  Make sure the output variable's labels and the input variable's name are accurately mapped across both the dataset and the model. You can select the output variable's labels from the dropdowns below.
13
  """
14
  CONFIRM_MAPPING_DETAILS_FAIL_MD = """
 
6
  You can also checkout our library documentation <a href="https://docs.giskard.ai/en/latest/getting_started/quickstart/index.html">here</a>.
7
  """
8
  CONFIRM_MAPPING_DETAILS_MD = """
9
+ <div style="display: flex; justify-content: center;"><h1>
10
  <h1 style="text-align: center;">
11
  Confirm Pre-processing Details
12
  </h1>
13
+ </div>
14
  Make sure the output variable's labels and the input variable's name are accurately mapped across both the dataset and the model. You can select the output variable's labels from the dropdowns below.
15
  """
16
  CONFIRM_MAPPING_DETAILS_FAIL_MD = """