Spaces:
Sleeping
Sleeping
Commit
·
1f56568
1
Parent(s):
06398f6
update
Browse files
app.py
CHANGED
@@ -501,9 +501,10 @@ with gr.Blocks(js=js, delete_cache=(3600, 3600)) as demo:
|
|
501 |
|
502 |
# ========================================step2=========================================
|
503 |
elif stage1_info["state"] == "step2-selecting":
|
504 |
-
|
505 |
-
# if the user has selected an in_channel to forward to the previous target tpl_channel
|
506 |
if sel_radio != []:
|
|
|
|
|
507 |
prev_tpl_name = stage1_info["emptyTemplate"][stage1_info["step2"]["count"]-1]
|
508 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
509 |
sel_idx = channel_info["inputDict"][sel_radio]["index"]
|
@@ -513,14 +514,10 @@ with gr.Blocks(js=js, delete_cache=(3600, 3600)) as demo:
|
|
513 |
channel_info["templateDict"][prev_tpl_name]["matched"] = True
|
514 |
channel_info["inputDict"][sel_radio]["assigned"] = True
|
515 |
|
516 |
-
# --------------------------------update information--------------------------------
|
517 |
-
# exclude the selected in_channel of the previous round
|
518 |
-
stage1_info["unassignedInput"] = app_utils.get_unassigned_input(channel_info["inputNames"],
|
519 |
-
channel_info["inputDict"])
|
520 |
# exclude the tpl_channels filled in step2
|
521 |
stage1_info["emptyTemplate"] = app_utils.get_empty_template(channel_info["templateNames"],
|
522 |
channel_info["templateDict"])
|
523 |
-
|
524 |
# step2 to step4
|
525 |
if len(stage1_info["emptyTemplate"]) == 0:
|
526 |
md = """
|
@@ -622,12 +619,12 @@ with gr.Blocks(js=js, delete_cache=(3600, 3600)) as demo:
|
|
622 |
# =======================================step3-2========================================
|
623 |
# step3-2 to step4
|
624 |
elif stage1_info["state"] == "step3-2-selecting":
|
625 |
-
|
626 |
prev_tpl_name = stage1_info["emptyTemplate"][stage1_info["step3"]["count"]-1]
|
627 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
628 |
sel_idx = [channel_info["inputDict"][name]["index"] for name in sel_chkbox]
|
629 |
stage1_info["mappingResult"][0]["index"][prev_tpl_idx] = sel_idx if sel_idx!=[] else [None]
|
630 |
-
|
631 |
md = """
|
632 |
### Mapping Result
|
633 |
The mapping process has been finished.
|
@@ -694,9 +691,10 @@ with gr.Blocks(js=js, delete_cache=(3600, 3600)) as demo:
|
|
694 |
|
695 |
def update_radio(stage1_info, channel_info, sel_name):
|
696 |
step2 = stage1_info["step2"]
|
697 |
-
#
|
698 |
-
# if the user has selected an in_channel to forward to the previous target tpl_channel
|
699 |
if sel_name != []:
|
|
|
|
|
700 |
prev_tpl_name = stage1_info["emptyTemplate"][step2["count"]-1]
|
701 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
702 |
sel_idx = channel_info["inputDict"][sel_name]["index"]
|
@@ -706,12 +704,8 @@ with gr.Blocks(js=js, delete_cache=(3600, 3600)) as demo:
|
|
706 |
channel_info["templateDict"][prev_tpl_name]["matched"] = True
|
707 |
channel_info["inputDict"][sel_name]["assigned"] = True
|
708 |
|
709 |
-
#
|
710 |
-
step2["count"] += 1
|
711 |
-
|
712 |
-
# exclude the selected in_channel of the previous round
|
713 |
-
stage1_info["unassignedInput"] = app_utils.get_unassigned_input(channel_info["inputNames"], channel_info["inputDict"])
|
714 |
-
|
715 |
tpl_name = stage1_info["emptyTemplate"][step2["count"]-1]
|
716 |
label = '{} ({}/{})'.format(tpl_name, step2["count"], step2["totalNum"])
|
717 |
|
@@ -745,15 +739,14 @@ with gr.Blocks(js=js, delete_cache=(3600, 3600)) as demo:
|
|
745 |
# +========================================================================================+
|
746 |
def update_chkbox(stage1_info, channel_info, sel_name):
|
747 |
step3 = stage1_info["step3"]
|
748 |
-
|
749 |
prev_tpl_name = stage1_info["emptyTemplate"][step3["count"]-1]
|
750 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
751 |
sel_idx = [channel_info["inputDict"][name]["index"] for name in sel_name]
|
752 |
stage1_info["mappingResult"][0]["index"][prev_tpl_idx] = sel_idx if sel_idx!=[] else [None]
|
753 |
|
754 |
-
#
|
755 |
step3["count"] += 1
|
756 |
-
|
757 |
tpl_name = stage1_info["emptyTemplate"][step3["count"]-1]
|
758 |
label = '{} ({}/{})'.format(tpl_name, step3["count"], step3["totalNum"])
|
759 |
|
|
|
501 |
|
502 |
# ========================================step2=========================================
|
503 |
elif stage1_info["state"] == "step2-selecting":
|
504 |
+
|
|
|
505 |
if sel_radio != []:
|
506 |
+
stage1_info["unassignedInput"].remove(sel_radio)
|
507 |
+
|
508 |
prev_tpl_name = stage1_info["emptyTemplate"][stage1_info["step2"]["count"]-1]
|
509 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
510 |
sel_idx = channel_info["inputDict"][sel_radio]["index"]
|
|
|
514 |
channel_info["templateDict"][prev_tpl_name]["matched"] = True
|
515 |
channel_info["inputDict"][sel_radio]["assigned"] = True
|
516 |
|
|
|
|
|
|
|
|
|
517 |
# exclude the tpl_channels filled in step2
|
518 |
stage1_info["emptyTemplate"] = app_utils.get_empty_template(channel_info["templateNames"],
|
519 |
channel_info["templateDict"])
|
520 |
+
|
521 |
# step2 to step4
|
522 |
if len(stage1_info["emptyTemplate"]) == 0:
|
523 |
md = """
|
|
|
619 |
# =======================================step3-2========================================
|
620 |
# step3-2 to step4
|
621 |
elif stage1_info["state"] == "step3-2-selecting":
|
622 |
+
|
623 |
prev_tpl_name = stage1_info["emptyTemplate"][stage1_info["step3"]["count"]-1]
|
624 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
625 |
sel_idx = [channel_info["inputDict"][name]["index"] for name in sel_chkbox]
|
626 |
stage1_info["mappingResult"][0]["index"][prev_tpl_idx] = sel_idx if sel_idx!=[] else [None]
|
627 |
+
|
628 |
md = """
|
629 |
### Mapping Result
|
630 |
The mapping process has been finished.
|
|
|
691 |
|
692 |
def update_radio(stage1_info, channel_info, sel_name):
|
693 |
step2 = stage1_info["step2"]
|
694 |
+
# check if the user has selected an in_channel to forward to the previous target tpl_channel
|
|
|
695 |
if sel_name != []:
|
696 |
+
stage1_info["unassignedInput"].remove(sel_name)
|
697 |
+
|
698 |
prev_tpl_name = stage1_info["emptyTemplate"][step2["count"]-1]
|
699 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
700 |
sel_idx = channel_info["inputDict"][sel_name]["index"]
|
|
|
704 |
channel_info["templateDict"][prev_tpl_name]["matched"] = True
|
705 |
channel_info["inputDict"][sel_name]["assigned"] = True
|
706 |
|
707 |
+
# update the new round
|
708 |
+
step2["count"] += 1
|
|
|
|
|
|
|
|
|
709 |
tpl_name = stage1_info["emptyTemplate"][step2["count"]-1]
|
710 |
label = '{} ({}/{})'.format(tpl_name, step2["count"], step2["totalNum"])
|
711 |
|
|
|
739 |
# +========================================================================================+
|
740 |
def update_chkbox(stage1_info, channel_info, sel_name):
|
741 |
step3 = stage1_info["step3"]
|
742 |
+
|
743 |
prev_tpl_name = stage1_info["emptyTemplate"][step3["count"]-1]
|
744 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
745 |
sel_idx = [channel_info["inputDict"][name]["index"] for name in sel_name]
|
746 |
stage1_info["mappingResult"][0]["index"][prev_tpl_idx] = sel_idx if sel_idx!=[] else [None]
|
747 |
|
748 |
+
# update the new round
|
749 |
step3["count"] += 1
|
|
|
750 |
tpl_name = stage1_info["emptyTemplate"][step3["count"]-1]
|
751 |
label = '{} ({}/{})'.format(tpl_name, step3["count"], step3["totalNum"])
|
752 |
|