Spaces:
Sleeping
Sleeping
inoki-giskard
commited on
Commit
·
0e3ffcc
1
Parent(s):
1b0298e
Improve wordings for non-existing IDs
Browse files- text_classification_ui_helpers.py +8 -2
- wordings.py +6 -2
text_classification_ui_helpers.py
CHANGED
@@ -28,6 +28,7 @@ from wordings import (
|
|
28 |
CHECK_CONFIG_OR_SPLIT_RAW,
|
29 |
CONFIRM_MAPPING_DETAILS_FAIL_RAW,
|
30 |
MAPPING_STYLED_ERROR_WARNING,
|
|
|
31 |
NOT_FOUND_MODEL_RAW,
|
32 |
NOT_TEXT_CLASSIFICATION_MODEL_RAW,
|
33 |
UNMATCHED_MODEL_DATASET_STYLED_ERROR,
|
@@ -91,10 +92,15 @@ def check_dataset(dataset_id):
|
|
91 |
)
|
92 |
except Exception as e:
|
93 |
logger.warning(f"Check your dataset {dataset_id}: {e}")
|
94 |
-
if "doesn't exist" in str(e):
|
|
|
|
|
|
|
95 |
gr.Warning(get_dataset_fetch_error_raw(e))
|
96 |
-
|
|
|
97 |
gr.Warning(get_dataset_fetch_error_raw(e))
|
|
|
98 |
return (gr.update(visible=False), gr.update(visible=False), "")
|
99 |
|
100 |
|
|
|
28 |
CHECK_CONFIG_OR_SPLIT_RAW,
|
29 |
CONFIRM_MAPPING_DETAILS_FAIL_RAW,
|
30 |
MAPPING_STYLED_ERROR_WARNING,
|
31 |
+
NOT_FOUND_DATASET_RAW,
|
32 |
NOT_FOUND_MODEL_RAW,
|
33 |
NOT_TEXT_CLASSIFICATION_MODEL_RAW,
|
34 |
UNMATCHED_MODEL_DATASET_STYLED_ERROR,
|
|
|
92 |
)
|
93 |
except Exception as e:
|
94 |
logger.warning(f"Check your dataset {dataset_id}: {e}")
|
95 |
+
if "doesn't exist on the Hub or cannot be accessed" in str(e):
|
96 |
+
gr.Warning(NOT_FOUND_DATASET_RAW)
|
97 |
+
elif "forbidden" in str(e).lower():
|
98 |
+
# GSK-2770: illegal name
|
99 |
gr.Warning(get_dataset_fetch_error_raw(e))
|
100 |
+
else:
|
101 |
+
# Unknown error
|
102 |
gr.Warning(get_dataset_fetch_error_raw(e))
|
103 |
+
|
104 |
return (gr.update(visible=False), gr.update(visible=False), "")
|
105 |
|
106 |
|
wordings.py
CHANGED
@@ -73,7 +73,7 @@ UNMATCHED_MODEL_DATASET_STYLED_ERROR = """
|
|
73 |
"""
|
74 |
|
75 |
NOT_FOUND_MODEL_RAW = """
|
76 |
-
We cannot find your model on Hugging Face. Please
|
77 |
"""
|
78 |
|
79 |
NOT_TEXT_CLASSIFICATION_MODEL_RAW = """
|
@@ -111,5 +111,9 @@ VALIDATED_MODEL_DATASET_STYLED = """
|
|
111 |
</h3>"""
|
112 |
|
113 |
|
|
|
|
|
|
|
|
|
114 |
def get_dataset_fetch_error_raw(error):
|
115 |
-
return f"""Sorry you cannot use this dataset because
|
|
|
73 |
"""
|
74 |
|
75 |
NOT_FOUND_MODEL_RAW = """
|
76 |
+
We cannot find your model on Hugging Face. Please check that the model id is correct and publicly accessible.
|
77 |
"""
|
78 |
|
79 |
NOT_TEXT_CLASSIFICATION_MODEL_RAW = """
|
|
|
111 |
</h3>"""
|
112 |
|
113 |
|
114 |
+
NOT_FOUND_DATASET_RAW = """
|
115 |
+
We cannot find your dataset on Hugging Face. Please check that the dataset id is correct and publicly accessible.
|
116 |
+
"""
|
117 |
+
|
118 |
def get_dataset_fetch_error_raw(error):
|
119 |
+
return f"""Sorry you cannot use this dataset because of an unknwon error: "{error}"."""
|