chore: fix typo

This commit is contained in:
2024-10-07 00:56:52 +08:00
parent 8e14c0c7d5
commit ef0269e10b
2 changed files with 8 additions and 4 deletions
+7 -3
View File
@@ -40,7 +40,9 @@ def exp(filename):
def get_csv_file_path(project):
"""根据项目名称返回CSV文件路径"""
"""
根据项目名称返回 CSV 文件路径
"""
return f"{project}_scores.csv"
@@ -97,9 +99,10 @@ def upload_score():
@app.route("/get_scores/<project>", methods=["GET"])
def get_scores(project):
try:
# CSV 文件路径
csv_file_path = get_csv_file_path(project)
if not os.path.exists(csv_file_path):
return jsonify([]) # 如果文件不存在,返回空列表
return jsonify([])
with open(csv_file_path, mode="r", encoding="utf-8") as csvfile:
reader = csv.DictReader(csvfile)
@@ -123,9 +126,10 @@ def get_scores(project):
@app.route("/get_top_scores/<project>", methods=["GET"])
def get_top_scores(project):
try:
# CSV 文件路径
csv_file_path = get_csv_file_path(project)
if not os.path.exists(csv_file_path):
return jsonify([]) # 如果文件不存在,返回空列表
return jsonify([])
with open(csv_file_path, mode="r", encoding="utf-8") as csvfile:
reader = csv.DictReader(csvfile)
+1 -1
View File
@@ -112,7 +112,7 @@ def upload_score(name, id, score_data):
def main(name, id):
user_code_file = "test.py" # 代码文件
user_code_file = "function.py" # 代码文件
user_function_name = "classify" # KNN 函数名
user_load_dataset_name = "load_dataset" # 加载数据集函数名