Skip to content

Commit

Permalink
fix(api): correct output paths, read strength from params
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jan 16, 2023
1 parent f9c3348 commit a76793d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions api/onnx_web/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def run_txt2img_pipeline(params: BaseParams, size: Size, output: OutputPath):
num_inference_steps=params.steps,
).images[0]
image = upscale_resrgan(image, model_path)
image.save(output.file)
image.save(output.path)

print('saved txt2img output: %s' % (output.file))

Expand All @@ -121,9 +121,9 @@ def run_img2img_pipeline(params: BaseParams, output: OutputPath, strength: float
strength=strength,
).images[0]
image = upscale_resrgan(image, model_path)
image.save(params.output.file)
image.save(output.path)

print('saved img2img output: %s' % (params.output.file))
print('saved img2img output: %s' % (output.file))


def run_inpaint_pipeline(
Expand Down Expand Up @@ -168,6 +168,6 @@ def run_inpaint_pipeline(
width=size.width,
).images[0]

image.save(output.file)
image.save(output.path)

print('saved inpaint output: %s' % (output.file))
6 changes: 5 additions & 1 deletion api/onnx_web/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,11 @@ def img2img():
input_file = request.files.get('source')
input_image = Image.open(BytesIO(input_file.read())).convert('RGB')

strength = get_and_clamp_float(request.args, 'strength', 0.5, 1.0)
strength = get_and_clamp_float(
request.args,
'strength',
config_params.get('strength').get('default'),
config_params.get('strength').get('max'))

params, size = pipeline_from_request()

Expand Down

0 comments on commit a76793d

Please sign in to comment.