Spaces:
Sleeping
Sleeping
Update questions.py
Browse files- questions.py +9 -0
questions.py
CHANGED
|
@@ -1,4 +1,13 @@
|
|
| 1 |
import json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
def get_all_questions():
|
| 4 |
try:
|
|
|
|
| 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:
|
| 8 |
+
obj = json.loads(line)
|
| 9 |
+
obj["question"] = obj.pop("Question") # Rename the key
|
| 10 |
+
outfile.write(json.dumps(obj) + "\n")
|
| 11 |
|
| 12 |
def get_all_questions():
|
| 13 |
try:
|