Spaces:
Sleeping
Sleeping
Commit
·
441b340
1
Parent(s):
77546d5
update app.py
Browse files
app.py
CHANGED
@@ -4,21 +4,21 @@ import os
|
|
4 |
import utils
|
5 |
import channel_mapping
|
6 |
|
7 |
-
def test(model_name, csv_file, chanloc_file):
|
8 |
tmp_path = os.path.dirname(str(csv_file))
|
9 |
|
10 |
-
|
11 |
-
|
12 |
|
13 |
# Channel mapping
|
14 |
-
input_loc_name = os.path.basename(str(chanloc_file))
|
15 |
-
|
16 |
|
17 |
# step1: Data preprocessing
|
18 |
-
total_file_num = utils.preprocessing(tmp_path,
|
19 |
|
20 |
# step2: Signal reconstruction
|
21 |
-
utils.reconstruct(model_name, total_file_num, tmp_path,
|
22 |
|
23 |
return tmp_path+'/'+output_data_name
|
24 |
|
@@ -26,9 +26,12 @@ input_data = gr.File(label="CSV file", file_types=[".csv"])
|
|
26 |
input_loc = gr.File(label="Channel location", file_types=[".loc", "locs"])
|
27 |
input_model_name = gr.Dropdown(choices=["ICUNet", "UNetpp", "AttUnet", "EEGART"],
|
28 |
value="ICUNet",
|
29 |
-
label="
|
|
|
|
|
|
|
30 |
|
31 |
-
inputs = [input_model_name, input_data, input_loc]
|
32 |
|
33 |
app = gr.Interface(fn=test,
|
34 |
inputs=inputs,
|
|
|
4 |
import utils
|
5 |
import channel_mapping
|
6 |
|
7 |
+
def test(model_name, fill_mode, csv_file, chanloc_file):
|
8 |
tmp_path = os.path.dirname(str(csv_file))
|
9 |
|
10 |
+
input_name = os.path.basename(str(csv_file))
|
11 |
+
output_name = os.path.splitext(input_name)[0]+'_'+model_name+'.csv'
|
12 |
|
13 |
# Channel mapping
|
14 |
+
#input_loc_name = os.path.basename(str(chanloc_file))
|
15 |
+
channel_mapping.mapping(csv_file, chanloc_file, fill_mode)
|
16 |
|
17 |
# step1: Data preprocessing
|
18 |
+
total_file_num = utils.preprocessing(tmp_path, 'mapped.csv', 256)
|
19 |
|
20 |
# step2: Signal reconstruction
|
21 |
+
utils.reconstruct(model_name, total_file_num, tmp_path, output_name)
|
22 |
|
23 |
return tmp_path+'/'+output_data_name
|
24 |
|
|
|
26 |
input_loc = gr.File(label="Channel location", file_types=[".loc", "locs"])
|
27 |
input_model_name = gr.Dropdown(choices=["ICUNet", "UNetpp", "AttUnet", "EEGART"],
|
28 |
value="ICUNet",
|
29 |
+
label="Model")
|
30 |
+
input_fill_mode = gr.Dropdown(choices=["zero", "adjacent"],
|
31 |
+
value="zero",
|
32 |
+
label="Fill empty channels with:")
|
33 |
|
34 |
+
inputs = [input_model_name, input_fill_mode, input_data, input_loc]
|
35 |
|
36 |
app = gr.Interface(fn=test,
|
37 |
inputs=inputs,
|