Spaces:
Sleeping
Sleeping
Update questions.py
Browse files- questions.py +11 -2
questions.py
CHANGED
|
@@ -1,5 +1,14 @@
|
|
| 1 |
import json
|
| 2 |
|
| 3 |
def get_all_questions():
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import json
|
| 2 |
|
| 3 |
def get_all_questions():
|
| 4 |
+
try:
|
| 5 |
+
with open("metadata.jsonl", "r", encoding="utf-8") as f:
|
| 6 |
+
questions = [json.loads(line) for line in f]
|
| 7 |
+
print(f"✅ [questions.py] Loaded {len(questions)} questions from metadata.jsonl")
|
| 8 |
+
return questions
|
| 9 |
+
except FileNotFoundError:
|
| 10 |
+
print("❌ metadata.jsonl not found.")
|
| 11 |
+
return []
|
| 12 |
+
except json.JSONDecodeError as e:
|
| 13 |
+
print(f"❌ Failed to parse metadata.jsonl: {e}")
|
| 14 |
+
return []
|