Skip to content

Commit

Permalink
feat(api): enable LPW custom pipeline (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Feb 4, 2023
1 parent d636ce3 commit 70dedf8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions api/onnx_web/chain/upscale_outpaint.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ def outpaint(image: Image.Image, dims: Tuple[int, int, int]):
latents = get_tile_latents(full_latents, dims)
rng = np.random.RandomState(params.seed)

result = pipe(
result = pipe.inpaint(
image,
mask,
prompt,
generator=rng,
guidance_scale=params.cfg,
height=size.height,
image=image,
latents=latents,
mask_image=mask,
negative_prompt=params.negative_prompt,
num_inference_steps=params.steps,
width=size.width,
Expand Down
2 changes: 2 additions & 0 deletions api/onnx_web/diffusion/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def load_pipeline(pipeline: DiffusionPipeline, model: str, provider: str, schedu
logger.debug('loading new diffusion pipeline from %s', model)
pipe = pipeline.from_pretrained(
model,
custom_pipeline='lpw_stable_diffusion_onnx',
revision='onnx',
provider=provider,
safety_checker=None,
scheduler=scheduler.from_pretrained(model, subfolder='scheduler')
Expand Down
6 changes: 3 additions & 3 deletions api/onnx_web/diffusion/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def run_txt2img_pipeline(
rng = np.random.RandomState(params.seed)

progress = job.get_progress_callback()
result = pipe(
result = pipe.txt2img(
params.prompt,
height=size.height,
width=size.width,
Expand Down Expand Up @@ -97,11 +97,11 @@ def run_img2img_pipeline(
rng = np.random.RandomState(params.seed)

progress = job.get_progress_callback()
result = pipe(
result = pipe.img2img(
source_image,
params.prompt,
generator=rng,
guidance_scale=params.cfg,
image=source_image,
negative_prompt=params.negative_prompt,
num_inference_steps=params.steps,
strength=strength,
Expand Down

0 comments on commit 70dedf8

Please sign in to comment.