1
0
Fork 0
onnx-web/api/test-setup.py

11 lines
402 B
Python
Raw Permalink Normal View History

2023-01-05 15:44:01 +00:00
from diffusers import OnnxStableDiffusionPipeline
2023-01-05 16:05:23 +00:00
cfg = 8
steps = 22
height = 512
width = 512
2023-01-05 15:44:01 +00:00
prompt = "an astronaut eating a hamburger"
2023-01-05 21:38:29 +00:00
pipe = OnnxStableDiffusionPipeline.from_pretrained("../models/stable-diffusion-onnx-v1-5", provider="DmlExecutionProvider", safety_checker=None)
2023-01-05 15:44:01 +00:00
image = pipe(prompt, height, width, num_inference_steps=steps, guidance_scale=cfg).images[0]
2023-01-05 16:05:23 +00:00
image.save("../test.png")