| import subprocess |
| import sys |
| import os |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| params = {} |
| params2={} |
| paramArr=[] |
| for arg in sys.argv[1:]: |
| if arg.startswith('--'): |
| key_value = arg[len('--'):].split('=') |
| if len(key_value) == 2: |
| key, value = key_value |
| params[key] = value |
| elif len(key_value) == 1: |
| paramArr += key_value |
|
|
| params2=params.copy() |
| del params2["full"],params2["dark"],params2["token"],params2["dir"],params2["ui"] |
|
|
| os.chdir(f'{params["dir"]}') |
| full_precision_str = "--share --lowram --disable-safe-unpickle --disable-console-progressbars --xformers --enable-insecure-extension-access --precision full --no-half --no-half-vae --opt-sub-quad-attention --opt-channelslast --api" |
| half_precision_str = "--share --lowram --disable-safe-unpickle --disable-console-progressbars --xformers --enable-insecure-extension-access --no-half-vae --opt-sub-quad-attention --opt-channelslast --api" |
| sdxl_str="--share --medvram-sdxl --disable-safe-unpickle --disable-console-progressbars --xformers --enable-insecure-extension-access --opt-sub-quad-attention --no-half-vae --opt-channelslast --api" |
| |
| for key, value in params2.items(): |
| full_precision_str += " --{}={}".format(key, value) |
| half_precision_str += " --{}={}".format(key, value) |
| sdxl_str+= " --{}={}".format(key, value) |
| for item in paramArr: |
| full_precision_str += f" --{item}" |
| half_precision_str += f" --{item}" |
| sdxl_str+= f" --{item}" |
| if params["dark"] == "True": |
| full_precision_str += " --theme='dark'" |
| half_precision_str += " --theme='dark'" |
| sdxl_str+= " --theme='dark'" |
| else: |
| full_precision_str += " --theme='light'" |
| half_precision_str += " --theme='light'" |
| sdxl_str+= " --theme='light'" |
| if params["token"]: |
| full_precision_str += f' --ngrok={params["token"]} --ngrok-region="auto"' |
| half_precision_str += f' --ngrok={params["token"]} --ngrok-region="auto"' |
| sdxl_str+= f' --ngrok={params["token"]} --ngrok-region="auto"' |
| print(sdxl_str) |
| if params["ui"]=="AUTOMATIC1111原版v1.6.0[sdxl]": |
| subprocess.run(f"python launch.py {sdxl_str}", shell=True) |
| elif params["full"] == "True": |
| subprocess.run(f"python launch.py {full_precision_str}", shell=True) |
| else: |
| subprocess.run(f"python launch.py {half_precision_str}", shell=True) |