Spaces:
Sleeping
Sleeping
ZeroCommand
commited on
Commit
•
b56bfdc
1
Parent(s):
5311dba
GSK-2831-fix-wrong-warnings-pop-up (#126)
Browse files- Create file and reset scanners after submission (37729f3f26a8dceba24cd4224380191628eea937)
- read from old scanners and set in new config file) (78b136ddd35a254e281a6ff0d91c2d3c7053abc4)
app_text_classification.py
CHANGED
@@ -251,7 +251,15 @@ def get_demo():
|
|
251 |
inference_token,
|
252 |
uid_label,
|
253 |
],
|
254 |
-
outputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
)
|
256 |
|
257 |
gr.on(
|
|
|
251 |
inference_token,
|
252 |
uid_label,
|
253 |
],
|
254 |
+
outputs=[
|
255 |
+
run_btn,
|
256 |
+
logs,
|
257 |
+
uid_label,
|
258 |
+
validation_result,
|
259 |
+
example_input,
|
260 |
+
example_prediction,
|
261 |
+
column_mapping_accordion,
|
262 |
+
],
|
263 |
)
|
264 |
|
265 |
gr.on(
|
text_classification_ui_helpers.py
CHANGED
@@ -8,7 +8,12 @@ import gradio as gr
|
|
8 |
import pandas as pd
|
9 |
|
10 |
import leaderboard
|
11 |
-
from io_utils import
|
|
|
|
|
|
|
|
|
|
|
12 |
from run_jobs import save_job_to_pipe
|
13 |
from text_classification import (
|
14 |
strip_model_id_from_url,
|
@@ -356,11 +361,12 @@ def align_columns_and_show_prediction(
|
|
356 |
|
357 |
def check_column_mapping_keys_validity(all_mappings):
|
358 |
if all_mappings is None:
|
|
|
359 |
gr.Warning(CONFIRM_MAPPING_DETAILS_FAIL_RAW)
|
360 |
return False
|
361 |
|
362 |
if "labels" not in all_mappings.keys():
|
363 |
-
|
364 |
return False
|
365 |
|
366 |
return True
|
@@ -396,6 +402,7 @@ def construct_label_and_feature_mapping(all_mappings, ds_labels, ds_features):
|
|
396 |
label_mapping.update({str(i): all_mappings["labels"][label]})
|
397 |
|
398 |
if "features" not in all_mappings.keys():
|
|
|
399 |
gr.Warning(CONFIRM_MAPPING_DETAILS_FAIL_RAW)
|
400 |
feature_mapping = all_mappings["features"]
|
401 |
return label_mapping, feature_mapping
|
@@ -435,8 +442,16 @@ def try_submit(m_id, d_id, config, split, inference, inference_token, uid):
|
|
435 |
)
|
436 |
gr.Info("Your evaluation has been submitted")
|
437 |
|
|
|
|
|
|
|
|
|
438 |
return (
|
439 |
gr.update(interactive=False), # Submit button
|
440 |
gr.update(value=f"{CHECK_LOG_SECTION_RAW}Your job id is: {uid}. ", lines=5, visible=True, interactive=False),
|
441 |
-
|
|
|
|
|
|
|
|
|
442 |
)
|
|
|
8 |
import pandas as pd
|
9 |
|
10 |
import leaderboard
|
11 |
+
from io_utils import (
|
12 |
+
read_column_mapping,
|
13 |
+
write_column_mapping,
|
14 |
+
read_scanners,
|
15 |
+
write_scanners,
|
16 |
+
)
|
17 |
from run_jobs import save_job_to_pipe
|
18 |
from text_classification import (
|
19 |
strip_model_id_from_url,
|
|
|
361 |
|
362 |
def check_column_mapping_keys_validity(all_mappings):
|
363 |
if all_mappings is None:
|
364 |
+
logger.warning("all_mapping is None")
|
365 |
gr.Warning(CONFIRM_MAPPING_DETAILS_FAIL_RAW)
|
366 |
return False
|
367 |
|
368 |
if "labels" not in all_mappings.keys():
|
369 |
+
logger.warning(f"Label mapping is not valid, all_mappings: {all_mappings}")
|
370 |
return False
|
371 |
|
372 |
return True
|
|
|
402 |
label_mapping.update({str(i): all_mappings["labels"][label]})
|
403 |
|
404 |
if "features" not in all_mappings.keys():
|
405 |
+
logger.warning("features not in all_mappings")
|
406 |
gr.Warning(CONFIRM_MAPPING_DETAILS_FAIL_RAW)
|
407 |
feature_mapping = all_mappings["features"]
|
408 |
return label_mapping, feature_mapping
|
|
|
442 |
)
|
443 |
gr.Info("Your evaluation has been submitted")
|
444 |
|
445 |
+
new_uid = uuid.uuid4()
|
446 |
+
scanners = read_scanners(uid)
|
447 |
+
write_scanners(scanners, new_uid)
|
448 |
+
|
449 |
return (
|
450 |
gr.update(interactive=False), # Submit button
|
451 |
gr.update(value=f"{CHECK_LOG_SECTION_RAW}Your job id is: {uid}. ", lines=5, visible=True, interactive=False),
|
452 |
+
new_uid, # Allocate a new uuid
|
453 |
+
gr.update(visible=False),
|
454 |
+
gr.update(visible=False),
|
455 |
+
gr.update(visible=False),
|
456 |
+
gr.update(visible=False),
|
457 |
)
|