Spaces:
Sleeping
Sleeping
Commit
·
6ce7643
1
Parent(s):
efd7fc6
update
Browse files- app.py +15 -15
- app_utils.py +1 -1
app.py
CHANGED
@@ -78,7 +78,7 @@ init_js = """
|
|
78 |
aspect-ratio: 1;
|
79 |
//width: 560px;
|
80 |
//height: 560px;
|
81 |
-
background: url("file=${stage1_info.fileNames.
|
82 |
background-size: contain;
|
83 |
`;
|
84 |
|
@@ -309,10 +309,10 @@ with gr.Blocks() as demo:
|
|
309 |
"id" : stage1_id,
|
310 |
"filePath" : rootpath+'/'+stage1_id+'/',
|
311 |
"fileNames" : {
|
312 |
-
"
|
313 |
-
"
|
314 |
-
"
|
315 |
-
"
|
316 |
},
|
317 |
"state" : "step1-initializing",
|
318 |
"step2" : {
|
@@ -377,8 +377,8 @@ with gr.Blocks() as demo:
|
|
377 |
# scale the coordinates
|
378 |
channel_info = app_utils.align_coords(channel_info, tpl_montage, in_montage)
|
379 |
# generate and save figures of the montages
|
380 |
-
filename1 = stage1_info["fileNames"]["
|
381 |
-
filename2 = stage1_info["fileNames"]["
|
382 |
channel_info = app_utils.save_figures(channel_info, tpl_montage, filename1, filename2)
|
383 |
|
384 |
unassigned_num = len(stage1_info["unassignedInputs"])
|
@@ -415,7 +415,7 @@ with gr.Blocks() as demo:
|
|
415 |
Download the file below if you plan to run the models using the <a href="">source code</a>.
|
416 |
"""
|
417 |
# finalize and save the mapping results
|
418 |
-
filename = stage1_info["fileNames"]["
|
419 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
420 |
|
421 |
stage1_info["state"] = "finished"
|
@@ -508,7 +508,7 @@ with gr.Blocks() as demo:
|
|
508 |
The mapping process has been finished.
|
509 |
Download the file below if you plan to run the models using the <a href="">source code</a>.
|
510 |
"""
|
511 |
-
filename = stage1_info["fileNames"]["
|
512 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
513 |
|
514 |
stage1_info["state"] = "finished"
|
@@ -545,7 +545,7 @@ with gr.Blocks() as demo:
|
|
545 |
The mapping process has been finished.
|
546 |
Download the file below if you plan to run the models using the <a href="">source code</a>.
|
547 |
"""
|
548 |
-
filename = stage1_info["fileNames"]["
|
549 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
550 |
|
551 |
stage1_info["state"] = "finished"
|
@@ -615,7 +615,7 @@ with gr.Blocks() as demo:
|
|
615 |
The mapping process has been finished.
|
616 |
Download the file below if you plan to run the models using the <a href="">source code</a>.
|
617 |
"""
|
618 |
-
filename = stage1_info["fileNames"]["
|
619 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
620 |
|
621 |
stage1_info["state"] = "finished"
|
@@ -820,8 +820,8 @@ with gr.Blocks() as demo:
|
|
820 |
"id" : stage2_id,
|
821 |
"filePath" : rootpath+'/'+stage2_id+'/',
|
822 |
"fileNames" : {
|
823 |
-
"
|
824 |
-
"
|
825 |
},
|
826 |
"state" : "running",
|
827 |
"sampleRate" : int(samplerate)
|
@@ -837,8 +837,8 @@ with gr.Blocks() as demo:
|
|
837 |
mapping_data = stage1_info["mappingData"]
|
838 |
samplerate = stage2_info["sampleRate"]
|
839 |
filepath = stage2_info["filePath"]
|
840 |
-
filename = stage2_info["fileNames"]["
|
841 |
-
new_filename = stage2_info["fileNames"]["
|
842 |
|
843 |
break_flag = False # indicate if the process has been interrupted
|
844 |
for i in range(batch_num):
|
|
|
78 |
aspect-ratio: 1;
|
79 |
//width: 560px;
|
80 |
//height: 560px;
|
81 |
+
background: url("file=${stage1_info.fileNames.inputMontage}");
|
82 |
background-size: contain;
|
83 |
`;
|
84 |
|
|
|
309 |
"id" : stage1_id,
|
310 |
"filePath" : rootpath+'/'+stage1_id+'/',
|
311 |
"fileNames" : {
|
312 |
+
"inputLocation" : in_loc,
|
313 |
+
"inputMontage" : rootpath+'/'+stage1_id+'/input_montage.png',
|
314 |
+
"mappedMontage" : rootpath+'/'+stage1_id+'/mapped_montage.png',
|
315 |
+
"outputResult" : rootpath+'/'+stage1_id+'/mapping_result.json'
|
316 |
},
|
317 |
"state" : "step1-initializing",
|
318 |
"step2" : {
|
|
|
377 |
# scale the coordinates
|
378 |
channel_info = app_utils.align_coords(channel_info, tpl_montage, in_montage)
|
379 |
# generate and save figures of the montages
|
380 |
+
filename1 = stage1_info["fileNames"]["inputMontage"]
|
381 |
+
filename2 = stage1_info["fileNames"]["mappedMontage"]
|
382 |
channel_info = app_utils.save_figures(channel_info, tpl_montage, filename1, filename2)
|
383 |
|
384 |
unassigned_num = len(stage1_info["unassignedInputs"])
|
|
|
415 |
Download the file below if you plan to run the models using the <a href="">source code</a>.
|
416 |
"""
|
417 |
# finalize and save the mapping results
|
418 |
+
filename = stage1_info["fileNames"]["outputResult"]
|
419 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
420 |
|
421 |
stage1_info["state"] = "finished"
|
|
|
508 |
The mapping process has been finished.
|
509 |
Download the file below if you plan to run the models using the <a href="">source code</a>.
|
510 |
"""
|
511 |
+
filename = stage1_info["fileNames"]["outputResult"]
|
512 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
513 |
|
514 |
stage1_info["state"] = "finished"
|
|
|
545 |
The mapping process has been finished.
|
546 |
Download the file below if you plan to run the models using the <a href="">source code</a>.
|
547 |
"""
|
548 |
+
filename = stage1_info["fileNames"]["outputResult"]
|
549 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
550 |
|
551 |
stage1_info["state"] = "finished"
|
|
|
615 |
The mapping process has been finished.
|
616 |
Download the file below if you plan to run the models using the <a href="">source code</a>.
|
617 |
"""
|
618 |
+
filename = stage1_info["fileNames"]["outputResult"]
|
619 |
stage1_info, channel_info = app_utils.mapping_result(stage1_info, channel_info, filename)
|
620 |
|
621 |
stage1_info["state"] = "finished"
|
|
|
820 |
"id" : stage2_id,
|
821 |
"filePath" : rootpath+'/'+stage2_id+'/',
|
822 |
"fileNames" : {
|
823 |
+
"inputData" : in_data,
|
824 |
+
"outputData" : rootpath+'/'+stage2_id+'/'+new_filename
|
825 |
},
|
826 |
"state" : "running",
|
827 |
"sampleRate" : int(samplerate)
|
|
|
837 |
mapping_data = stage1_info["mappingData"]
|
838 |
samplerate = stage2_info["sampleRate"]
|
839 |
filepath = stage2_info["filePath"]
|
840 |
+
filename = stage2_info["fileNames"]["inputData"]
|
841 |
+
new_filename = stage2_info["fileNames"]["outputData"]
|
842 |
|
843 |
break_flag = False # indicate if the process has been interrupted
|
844 |
for i in range(batch_num):
|
app_utils.py
CHANGED
@@ -229,7 +229,7 @@ def find_neighbors(channel_info, missing_channels, new_idx):
|
|
229 |
|
230 |
def match_names(stage1_info):
|
231 |
# read the location file
|
232 |
-
loc_file = stage1_info["fileNames"]["
|
233 |
tpl_montage, in_montage, tpl_dict, in_dict = read_montage_data(loc_file)
|
234 |
tpl_order = tpl_montage.ch_names
|
235 |
in_order = in_montage.ch_names
|
|
|
229 |
|
230 |
def match_names(stage1_info):
|
231 |
# read the location file
|
232 |
+
loc_file = stage1_info["fileNames"]["inputLocation"]
|
233 |
tpl_montage, in_montage, tpl_dict, in_dict = read_montage_data(loc_file)
|
234 |
tpl_order = tpl_montage.ch_names
|
235 |
in_order = in_montage.ch_names
|