mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
add api override field
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -31,6 +31,7 @@ ReqControl = models.create_model_from_signature(
|
||||
{"key": "ip_adapter", "type": Optional[List[models.ItemIPAdapter]], "default": None, "exclude": True},
|
||||
{"key": "face", "type": Optional[models.ItemFace], "default": None, "exclude": True},
|
||||
{"key": "control", "type": Optional[List[ItemControl]], "default": [], "exclude": True},
|
||||
{"key": "extra", "type": Optional[dict], "default": {}, "exclude": True},
|
||||
]
|
||||
)
|
||||
|
||||
@@ -159,6 +160,7 @@ class APIControl():
|
||||
output_processed = []
|
||||
output_info = ''
|
||||
run.control_set({ 'do_not_save_grid': not req.save_images, 'do_not_save_samples': not req.save_images, **self.prepare_ip_adapter(req) })
|
||||
run.control_set(getattr(req, "extra", {}))
|
||||
res = run.control_run(**args)
|
||||
for item in res:
|
||||
if len(item) > 0 and (isinstance(item[0], list) or item[0] is None): # output_images
|
||||
|
||||
@@ -106,6 +106,8 @@ class APIGenerate():
|
||||
p.scripts = script_runner
|
||||
p.outpath_grids = shared.opts.outdir_grids or shared.opts.outdir_txt2img_grids
|
||||
p.outpath_samples = shared.opts.outdir_samples or shared.opts.outdir_txt2img_samples
|
||||
for key, value in getattr(txt2imgreq, "extra", {}).items():
|
||||
setattr(p, key, value)
|
||||
shared.state.begin('API TXT', api=True)
|
||||
script_args = script.init_script_args(p, txt2imgreq, self.default_script_arg_txt2img, selectable_scripts, selectable_script_idx, script_runner)
|
||||
if selectable_scripts is not None:
|
||||
@@ -150,6 +152,8 @@ class APIGenerate():
|
||||
p.scripts = script_runner
|
||||
p.outpath_grids = shared.opts.outdir_img2img_grids
|
||||
p.outpath_samples = shared.opts.outdir_img2img_samples
|
||||
for key, value in getattr(img2imgreq, "extra", {}).items():
|
||||
setattr(p, key, value)
|
||||
shared.state.begin('API-IMG', api=True)
|
||||
script_args = script.init_script_args(p, img2imgreq, self.default_script_arg_img2img, selectable_scripts, selectable_script_idx, script_runner)
|
||||
if selectable_scripts is not None:
|
||||
|
||||
@@ -210,6 +210,7 @@ ReqTxt2Img = PydanticModelGenerator(
|
||||
{"key": "alwayson_scripts", "type": dict, "default": {}},
|
||||
{"key": "ip_adapter", "type": Optional[List[ItemIPAdapter]], "default": None, "exclude": True},
|
||||
{"key": "face", "type": Optional[ItemFace], "default": None, "exclude": True},
|
||||
{"key": "extra", "type": Optional[dict], "default": {}, "exclude": True},
|
||||
]
|
||||
).generate_model()
|
||||
StableDiffusionTxt2ImgProcessingAPI = ReqTxt2Img
|
||||
@@ -235,6 +236,7 @@ ReqImg2Img = PydanticModelGenerator(
|
||||
{"key": "alwayson_scripts", "type": dict, "default": {}},
|
||||
{"key": "ip_adapter", "type": Optional[List[ItemIPAdapter]], "default": None, "exclude": True},
|
||||
{"key": "face_id", "type": Optional[ItemFace], "default": None, "exclude": True},
|
||||
{"key": "extra", "type": Optional[dict], "default": {}, "exclude": True},
|
||||
]
|
||||
).generate_model()
|
||||
StableDiffusionImg2ImgProcessingAPI = ReqImg2Img
|
||||
|
||||
Reference in New Issue
Block a user