1
0
Fork 0

fix(api): correct pipeline method for txt2img mode

This commit is contained in:
Sean Sube 2023-01-11 22:23:33 -06:00
parent ddc6c9fb1a
commit 20ece4b30e
1 changed files with 14 additions and 6 deletions

View File

@ -225,7 +225,10 @@ def pipeline_from_request():
def run_txt2img_pipeline(model, provider, scheduler, prompt, negative_prompt, cfg, steps, seed, output, height, width): def run_txt2img_pipeline(model, provider, scheduler, prompt, negative_prompt, cfg, steps, seed, output, height, width):
pipe = load_pipeline(OnnxStableDiffusionPipeline, pipe = load_pipeline(OnnxStableDiffusionPipeline,
model, provider, scheduler) model, provider, scheduler,
custom_pipeline='lpw_stable_diffusion_onnx',
revision='onnx',
)
latents = get_latents_from_seed(seed, width, height) latents = get_latents_from_seed(seed, width, height)
rng = np.random.RandomState(seed) rng = np.random.RandomState(seed)
@ -274,7 +277,8 @@ def run_inpaint_pipeline(model, provider, scheduler, prompt, negative_prompt, cf
if left > 0 or right > 0 or top > 0 or bottom > 0: if left > 0 or right > 0 or top > 0 or bottom > 0:
print('expanding image for outpainting') print('expanding image for outpainting')
source_image, mask_image, _full_noise, _full_dims = expand_image(source_image, mask_image, (left, right, top, bottom)) source_image, mask_image, _full_noise, _full_dims = expand_image(
source_image, mask_image, (left, right, top, bottom))
image = pipe( image = pipe(
prompt, prompt,
@ -446,10 +450,14 @@ def inpaint():
(model, provider, scheduler, prompt, negative_prompt, cfg, steps, height, (model, provider, scheduler, prompt, negative_prompt, cfg, steps, height,
width, seed) = pipeline_from_request() width, seed) = pipeline_from_request()
left = get_and_clamp_int(request.args, 'left', 0, config_params.get('width').get('max'), 0) left = get_and_clamp_int(request.args, 'left', 0,
right = get_and_clamp_int(request.args, 'right', 0, config_params.get('width').get('max'), 0) config_params.get('width').get('max'), 0)
top = get_and_clamp_int(request.args, 'top', 0, config_params.get('height').get('max'), 0) right = get_and_clamp_int(request.args, 'right',
bottom = get_and_clamp_int(request.args, 'bottom', 0, config_params.get('height').get('max'), 0) 0, config_params.get('width').get('max'), 0)
top = get_and_clamp_int(request.args, 'top', 0,
config_params.get('height').get('max'), 0)
bottom = get_and_clamp_int(
request.args, 'bottom', 0, config_params.get('height').get('max'), 0)
(output_file, output_full) = make_output_path( (output_file, output_full) = make_output_path(
'inpaint', seed, (prompt, cfg, steps, height, width, seed, left, right, top, bottom)) 'inpaint', seed, (prompt, cfg, steps, height, width, seed, left, right, top, bottom))