Skip to content

Commit

Permalink
fix(api): add latents to inpaint, remove strength
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jan 9, 2023
1 parent 182ce6d commit 131cff6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/onnx_web/serve.py
Expand Up @@ -345,21 +345,23 @@ def inpaint():
mask_image = Image.open(BytesIO(mask_file.read())).convert('RGB')
mask_image.thumbnail((default_width, default_height))

strength = get_and_clamp_float(request.args, 'strength', 0.5, 1.0)

(model, provider, scheduler, prompt, negative_prompt, cfg, steps, height,
width, seed, pipe) = pipeline_from_request(OnnxStableDiffusionInpaintPipeline)

latents = get_latents_from_seed(seed, width, height)
rng = np.random.RandomState(seed)

image = pipe(
prompt,
generator=rng,
guidance_scale=cfg,
height=height,
image=source_image,
latents=latents,
mask_image=mask_image,
negative_prompt=negative_prompt,
num_inference_steps=steps,
strength=strength,
width=width,
).images[0]

(output_file, output_full) = make_output_path('inpaint', (prompt, cfg, steps, height, width, seed))
Expand Down

0 comments on commit 131cff6

Please sign in to comment.