import json, ast # with open('answer.jsonl', 'r') as file: # for line in file: # data = json.loads(line) # sen = data['text'].split(':') # root_pose = sen[2][:-10] # body_pose = sen[3][:-6] # shape_pose = sen[-1] # root_pose = ast.literal_eval(root_pose) # body_pose = ast.literal_eval(body_pose) # shape_pose = ast.literal_eval(shape_pose) dic = {"question_id": 0, "image": "/data7tb/gzy/PoseLLM/Data/MPI-INF-3DHP/S6/Seq2/imageSequence/img_0_005402.jpg", "text": "Please provide the SMPL parameters of the single person in the image."} with open('eval_ehf.jsonl', 'w') as file: for i in range(1, 101): dic["question_id"] = i pp = "/data7tb/gzy/PoseLLM/Data/EHF/" + "%02d" % i + '_img.png' dic['image'] = pp json_string = json.dumps(dic) # Write JSON string to file with a newline file.write(json_string + '\n')