chore: fix typo
This commit is contained in:
@@ -40,7 +40,9 @@ def exp(filename):
|
|||||||
|
|
||||||
|
|
||||||
def get_csv_file_path(project):
|
def get_csv_file_path(project):
|
||||||
"""根据项目名称返回CSV文件路径"""
|
"""
|
||||||
|
根据项目名称返回 CSV 文件路径
|
||||||
|
"""
|
||||||
return f"{project}_scores.csv"
|
return f"{project}_scores.csv"
|
||||||
|
|
||||||
|
|
||||||
@@ -97,9 +99,10 @@ 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 文件路径
|
||||||
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([])
|
||||||
|
|
||||||
with open(csv_file_path, mode="r", encoding="utf-8") as csvfile:
|
with open(csv_file_path, mode="r", encoding="utf-8") as csvfile:
|
||||||
reader = csv.DictReader(csvfile)
|
reader = csv.DictReader(csvfile)
|
||||||
@@ -123,9 +126,10 @@ 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 文件路径
|
||||||
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([])
|
||||||
|
|
||||||
with open(csv_file_path, mode="r", encoding="utf-8") as csvfile:
|
with open(csv_file_path, mode="r", encoding="utf-8") as csvfile:
|
||||||
reader = csv.DictReader(csvfile)
|
reader = csv.DictReader(csvfile)
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ def upload_score(name, id, score_data):
|
|||||||
|
|
||||||
|
|
||||||
def main(name, id):
|
def main(name, id):
|
||||||
user_code_file = "test.py" # 代码文件
|
user_code_file = "function.py" # 代码文件
|
||||||
user_function_name = "classify" # KNN 函数名
|
user_function_name = "classify" # KNN 函数名
|
||||||
user_load_dataset_name = "load_dataset" # 加载数据集函数名
|
user_load_dataset_name = "load_dataset" # 加载数据集函数名
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user