读取 JSONL 文件并解析为 Python 字典列表 :param file_path: JSONL 文件路径 :return: 包含所有 JSON 对象的列表
(file_path)
| 8 | import traceback |
| 9 | |
| 10 | def read_jsonl(file_path): |
| 11 | """ |
| 12 | |
| 13 | 读取 JSONL 文件并解析为 Python 字典列表 |
| 14 | :param file_path: JSONL 文件路径 |
| 15 | :return: 包含所有 JSON 对象的列表 |
| 16 | """ |
| 17 | data = [] |
| 18 | with open(file_path, "r", encoding="utf-8") as f: |
| 19 | for line in f: |
| 20 | data.append(json.loads(line.strip())) |
| 21 | return data |
| 22 | |
| 23 | def load_image_from_path(image_path): |
| 24 | """ |