ZeroCommand commited on
Commit
5704515
1 Parent(s): 9ca668d

fix markdown load html freeze bug

Browse files
app_text_classification.py CHANGED
@@ -42,7 +42,7 @@ def get_demo(demo):
42
  dataset_split_input = gr.Dropdown(label="Dataset Split", visible=False)
43
 
44
  with gr.Row():
45
- example_input = gr.Markdown("Example Input", visible=False)
46
  with gr.Row():
47
  example_prediction = gr.Label(label="Model Prediction Sample", visible=False)
48
 
 
42
  dataset_split_input = gr.Dropdown(label="Dataset Split", visible=False)
43
 
44
  with gr.Row():
45
+ example_input = gr.HTML(visible=False)
46
  with gr.Row():
47
  example_prediction = gr.Label(label="Model Prediction Sample", visible=False)
48
 
text_classification_ui_helpers.py CHANGED
@@ -7,6 +7,7 @@ import threading
7
  import datasets
8
  import gradio as gr
9
  from transformers.pipelines import TextClassificationPipeline
 
10
 
11
  from io_utils import (get_yaml_path, read_column_mapping, save_job_to_pipe,
12
  write_column_mapping, write_inference_type,
@@ -181,7 +182,7 @@ def check_model_and_show_prediction(
181
  ppl, dataset_id, dataset_config, dataset_split
182
  )
183
  return (
184
- gr.update(value=prediction_input, visible=True),
185
  gr.update(value=prediction_output, visible=True),
186
  gr.update(visible=True, open=False),
187
  *column_mappings,
 
7
  import datasets
8
  import gradio as gr
9
  from transformers.pipelines import TextClassificationPipeline
10
+ from wordings import get_styled_input
11
 
12
  from io_utils import (get_yaml_path, read_column_mapping, save_job_to_pipe,
13
  write_column_mapping, write_inference_type,
 
182
  ppl, dataset_id, dataset_config, dataset_split
183
  )
184
  return (
185
+ gr.update(value=get_styled_input(prediction_input), visible=True),
186
  gr.update(value=prediction_output, visible=True),
187
  gr.update(visible=True, open=False),
188
  *column_mappings,
wordings.py CHANGED
@@ -37,3 +37,8 @@ MAPPING_STYLED_ERROR_WARNING = """
37
  Sorry, we cannot auto-align the labels/features of your dataset and model. Please double check.
38
  </h3>
39
  """
 
 
 
 
 
 
37
  Sorry, we cannot auto-align the labels/features of your dataset and model. Please double check.
38
  </h3>
39
  """
40
+
41
+ def get_styled_input(input):
42
+ return f"""<h3 style="text-align: center;color: #5ec26a; background-color: #e2fbe8; border-radius: 8px; padding: 10px; ">
43
+ Sample input: {input}
44
+ </h3>"""