Update app.py
Browse files
app.py
CHANGED
@@ -54,7 +54,7 @@ def generate_table(data):
|
|
54 |
protected_methods = ["GPT-4-Turbo-Preview (DFS)", "GPT-3.5-Turbo-1106 (DFS)", "GPT-4-0613 (DFS)", "GPT-3.5-Turbo-0613 (DFS)", "GPT-4-Turbo-Preview (CoT)", "ToolLLaMA v2 (DFS)", "GPT-4-0613 (CoT)", "GPT-3.5-Turbo-1106 (CoT)", "GPT-3.5-Turbo-0613 (CoT)", "ToolLLaMA v2 (CoT)"]
|
55 |
|
56 |
# 合并上传的数据到已有的数据中
|
57 |
-
def merge_data(uploaded_data_json):
|
58 |
# No need to call json.loads here because uploaded_data is already a Python dict
|
59 |
new_data = uploaded_data_json
|
60 |
with scheduler.lock: # 确保文件操作的线程安全
|
@@ -94,7 +94,7 @@ def merge_data(uploaded_data_json):
|
|
94 |
# No need to sort here since we're doing it in the generate_table function
|
95 |
return existing_data
|
96 |
|
97 |
-
def process_file(file_info):
|
98 |
if file_info is not None:
|
99 |
# 如果 file_info 是文件的路径字符串,需要使用 'open' 来读取文件
|
100 |
with open(file_info, "r") as uploaded_file:
|
@@ -228,7 +228,7 @@ with gr.Blocks() as app:
|
|
228 |
|
229 |
submit_button.click(
|
230 |
fn=process_file,
|
231 |
-
inputs=upload_component,
|
232 |
outputs=[table1, table2]
|
233 |
)
|
234 |
|
|
|
54 |
protected_methods = ["GPT-4-Turbo-Preview (DFS)", "GPT-3.5-Turbo-1106 (DFS)", "GPT-4-0613 (DFS)", "GPT-3.5-Turbo-0613 (DFS)", "GPT-4-Turbo-Preview (CoT)", "ToolLLaMA v2 (DFS)", "GPT-4-0613 (CoT)", "GPT-3.5-Turbo-1106 (CoT)", "GPT-3.5-Turbo-0613 (CoT)", "ToolLLaMA v2 (CoT)"]
|
55 |
|
56 |
# 合并上传的数据到已有的数据中
|
57 |
+
def merge_data(uploaded_data_json, existing_data):
|
58 |
# No need to call json.loads here because uploaded_data is already a Python dict
|
59 |
new_data = uploaded_data_json
|
60 |
with scheduler.lock: # 确保文件操作的线程安全
|
|
|
94 |
# No need to sort here since we're doing it in the generate_table function
|
95 |
return existing_data
|
96 |
|
97 |
+
def process_file(file_info, existing_data):
|
98 |
if file_info is not None:
|
99 |
# 如果 file_info 是文件的路径字符串,需要使用 'open' 来读取文件
|
100 |
with open(file_info, "r") as uploaded_file:
|
|
|
228 |
|
229 |
submit_button.click(
|
230 |
fn=process_file,
|
231 |
+
inputs= [upload_component,existing_data],
|
232 |
outputs=[table1, table2]
|
233 |
)
|
234 |
|