Spaces:
Sleeping
Sleeping
| import json | |
| def fix_keys(obj): | |
| if "Question" in obj: | |
| obj["question"] = obj.pop("Question") | |
| return obj | |
| def get_all_questions(): | |
| try: | |
| with open("metadata.jsonl", "r", encoding="utf-8") as f: | |
| questions = [json.loads(line) for line in f] | |
| print(f"✅ [questions.py] Loaded {len(questions)} questions from metadata.jsonl") | |
| return questions | |
| except FileNotFoundError: | |
| print("❌ metadata.jsonl not found.") | |
| return [] | |
| except json.JSONDecodeError as e: | |
| print(f"❌ Failed to parse metadata.jsonl: {e}") | |
| return [] |