Spaces:
Running
Running
Commit
·
0942332
1
Parent(s):
36dd5f3
Add feature mapping and label mapping
Browse files
app.py
CHANGED
@@ -152,7 +152,15 @@ def try_validate(model_id, dataset_id, dataset_config, dataset_split, column_map
|
|
152 |
)
|
153 |
|
154 |
|
155 |
-
def try_submit(m_id, d_id, config, split, local):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
if local:
|
157 |
command = [
|
158 |
"python",
|
@@ -166,6 +174,8 @@ def try_submit(m_id, d_id, config, split, local):
|
|
166 |
"--discussion_repo", os.environ.get(HF_REPO_ID) or os.environ.get(HF_SPACE_ID),
|
167 |
"--output_format", "markdown",
|
168 |
"--output_portal", "huggingface",
|
|
|
|
|
169 |
]
|
170 |
|
171 |
eval_str = f"[{m_id}]<{d_id}({config}, {split} set)>"
|
@@ -273,6 +283,7 @@ with gr.Blocks(theme=theme) as iface:
|
|
273 |
dataset_id_input,
|
274 |
dataset_config_input,
|
275 |
dataset_split_input,
|
|
|
276 |
run_local,
|
277 |
],
|
278 |
)
|
|
|
152 |
)
|
153 |
|
154 |
|
155 |
+
def try_submit(m_id, d_id, config, split, column_mappings, local):
|
156 |
+
label_mapping = {}
|
157 |
+
try:
|
158 |
+
column_mapping = json.loads(column_mappings)
|
159 |
+
if "label" in column_mapping:
|
160 |
+
label_mapping = column_mapping.pop("label", {})
|
161 |
+
except Exception:
|
162 |
+
column_mapping = {}
|
163 |
+
|
164 |
if local:
|
165 |
command = [
|
166 |
"python",
|
|
|
174 |
"--discussion_repo", os.environ.get(HF_REPO_ID) or os.environ.get(HF_SPACE_ID),
|
175 |
"--output_format", "markdown",
|
176 |
"--output_portal", "huggingface",
|
177 |
+
"--feature_mapping", json.dumps(column_mapping),
|
178 |
+
"--label_mapping", json.dumps(label_mapping),
|
179 |
]
|
180 |
|
181 |
eval_str = f"[{m_id}]<{d_id}({config}, {split} set)>"
|
|
|
283 |
dataset_id_input,
|
284 |
dataset_config_input,
|
285 |
dataset_split_input,
|
286 |
+
column_mapping_input,
|
287 |
run_local,
|
288 |
],
|
289 |
)
|