Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
|
|
|
| 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)
|