fix: " in main.py
This commit is contained in:
@@ -97,7 +97,7 @@ def upload_score():
|
|||||||
@app.route("/get_scores/<project>", methods=["GET"])
|
@app.route("/get_scores/<project>", methods=["GET"])
|
||||||
def get_scores(project):
|
def get_scores(project):
|
||||||
try:
|
try:
|
||||||
csv_file_path = get_csv_file_path(project) # 根据项目名称选择文件
|
csv_file_path = get_csv_file_path(project)
|
||||||
if not os.path.exists(csv_file_path):
|
if not os.path.exists(csv_file_path):
|
||||||
return jsonify([]) # 如果文件不存在,返回空列表
|
return jsonify([]) # 如果文件不存在,返回空列表
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ def get_scores(project):
|
|||||||
@app.route("/get_top_scores/<project>", methods=["GET"])
|
@app.route("/get_top_scores/<project>", methods=["GET"])
|
||||||
def get_top_scores(project):
|
def get_top_scores(project):
|
||||||
try:
|
try:
|
||||||
csv_file_path = get_csv_file_path(project) # 根据项目名称选择文件
|
csv_file_path = get_csv_file_path(project)
|
||||||
if not os.path.exists(csv_file_path):
|
if not os.path.exists(csv_file_path):
|
||||||
return jsonify([]) # 如果文件不存在,返回空列表
|
return jsonify([]) # 如果文件不存在,返回空列表
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ def upload_score(name, id, score_data):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
print(f"{response.json()["message"]}")
|
print(response.json()["message"])
|
||||||
else:
|
else:
|
||||||
print("上传成绩失败!\n原因:", response.json()["message"])
|
print("上传成绩失败!\n原因:", response.json()["message"])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ def upload_score(name, id, score_data):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
print(f"{response.json()["message"]}")
|
print(response.json()["message"])
|
||||||
else:
|
else:
|
||||||
print("上传成绩失败!\n原因:", response.json()["message"])
|
print("上传成绩失败!\n原因:", response.json()["message"])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -125,7 +125,7 @@ def main(name, id):
|
|||||||
log_details.append(f"Error loading user function: {e}")
|
log_details.append(f"Error loading user function: {e}")
|
||||||
print("\n".join(log_details))
|
print("\n".join(log_details))
|
||||||
return
|
return
|
||||||
|
|
||||||
load_start_time = time.time()
|
load_start_time = time.time()
|
||||||
|
|
||||||
# 加载数据集
|
# 加载数据集
|
||||||
@@ -134,7 +134,6 @@ def main(name, id):
|
|||||||
|
|
||||||
load_end_time = time.time()
|
load_end_time = time.time()
|
||||||
|
|
||||||
|
|
||||||
# 记录评估时间
|
# 记录评估时间
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
|
|
||||||
@@ -150,7 +149,9 @@ def main(name, id):
|
|||||||
print("")
|
print("")
|
||||||
log_details.append(f"得分: {accuracy * 100:.2f}")
|
log_details.append(f"得分: {accuracy * 100:.2f}")
|
||||||
print(f"得分: {accuracy * 100:.2f}")
|
print(f"得分: {accuracy * 100:.2f}")
|
||||||
log_details.append(f"加载数据集时间: {(load_end_time - load_start_time)*1000:.10f}ms")
|
log_details.append(
|
||||||
|
f"加载数据集时间: {(load_end_time - load_start_time)*1000:.10f}ms"
|
||||||
|
)
|
||||||
print(f"加载数据集时间: {(load_end_time - load_start_time)*1000:.10f}ms")
|
print(f"加载数据集时间: {(load_end_time - load_start_time)*1000:.10f}ms")
|
||||||
log_details.append(f"运行时间: {running_time * 1000:.10f}ms")
|
log_details.append(f"运行时间: {running_time * 1000:.10f}ms")
|
||||||
print(f"运行时间: {running_time * 1000:.10f}ms")
|
print(f"运行时间: {running_time * 1000:.10f}ms")
|
||||||
|
|||||||
Reference in New Issue
Block a user