Dyra1204 commited on
Commit
ea11393
·
verified ·
1 Parent(s): f5b8d53

Upload export/json_export.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. export/json_export.py +18 -0
export/json_export.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ File: export/json_export.py
3
+ Currently empty - provide a simple exporter helper
4
+ """
5
+
6
+ import json
7
+ from typing import Any, Dict, List
8
+
9
+
10
+ def export_results_to_json(results: List[Dict[str, Any]]) -> str:
11
+ """Return a pretty-printed JSON string of the results."""
12
+ return json.dumps(results, indent=2, ensure_ascii=False)
13
+
14
+
15
+ def save_results_json(path: str, results: List[Dict[str, Any]]) -> None:
16
+ """Save results to a file path as JSON."""
17
+ with open(path, "w", encoding="utf-8") as f:
18
+ json.dump(results, f, indent=2, ensure_ascii=False)