import os
import subprocess

for i in range(1,221):
    print(i)
    # 执行pipeline.py，并根据loop index修改输出的json文件名
    output_dir = "./output/MHalu_{}".format(i)
    json_file = "./output/MHalu_{}/boundingbox.json".format(i)
    res_file = "./output/MHalu_{}/prompt_res.txt".format(i)
    pipeline_command = "python pipeline.py --index {} --output_json {} --prompt_res {} --output_dir {}".format(i, json_file, res_file, output_dir)
    subprocess.check_call(pipeline_command, shell=True)
    json_file = './output/MHalu_{}/boundingbox.json'.format(i)
    # 执行inference.py，使用刚才生成的json文件作为输入
    inference_command = "python inference.py --index {} --input_json {}".format(i, json_file)
    subprocess.check_call(inference_command, shell=True)