Commit
·
6cc1add
1
Parent(s):
1d01073
added requirements.txt and fix metadata file naming in jsonl_to_data.py
Browse files- requirements.txt +3 -0
- utils/jsonl_to_data.py +9 -3
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
pandas
|
3 |
+
matplotlib
|
utils/jsonl_to_data.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import os
|
2 |
import json
|
|
|
3 |
|
4 |
def jsonl_to_data(input_file, output_dir):
|
5 |
"""Reads a JSONL file and reconstructs the original folder structure."""
|
@@ -20,7 +21,12 @@ def jsonl_to_data(input_file, output_dir):
|
|
20 |
with open(os.path.join(folder_path, "code.py"), "w", encoding="utf-8") as f_c:
|
21 |
f_c.write(entry["code"])
|
22 |
|
23 |
-
with open(os.path.join(folder_path, "
|
24 |
-
json.dump(entry["
|
25 |
|
26 |
-
print(f"Data successfully reconstructed in {output_dir}")
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
import json
|
3 |
+
from pathlib import Path
|
4 |
|
5 |
def jsonl_to_data(input_file, output_dir):
|
6 |
"""Reads a JSONL file and reconstructs the original folder structure."""
|
|
|
21 |
with open(os.path.join(folder_path, "code.py"), "w", encoding="utf-8") as f_c:
|
22 |
f_c.write(entry["code"])
|
23 |
|
24 |
+
with open(os.path.join(folder_path, "metadata.json"), "w", encoding="utf-8") as f_m:
|
25 |
+
json.dump(entry["metadata"], f_m, indent=4)
|
26 |
|
27 |
+
print(f"Data successfully reconstructed in {output_dir}")
|
28 |
+
|
29 |
+
if __name__ == "__main__" :
|
30 |
+
script_dir = Path(__file__).parent
|
31 |
+
input_dir = script_dir.parent / "data/questions"
|
32 |
+
jsonl_to_data('output.jsonl', input_dir)
|