1
0
Fork 0

lint(api): join all paths

This commit is contained in:
Sean Sube 2023-01-11 21:59:58 -06:00
parent dc33b7c887
commit 4e3a86dfdb
2 changed files with 10 additions and 6 deletions

View File

@ -47,9 +47,9 @@ max_height = 512
max_width = 512 max_width = 512
# paths # paths
model_path = environ.get('ONNX_WEB_MODEL_PATH', '../models') model_path = environ.get('ONNX_WEB_MODEL_PATH', path.join('..', 'models'))
output_path = environ.get('ONNX_WEB_OUTPUT_PATH', '../outputs') output_path = environ.get('ONNX_WEB_OUTPUT_PATH', path.join('..', 'outputs'))
params_path = environ.get('ONNX_WEB_PARAMS_PATH', './params.json') params_path = environ.get('ONNX_WEB_PARAMS_PATH', 'params.json')
# pipeline caching # pipeline caching

View File

@ -1,11 +1,15 @@
from diffusers import OnnxStableDiffusionPipeline from diffusers import OnnxStableDiffusionPipeline
from os import path
cfg = 8 cfg = 8
steps = 22 steps = 22
height = 512 height = 512
width = 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 = pipe(prompt, height, width, num_inference_steps=steps, guidance_scale=cfg).images[0]
image.save("../test.png") image.save(output)