Spaces:
Sleeping
Sleeping
Update questions.py
Browse files- questions.py +4 -5
questions.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import json
|
| 2 |
import os
|
| 3 |
|
| 4 |
-
# Fix incorrect "Question" key in metadata.jsonl (run only once)
|
| 5 |
if os.path.exists("metadata.jsonl") and not os.path.exists("metadata_fixed.jsonl"):
|
| 6 |
with open("metadata.jsonl", "r", encoding="utf-8") as infile, open("metadata_fixed.jsonl", "w", encoding="utf-8") as outfile:
|
| 7 |
for line in infile:
|
|
@@ -11,13 +10,13 @@ if os.path.exists("metadata.jsonl") and not os.path.exists("metadata_fixed.jsonl
|
|
| 11 |
|
| 12 |
def get_all_questions():
|
| 13 |
try:
|
| 14 |
-
with open("
|
| 15 |
questions = [json.loads(line) for line in f]
|
| 16 |
-
print(f"✅ [questions.py] Loaded {len(questions)} questions from
|
| 17 |
return questions
|
| 18 |
except FileNotFoundError:
|
| 19 |
-
print("❌
|
| 20 |
return []
|
| 21 |
except json.JSONDecodeError as e:
|
| 22 |
-
print(f"❌ Failed to parse
|
| 23 |
return []
|
|
|
|
| 1 |
import json
|
| 2 |
import os
|
| 3 |
|
|
|
|
| 4 |
if os.path.exists("metadata.jsonl") and not os.path.exists("metadata_fixed.jsonl"):
|
| 5 |
with open("metadata.jsonl", "r", encoding="utf-8") as infile, open("metadata_fixed.jsonl", "w", encoding="utf-8") as outfile:
|
| 6 |
for line in infile:
|
|
|
|
| 10 |
|
| 11 |
def get_all_questions():
|
| 12 |
try:
|
| 13 |
+
with open("metadata_fixed.jsonl", "r", encoding="utf-8") as f:
|
| 14 |
questions = [json.loads(line) for line in f]
|
| 15 |
+
print(f"✅ [questions.py] Loaded {len(questions)} questions from metadata_fixed.jsonl")
|
| 16 |
return questions
|
| 17 |
except FileNotFoundError:
|
| 18 |
+
print("❌ metadata_fixed.jsonl not found.")
|
| 19 |
return []
|
| 20 |
except json.JSONDecodeError as e:
|
| 21 |
+
print(f"❌ Failed to parse metadata_fixed.jsonl: {e}")
|
| 22 |
return []
|