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