import os
import json
import subprocess
import sys
 
def generate_layout_onestep(mask_imgae_path,result_path,action,cuda_id = 0,ckpt_path=None):
        steps = 100
        resolution = 512
        seed = 1371
        cfg_text = 7.5
        cfg_image = 1.2
        assert ckpt_path !=None
        # 构造命令
        command = [
            "python", "edit_cli.py",
            "--steps", str(steps),
            "--resolution", str(resolution),
            "--seed", str(seed),
            "--cfg-text", str(cfg_text),
            "--cfg-image", str(cfg_image),
            "--input", mask_imgae_path,
            "--output", result_path,
            "--edit", action,
            "--ckpt", ckpt_path
        ]
        env = os.environ.copy()
        env["CUDA_VISIBLE_DEVICES"] = str(cuda_id)

        subprocess.run(command,env =env)

