Spaces:
Sleeping
Sleeping
ZeroCommand
commited on
Commit
·
4434857
1
Parent(s):
1b0a56b
clean up and change run btn|
Browse files- app_text_classification.py +6 -16
- wordings.py +4 -0
app_text_classification.py
CHANGED
@@ -11,7 +11,7 @@ from transformers.pipelines import TextClassificationPipeline
|
|
11 |
|
12 |
from text_classification import get_labels_and_features_from_dataset, check_model, get_example_prediction, check_column_mapping_keys_validity, text_classification_fix_column_mapping
|
13 |
from utils import read_scanners, write_scanners, read_inference_type, read_column_mapping, write_column_mapping, write_inference_type, convert_column_mapping_to_json
|
14 |
-
from wordings import CONFIRM_MAPPING_DETAILS_MD, CONFIRM_MAPPING_DETAILS_FAIL_MD
|
15 |
|
16 |
HF_REPO_ID = 'HF_REPO_ID'
|
17 |
HF_SPACE_ID = 'SPACE_ID'
|
@@ -28,15 +28,15 @@ def try_submit(m_id, d_id, config, split, local):
|
|
28 |
all_mappings = read_column_mapping(CONFIG_PATH)
|
29 |
|
30 |
if "labels" not in all_mappings.keys():
|
31 |
-
|
|
|
32 |
label_mapping = all_mappings["labels"]
|
33 |
|
34 |
if "features" not in all_mappings.keys():
|
35 |
-
|
|
|
36 |
feature_mapping = all_mappings["features"]
|
37 |
|
38 |
-
print(label_mapping, feature_mapping)
|
39 |
-
|
40 |
# TODO: Set column mapping for some dataset such as `amazon_polarity`
|
41 |
if local:
|
42 |
command = [
|
@@ -225,18 +225,8 @@ def get_demo():
|
|
225 |
|
226 |
gr.on(
|
227 |
triggers=[
|
228 |
-
model_id_input.change,
|
229 |
-
dataset_id_input.change,
|
230 |
-
dataset_config_input.change,
|
231 |
-
dataset_split_input.change,
|
232 |
run_btn.click,
|
233 |
],
|
234 |
fn=try_submit,
|
235 |
inputs=[model_id_input, dataset_id_input, dataset_config_input, dataset_split_input, run_local],
|
236 |
-
outputs=[run_btn])
|
237 |
-
|
238 |
-
# gr.on(
|
239 |
-
# triggers=[label.change for label in column_mappings],
|
240 |
-
# fn=try_submit,
|
241 |
-
# inputs=[model_id_input, dataset_id_input, dataset_config_input, dataset_split_input, run_local],
|
242 |
-
# outputs=[run_btn])
|
|
|
11 |
|
12 |
from text_classification import get_labels_and_features_from_dataset, check_model, get_example_prediction, check_column_mapping_keys_validity, text_classification_fix_column_mapping
|
13 |
from utils import read_scanners, write_scanners, read_inference_type, read_column_mapping, write_column_mapping, write_inference_type, convert_column_mapping_to_json
|
14 |
+
from wordings import CONFIRM_MAPPING_DETAILS_MD, CONFIRM_MAPPING_DETAILS_FAIL_MD, CONFIRM_MAPPING_DETAILS_FAIL_RAW
|
15 |
|
16 |
HF_REPO_ID = 'HF_REPO_ID'
|
17 |
HF_SPACE_ID = 'SPACE_ID'
|
|
|
28 |
all_mappings = read_column_mapping(CONFIG_PATH)
|
29 |
|
30 |
if "labels" not in all_mappings.keys():
|
31 |
+
gr.Warning(CONFIRM_MAPPING_DETAILS_FAIL_RAW)
|
32 |
+
return gr.update(interactive=True)
|
33 |
label_mapping = all_mappings["labels"]
|
34 |
|
35 |
if "features" not in all_mappings.keys():
|
36 |
+
gr.Warning(CONFIRM_MAPPING_DETAILS_FAIL_RAW)
|
37 |
+
return gr.update(interactive=True)
|
38 |
feature_mapping = all_mappings["features"]
|
39 |
|
|
|
|
|
40 |
# TODO: Set column mapping for some dataset such as `amazon_polarity`
|
41 |
if local:
|
42 |
command = [
|
|
|
225 |
|
226 |
gr.on(
|
227 |
triggers=[
|
|
|
|
|
|
|
|
|
228 |
run_btn.click,
|
229 |
],
|
230 |
fn=try_submit,
|
231 |
inputs=[model_id_input, dataset_id_input, dataset_config_input, dataset_split_input, run_local],
|
232 |
+
outputs=[run_btn])
|
|
|
|
|
|
|
|
|
|
|
|
wordings.py
CHANGED
@@ -10,4 +10,8 @@ CONFIRM_MAPPING_DETAILS_FAIL_MD = '''
|
|
10 |
Confirm Pre-processing Details
|
11 |
</h1>
|
12 |
Sorry, we cannot align the input/output of your dataset with the model. <b>Pleaser double check your model and dataset.</b>
|
|
|
|
|
|
|
|
|
13 |
'''
|
|
|
10 |
Confirm Pre-processing Details
|
11 |
</h1>
|
12 |
Sorry, we cannot align the input/output of your dataset with the model. <b>Pleaser double check your model and dataset.</b>
|
13 |
+
'''
|
14 |
+
|
15 |
+
CONFIRM_MAPPING_DETAILS_FAIL_RAW= '''
|
16 |
+
Sorry, we cannot align the input/output of your dataset with the model. Pleaser double check your model and dataset.
|
17 |
'''
|