fix(api): parse border and upscale in chain stages
This commit is contained in:
parent
151ebff237
commit
18803db6ed
|
@ -49,6 +49,6 @@ def blend_img2img(
|
||||||
)
|
)
|
||||||
output = result.images[0]
|
output = result.images[0]
|
||||||
|
|
||||||
logger.info('final output image size', output.size)
|
logger.info('final output image size: %sx%s', output.width, output.height)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
|
@ -573,14 +573,24 @@ def chain():
|
||||||
|
|
||||||
callback = chain_stages[stage_data.get('type')]
|
callback = chain_stages[stage_data.get('type')]
|
||||||
kwargs = stage_data.get('params', {})
|
kwargs = stage_data.get('params', {})
|
||||||
|
print('stage', callback.__name__, kwargs)
|
||||||
|
|
||||||
stage = StageParams(
|
stage = StageParams(
|
||||||
stage_data.get('name', callback.__name__),
|
stage_data.get('name', callback.__name__),
|
||||||
tile_size=int(kwargs.get('tile_size', SizeChart.auto)),
|
tile_size=int(kwargs.get('tile_size', SizeChart.auto)),
|
||||||
outscale=int(kwargs.get('outscale', 1)),
|
outscale=int(kwargs.get('outscale', 1)),
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO: create Border from border
|
# TODO: create Border from border
|
||||||
|
if 'border' in kwargs:
|
||||||
|
border = Border.even(int(kwargs.get('border')))
|
||||||
|
kwargs['border'] = border
|
||||||
|
|
||||||
# TODO: create Upscale from upscale
|
# TODO: create Upscale from upscale
|
||||||
|
if 'upscale' in kwargs:
|
||||||
|
upscale = UpscaleParams(params.model, params.provider)
|
||||||
|
kwargs['upscale'] = upscale
|
||||||
|
|
||||||
pipeline.append((callback, stage, kwargs))
|
pipeline.append((callback, stage, kwargs))
|
||||||
|
|
||||||
# build and run chain pipeline
|
# build and run chain pipeline
|
||||||
|
|
|
@ -39,22 +39,17 @@ $defs:
|
||||||
type:
|
type:
|
||||||
type: string
|
type: string
|
||||||
params:
|
params:
|
||||||
type: object
|
allOf:
|
||||||
properties:
|
- $ref: "#/$defs/border_params"
|
||||||
args:
|
- $ref: "#/$defs/image_params"
|
||||||
type: object
|
- $ref: "#/$defs/upscale_params"
|
||||||
additionalProperties: False
|
- type: object
|
||||||
patternProperties:
|
additionalProperties: False
|
||||||
"^[-_A-Za-z]+$":
|
patternProperties:
|
||||||
oneOf:
|
"^[-_A-Za-z]+$":
|
||||||
- type: number
|
oneOf:
|
||||||
- type: string
|
- type: number
|
||||||
border:
|
- type: string
|
||||||
$ref: "#/$defs/border_params"
|
|
||||||
image:
|
|
||||||
$ref: "#/$defs/image_params"
|
|
||||||
upscale:
|
|
||||||
$ref: "#/$defs/upscale_params"
|
|
||||||
|
|
||||||
request_chain:
|
request_chain:
|
||||||
type: array
|
type: array
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
"name": "refine",
|
"name": "refine",
|
||||||
"type": "blend-img2img",
|
"type": "blend-img2img",
|
||||||
"params": {
|
"params": {
|
||||||
"prompt": "a magical wizard in a robe fighting a dragon"
|
"prompt": "a magical wizard in a robe fighting a dragon",
|
||||||
|
"strength": 0.5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue