Spaces:
Sleeping
Sleeping
Create metadata.py
Browse files- metadata.py +18 -0
metadata.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
|
| 3 |
+
def load_metadata(filepath="metadata.jsonl"):
|
| 4 |
+
"""
|
| 5 |
+
Load all tasks from a JSONL file and return them as a list of dictionaries.
|
| 6 |
+
|
| 7 |
+
Args:
|
| 8 |
+
filepath (str): Path to the metadata file (default: "metadata.jsonl")
|
| 9 |
+
|
| 10 |
+
Returns:
|
| 11 |
+
List[dict]: List of task dictionaries
|
| 12 |
+
"""
|
| 13 |
+
tasks = []
|
| 14 |
+
with open(filepath, "r", encoding="utf-8") as f:
|
| 15 |
+
for line in f:
|
| 16 |
+
task = json.loads(line.strip())
|
| 17 |
+
tasks.append(task)
|
| 18 |
+
return tasks
|