1
0
Fork 0

create pipeline in request

This commit is contained in:
Sean Sube 2023-01-04 23:42:11 -06:00
parent 73027bb813
commit 2e95e02ef1
1 changed files with 7 additions and 3 deletions

View File

@ -47,7 +47,6 @@ def setup():
# setup # setup
setup() setup()
app = Flask(__name__) app = Flask(__name__)
pipe = OnnxStableDiffusionPipeline.from_pretrained(model_path, provider="DmlExecutionProvider", safety_checker=None)
# routes # routes
@app.route('/') @app.route('/')
@ -70,13 +69,18 @@ def txt2img():
print("txt2img from %s: %s/%s, %sx%s, %s" % (user, cfg, steps, width, height, prompt)) print("txt2img from %s: %s/%s, %sx%s, %s" % (user, cfg, steps, width, height, prompt))
image_queue.add(user) image_queue.add(user)
pipe = OnnxStableDiffusionPipeline.from_pretrained(
model_path,
provider="DmlExecutionProvider",
safety_checker=None,
scheduler=scheduler
)
image = pipe( image = pipe(
prompt, prompt,
height, height,
width, width,
num_inference_steps=steps, num_inference_steps=steps,
guidance_scale=cfg, guidance_scale=cfg
scheduler=scheduler
).images[0] ).images[0]
output = '%s/txt2img-%s' % (output_path, snakecase(prompt)) output = '%s/txt2img-%s' % (output_path, snakecase(prompt))