JunJiaGuo commited on
Commit
36d6ca9
·
verified ·
1 Parent(s): e24b40b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -102,7 +102,8 @@ def load_id_answer_mapping():
102
  def evaluate_uploaded_json(user_file):
103
  print(user_file)
104
  id_answer_mapping = load_id_answer_mapping() # 读取答案映射
105
- user_data = json.load(user_file)
 
106
 
107
  correct = sum(1 for item in user_data if id_answer_mapping.get(item["id"]) == item.get("answer"))
108
  total = len(user_data)
 
102
  def evaluate_uploaded_json(user_file):
103
  print(user_file)
104
  id_answer_mapping = load_id_answer_mapping() # 读取答案映射
105
+ with open(user_file, "r", encoding="utf-8") as f:
106
+ user_data = json.load(f) # 读取 JSON 文件
107
 
108
  correct = sum(1 for item in user_data if id_answer_mapping.get(item["id"]) == item.get("answer"))
109
  total = len(user_data)