Spaces:
Sleeping
Sleeping
Commit
·
b5df8a7
1
Parent(s):
c1cd6f3
update
Browse files- app.py +10 -10
- app_utils.py +2 -2
app.py
CHANGED
@@ -331,7 +331,7 @@ with gr.Blocks() as demo:
|
|
331 |
"batchNum" : None,
|
332 |
"mappingResult" : [
|
333 |
{
|
334 |
-
"
|
335 |
"isOriginalData" : None
|
336 |
#"channelUsageNum" : None
|
337 |
}
|
@@ -488,7 +488,7 @@ with gr.Blocks() as demo:
|
|
488 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
489 |
sel_idx = channel_info["inputDict"][sel_radio]["index"]
|
490 |
|
491 |
-
stage1_info["mappingResult"][0]["
|
492 |
stage1_info["mappingResult"][0]["isOriginalData"][prev_tpl_idx] = True
|
493 |
channel_info["templateDict"][prev_tpl_name]["matched"] = True
|
494 |
channel_info["inputDict"][sel_radio]["assigned"] = True
|
@@ -565,10 +565,10 @@ with gr.Blocks() as demo:
|
|
565 |
value of the data from the selected channels. (By default, the 4 nearest channels are pre-selected.)
|
566 |
"""
|
567 |
# find the 4 nearest in_channels for each unmatched tpl_channels
|
568 |
-
stage1_info["mappingResult"][0]["
|
569 |
channel_info,
|
570 |
stage1_info["emptyTemplates"],
|
571 |
-
stage1_info["mappingResult"][0]["
|
572 |
# initialize the progress indication label
|
573 |
stage1_info["step3"] = {
|
574 |
"count" : 1,
|
@@ -578,7 +578,7 @@ with gr.Blocks() as demo:
|
|
578 |
label = '{} (1/{})'.format(tpl_name, stage1_info["step3"]["totalNum"])
|
579 |
|
580 |
tpl_idx = channel_info["templateDict"][tpl_name]["index"]
|
581 |
-
value = stage1_info["mappingResult"][0]["
|
582 |
value = [channel_info["inputNames"][i] for i in value]
|
583 |
|
584 |
stage1_info["state"] = "step3-2-selecting"
|
@@ -607,7 +607,7 @@ with gr.Blocks() as demo:
|
|
607 |
prev_tpl_name = stage1_info["emptyTemplates"][stage1_info["step3"]["count"]-1]
|
608 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
609 |
sel_idx = [channel_info["inputDict"][name]["index"] for name in sel_chkbox]
|
610 |
-
stage1_info["mappingResult"][0]["
|
611 |
#print(prev_tpl_name, '<-', sel_chkbox)
|
612 |
# ----------------------------------------------------------------------------------
|
613 |
md = """
|
@@ -686,7 +686,7 @@ with gr.Blocks() as demo:
|
|
686 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
687 |
sel_idx = channel_info["inputDict"][sel_name]["index"]
|
688 |
|
689 |
-
stage1_info["mappingResult"][0]["
|
690 |
stage1_info["mappingResult"][0]["isOriginalData"][prev_tpl_idx] = True
|
691 |
channel_info["templateDict"][prev_tpl_name]["matched"] = True
|
692 |
channel_info["inputDict"][sel_name]["assigned"] = True
|
@@ -736,7 +736,7 @@ with gr.Blocks() as demo:
|
|
736 |
prev_tpl_name = stage1_info["emptyTemplates"][step3["count"]-1]
|
737 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
738 |
sel_idx = [channel_info["inputDict"][name]["index"] for name in sel_name]
|
739 |
-
stage1_info["mappingResult"][0]["
|
740 |
#print(prev_tpl_name, '<-', sel_name)
|
741 |
|
742 |
# ---------------------------------update the new round---------------------------------
|
@@ -746,7 +746,7 @@ with gr.Blocks() as demo:
|
|
746 |
label = '{} ({}/{})'.format(tpl_name, step3["count"], step3["totalNum"])
|
747 |
|
748 |
tpl_idx = channel_info["templateDict"][tpl_name]["index"]
|
749 |
-
value = stage1_info["mappingResult"][0]["
|
750 |
value = [channel_info["inputNames"][i] for i in value]
|
751 |
|
752 |
stage1_info["step3"] = step3
|
@@ -849,7 +849,7 @@ with gr.Blocks() as demo:
|
|
849 |
outputname = outputname,
|
850 |
samplerate = int(samplerate),
|
851 |
batch_cnt = i,
|
852 |
-
old_idx = stage1_info["mappingResult"][i]["
|
853 |
orig_flags = stage1_info["mappingResult"][i]["isOriginalData"])
|
854 |
except FileNotFoundError:
|
855 |
print('stop!!')
|
|
|
331 |
"batchNum" : None,
|
332 |
"mappingResult" : [
|
333 |
{
|
334 |
+
"index" : None,
|
335 |
"isOriginalData" : None
|
336 |
#"channelUsageNum" : None
|
337 |
}
|
|
|
488 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
489 |
sel_idx = channel_info["inputDict"][sel_radio]["index"]
|
490 |
|
491 |
+
stage1_info["mappingResult"][0]["index"][prev_tpl_idx] = [sel_idx]
|
492 |
stage1_info["mappingResult"][0]["isOriginalData"][prev_tpl_idx] = True
|
493 |
channel_info["templateDict"][prev_tpl_name]["matched"] = True
|
494 |
channel_info["inputDict"][sel_radio]["assigned"] = True
|
|
|
565 |
value of the data from the selected channels. (By default, the 4 nearest channels are pre-selected.)
|
566 |
"""
|
567 |
# find the 4 nearest in_channels for each unmatched tpl_channels
|
568 |
+
stage1_info["mappingResult"][0]["index"] = app_utils.find_neighbors(
|
569 |
channel_info,
|
570 |
stage1_info["emptyTemplates"],
|
571 |
+
stage1_info["mappingResult"][0]["index"])
|
572 |
# initialize the progress indication label
|
573 |
stage1_info["step3"] = {
|
574 |
"count" : 1,
|
|
|
578 |
label = '{} (1/{})'.format(tpl_name, stage1_info["step3"]["totalNum"])
|
579 |
|
580 |
tpl_idx = channel_info["templateDict"][tpl_name]["index"]
|
581 |
+
value = stage1_info["mappingResult"][0]["index"][tpl_idx]
|
582 |
value = [channel_info["inputNames"][i] for i in value]
|
583 |
|
584 |
stage1_info["state"] = "step3-2-selecting"
|
|
|
607 |
prev_tpl_name = stage1_info["emptyTemplates"][stage1_info["step3"]["count"]-1]
|
608 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
609 |
sel_idx = [channel_info["inputDict"][name]["index"] for name in sel_chkbox]
|
610 |
+
stage1_info["mappingResult"][0]["index"][prev_tpl_idx] = sel_idx if sel_idx!=[] else [None]
|
611 |
#print(prev_tpl_name, '<-', sel_chkbox)
|
612 |
# ----------------------------------------------------------------------------------
|
613 |
md = """
|
|
|
686 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
687 |
sel_idx = channel_info["inputDict"][sel_name]["index"]
|
688 |
|
689 |
+
stage1_info["mappingResult"][0]["index"][prev_tpl_idx] = [sel_idx]
|
690 |
stage1_info["mappingResult"][0]["isOriginalData"][prev_tpl_idx] = True
|
691 |
channel_info["templateDict"][prev_tpl_name]["matched"] = True
|
692 |
channel_info["inputDict"][sel_name]["assigned"] = True
|
|
|
736 |
prev_tpl_name = stage1_info["emptyTemplates"][step3["count"]-1]
|
737 |
prev_tpl_idx = channel_info["templateDict"][prev_tpl_name]["index"]
|
738 |
sel_idx = [channel_info["inputDict"][name]["index"] for name in sel_name]
|
739 |
+
stage1_info["mappingResult"][0]["index"][prev_tpl_idx] = sel_idx if sel_idx!=[] else [None]
|
740 |
#print(prev_tpl_name, '<-', sel_name)
|
741 |
|
742 |
# ---------------------------------update the new round---------------------------------
|
|
|
746 |
label = '{} ({}/{})'.format(tpl_name, step3["count"], step3["totalNum"])
|
747 |
|
748 |
tpl_idx = channel_info["templateDict"][tpl_name]["index"]
|
749 |
+
value = stage1_info["mappingResult"][0]["index"][tpl_idx]
|
750 |
value = [channel_info["inputNames"][i] for i in value]
|
751 |
|
752 |
stage1_info["step3"] = step3
|
|
|
849 |
outputname = outputname,
|
850 |
samplerate = int(samplerate),
|
851 |
batch_cnt = i,
|
852 |
+
old_idx = stage1_info["mappingResult"][i]["index"],
|
853 |
orig_flags = stage1_info["mappingResult"][i]["isOriginalData"])
|
854 |
except FileNotFoundError:
|
855 |
print('stop!!')
|
app_utils.py
CHANGED
@@ -228,7 +228,7 @@ def match_names(stage1_info):
|
|
228 |
"emptyTemplates" : get_empty_templates(tpl_names, tpl_dict),
|
229 |
"mappingResult" : [
|
230 |
{
|
231 |
-
"
|
232 |
"isOriginalData" : orig_flags
|
233 |
}
|
234 |
]
|
@@ -288,7 +288,7 @@ def optimal_mapping(channel_info):
|
|
288 |
old_idx = find_neighbors(channel_info, empty_tpl_names, old_idx)
|
289 |
|
290 |
result = {
|
291 |
-
"
|
292 |
"isOriginalData" : orig_flags
|
293 |
}
|
294 |
channel_info.update({
|
|
|
228 |
"emptyTemplates" : get_empty_templates(tpl_names, tpl_dict),
|
229 |
"mappingResult" : [
|
230 |
{
|
231 |
+
"index" : old_idx,
|
232 |
"isOriginalData" : orig_flags
|
233 |
}
|
234 |
]
|
|
|
288 |
old_idx = find_neighbors(channel_info, empty_tpl_names, old_idx)
|
289 |
|
290 |
result = {
|
291 |
+
"index" : old_idx,
|
292 |
"isOriginalData" : orig_flags
|
293 |
}
|
294 |
channel_info.update({
|