Spaces:
Running
Running
AtsuMiyai
commited on
Commit
·
8145d10
1
Parent(s):
9c5be01
update app.py
Browse files
app.py
CHANGED
@@ -35,6 +35,14 @@ def upload_file(files):
|
|
35 |
return file_paths
|
36 |
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
# Accuracy Report
|
39 |
def report_acc(df, groupd='category', metric_type="dual"):
|
40 |
assert 'split' in df
|
@@ -90,7 +98,7 @@ def eval_result_dual(data_main, metric_type="dual"):
|
|
90 |
|
91 |
|
92 |
def calculate_score(input_file):
|
93 |
-
dual_df =
|
94 |
overall_dual, leaf_dual = eval_result_dual(dual_df)
|
95 |
overall_standard, leaf_standard = eval_result_dual(dual_df, metric_type="standard")
|
96 |
overall_upd, leaf_upd = eval_result_dual(dual_df, metric_type="upd")
|
@@ -100,7 +108,7 @@ def calculate_score(input_file):
|
|
100 |
|
101 |
# add the new data into the queue
|
102 |
def add_queue(base_df, input_file, model_name):
|
103 |
-
dual_df =
|
104 |
base_df[f"{model_name}_prediction_standard"] = dual_df["prediction_standard"]
|
105 |
base_df[f"{model_name}_hit_standard"] = dual_df["hit_standard"]
|
106 |
base_df[f"{model_name}_prediction_upd"] = dual_df["prediction_upd"]
|
@@ -112,7 +120,7 @@ def add_queue(base_df, input_file, model_name):
|
|
112 |
# check whether the input file is correct or not
|
113 |
def validity_check(input_file, UPD_type, question_type):
|
114 |
|
115 |
-
input_df =
|
116 |
|
117 |
# check for the correct data size
|
118 |
data_num_dict = {"AAD": 820, "IASD": 919, "IVQD": 356}
|
|
|
35 |
return file_paths
|
36 |
|
37 |
|
38 |
+
def create_df(input_file):
|
39 |
+
bytes_data = input_file.value
|
40 |
+
json_string = bytes_data.decode('utf-8')
|
41 |
+
data = json.loads(json_string)
|
42 |
+
df = pd.DataFrame(data)
|
43 |
+
|
44 |
+
return df
|
45 |
+
|
46 |
# Accuracy Report
|
47 |
def report_acc(df, groupd='category', metric_type="dual"):
|
48 |
assert 'split' in df
|
|
|
98 |
|
99 |
|
100 |
def calculate_score(input_file):
|
101 |
+
dual_df = create_df(input_file)
|
102 |
overall_dual, leaf_dual = eval_result_dual(dual_df)
|
103 |
overall_standard, leaf_standard = eval_result_dual(dual_df, metric_type="standard")
|
104 |
overall_upd, leaf_upd = eval_result_dual(dual_df, metric_type="upd")
|
|
|
108 |
|
109 |
# add the new data into the queue
|
110 |
def add_queue(base_df, input_file, model_name):
|
111 |
+
dual_df = create_df(input_file)
|
112 |
base_df[f"{model_name}_prediction_standard"] = dual_df["prediction_standard"]
|
113 |
base_df[f"{model_name}_hit_standard"] = dual_df["hit_standard"]
|
114 |
base_df[f"{model_name}_prediction_upd"] = dual_df["prediction_upd"]
|
|
|
120 |
# check whether the input file is correct or not
|
121 |
def validity_check(input_file, UPD_type, question_type):
|
122 |
|
123 |
+
input_df = create_df(input_file)
|
124 |
|
125 |
# check for the correct data size
|
126 |
data_num_dict = {"AAD": 820, "IASD": 919, "IVQD": 356}
|