From 4e3a86dfdbb68eefd84dd221af58be36a26f3547 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Wed, 11 Jan 2023 21:59:58 -0600 Subject: [PATCH] lint(api): join all paths --- api/onnx_web/serve.py | 6 +++--- api/test-setup.py | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/api/onnx_web/serve.py b/api/onnx_web/serve.py index 935284b9..cfd1bf2f 100644 --- a/api/onnx_web/serve.py +++ b/api/onnx_web/serve.py @@ -47,9 +47,9 @@ max_height = 512 max_width = 512 # paths -model_path = environ.get('ONNX_WEB_MODEL_PATH', '../models') -output_path = environ.get('ONNX_WEB_OUTPUT_PATH', '../outputs') -params_path = environ.get('ONNX_WEB_PARAMS_PATH', './params.json') +model_path = environ.get('ONNX_WEB_MODEL_PATH', path.join('..', 'models')) +output_path = environ.get('ONNX_WEB_OUTPUT_PATH', path.join('..', 'outputs')) +params_path = environ.get('ONNX_WEB_PARAMS_PATH', 'params.json') # pipeline caching diff --git a/api/test-setup.py b/api/test-setup.py index c3955d14..8156c1e9 100644 --- a/api/test-setup.py +++ b/api/test-setup.py @@ -1,11 +1,15 @@ from diffusers import OnnxStableDiffusionPipeline +from os import path cfg = 8 steps = 22 height = 512 width = 512 -prompt = "an astronaut eating a hamburger" -pipe = OnnxStableDiffusionPipeline.from_pretrained("../models/stable-diffusion-onnx-v1-5", provider="DmlExecutionProvider", safety_checker=None) +model = path.join('..', 'models', 'stable-diffusion-onnx-v1-5') +prompt = 'an astronaut eating a hamburger' +output = path.join('..', 'outputs', 'test.png') + +pipe = OnnxStableDiffusionPipeline.from_pretrained(model, provider='DmlExecutionProvider', safety_checker=None) image = pipe(prompt, height, width, num_inference_steps=steps, guidance_scale=cfg).images[0] -image.save("../test.png") \ No newline at end of file +image.save(output) \ No newline at end of file