1
0
Fork 0

fix(api): parse border and upscale in chain stages

This commit is contained in:
Sean Sube 2023-01-28 22:48:53 -06:00
parent 151ebff237
commit 18803db6ed
4 changed files with 24 additions and 18 deletions

View File

@ -49,6 +49,6 @@ def blend_img2img(
)
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

View File

@ -573,14 +573,24 @@ def chain():
callback = chain_stages[stage_data.get('type')]
kwargs = stage_data.get('params', {})
print('stage', callback.__name__, kwargs)
stage = StageParams(
stage_data.get('name', callback.__name__),
tile_size=int(kwargs.get('tile_size', SizeChart.auto)),
outscale=int(kwargs.get('outscale', 1)),
)
# TODO: create Border from border
if 'border' in kwargs:
border = Border.even(int(kwargs.get('border')))
kwargs['border'] = border
# TODO: create Upscale from upscale
if 'upscale' in kwargs:
upscale = UpscaleParams(params.model, params.provider)
kwargs['upscale'] = upscale
pipeline.append((callback, stage, kwargs))
# build and run chain pipeline

View File

@ -39,22 +39,17 @@ $defs:
type:
type: string
params:
type: object
properties:
args:
type: object
additionalProperties: False
patternProperties:
"^[-_A-Za-z]+$":
oneOf:
- type: number
- type: string
border:
$ref: "#/$defs/border_params"
image:
$ref: "#/$defs/image_params"
upscale:
$ref: "#/$defs/upscale_params"
allOf:
- $ref: "#/$defs/border_params"
- $ref: "#/$defs/image_params"
- $ref: "#/$defs/upscale_params"
- type: object
additionalProperties: False
patternProperties:
"^[-_A-Za-z]+$":
oneOf:
- type: number
- type: string
request_chain:
type: array

View File

@ -11,7 +11,8 @@
"name": "refine",
"type": "blend-img2img",
"params": {
"prompt": "a magical wizard in a robe fighting a dragon"
"prompt": "a magical wizard in a robe fighting a dragon",
"strength": 0.5
}
},
{