Spaces:
Sleeping
Sleeping
ZeroCommand
commited on
Commit
•
37729f3
1
Parent(s):
5311dba
Create file and reset scanners after submission
Browse files
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,7 @@ import gradio as gr
|
|
8 |
import pandas as pd
|
9 |
|
10 |
import leaderboard
|
11 |
-
from io_utils import read_column_mapping, write_column_mapping
|
12 |
from run_jobs import save_job_to_pipe
|
13 |
from text_classification import (
|
14 |
strip_model_id_from_url,
|
@@ -356,11 +356,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 +397,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 +437,15 @@ 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 read_column_mapping, write_column_mapping, read_scanners
|
12 |
from run_jobs import save_job_to_pipe
|
13 |
from text_classification import (
|
14 |
strip_model_id_from_url,
|
|
|
356 |
|
357 |
def check_column_mapping_keys_validity(all_mappings):
|
358 |
if all_mappings is None:
|
359 |
+
logger.warning("all_mapping is None")
|
360 |
gr.Warning(CONFIRM_MAPPING_DETAILS_FAIL_RAW)
|
361 |
return False
|
362 |
|
363 |
if "labels" not in all_mappings.keys():
|
364 |
+
logger.warning(f"Label mapping is not valid, all_mappings: {all_mappings}")
|
365 |
return False
|
366 |
|
367 |
return True
|
|
|
397 |
label_mapping.update({str(i): all_mappings["labels"][label]})
|
398 |
|
399 |
if "features" not in all_mappings.keys():
|
400 |
+
logger.warning("features not in all_mappings")
|
401 |
gr.Warning(CONFIRM_MAPPING_DETAILS_FAIL_RAW)
|
402 |
feature_mapping = all_mappings["features"]
|
403 |
return label_mapping, feature_mapping
|
|
|
437 |
)
|
438 |
gr.Info("Your evaluation has been submitted")
|
439 |
|
440 |
+
new_uid = uuid.uuid4()
|
441 |
+
read_scanners(new_uid)
|
442 |
+
|
443 |
return (
|
444 |
gr.update(interactive=False), # Submit button
|
445 |
gr.update(value=f"{CHECK_LOG_SECTION_RAW}Your job id is: {uid}. ", lines=5, visible=True, interactive=False),
|
446 |
+
new_uid, # Allocate a new uuid
|
447 |
+
gr.update(visible=False),
|
448 |
+
gr.update(visible=False),
|
449 |
+
gr.update(visible=False),
|
450 |
+
gr.update(visible=False),
|
451 |
)
|