anzorq commited on
Commit
740784e
1 Parent(s): 49cacd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -168,7 +168,7 @@ def process_image(img, width, height):
168
  return img.resize((int(img.width * ratio), int(img.height * ratio)), Image.LANCZOS)
169
 
170
 
171
- def inference_image(pipe, model_path, prompt, mode, *args, **kwargs):
172
  print(f"{datetime.datetime.now()} {mode}, model: {model_path}")
173
  global pipe
174
  load_model(pipe, model_path, mode)
@@ -182,7 +182,7 @@ def inference_image(pipe, model_path, prompt, mode, *args, **kwargs):
182
  return replace_nsfw_images(result)
183
 
184
  def txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator, seed):
185
- return inference_image(pipe, model_path, prompt, "txt2img",
186
  negative_prompt=neg_prompt,
187
  num_images_per_prompt=n_images,
188
  num_inference_steps=int(steps),
@@ -195,7 +195,7 @@ def txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width,
195
 
196
  def img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance, steps, width, height, generator, seed):
197
  img = process_image(img, width, height)
198
- return inference_image(pipe, model_path, prompt, "img2img",
199
  negative_prompt=neg_prompt,
200
  num_images_per_prompt=n_images,
201
  image=img,
 
168
  return img.resize((int(img.width * ratio), int(img.height * ratio)), Image.LANCZOS)
169
 
170
 
171
+ def inference_image(model_path, prompt, mode, *args, **kwargs):
172
  print(f"{datetime.datetime.now()} {mode}, model: {model_path}")
173
  global pipe
174
  load_model(pipe, model_path, mode)
 
182
  return replace_nsfw_images(result)
183
 
184
  def txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator, seed):
185
+ return inference_image(model_path, prompt, "txt2img",
186
  negative_prompt=neg_prompt,
187
  num_images_per_prompt=n_images,
188
  num_inference_steps=int(steps),
 
195
 
196
  def img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance, steps, width, height, generator, seed):
197
  img = process_image(img, width, height)
198
+ return inference_image(model_path, prompt, "img2img",
199
  negative_prompt=neg_prompt,
200
  num_images_per_prompt=n_images,
201
  image=img,