anzorq commited on
Commit
49cacd8
1 Parent(s): 57a945a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -170,6 +170,7 @@ def process_image(img, width, height):
170
 
171
  def inference_image(pipe, model_path, prompt, mode, *args, **kwargs):
172
  print(f"{datetime.datetime.now()} {mode}, model: {model_path}")
 
173
  load_model(pipe, model_path, mode)
174
  prompt = current_model.prefix + prompt
175
  result = pipe(
@@ -180,7 +181,7 @@ def inference_image(pipe, model_path, prompt, mode, *args, **kwargs):
180
  )
181
  return replace_nsfw_images(result)
182
 
183
- def txt_to_img(pipe, model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator, seed):
184
  return inference_image(pipe, model_path, prompt, "txt2img",
185
  negative_prompt=neg_prompt,
186
  num_images_per_prompt=n_images,
@@ -192,7 +193,7 @@ def txt_to_img(pipe, model_path, prompt, n_images, neg_prompt, guidance, steps,
192
  seed=seed
193
  )
194
 
195
- def img_to_img(pipe, model_path, prompt, n_images, neg_prompt, img, strength, guidance, steps, width, height, generator, seed):
196
  img = process_image(img, width, height)
197
  return inference_image(pipe, model_path, prompt, "img2img",
198
  negative_prompt=neg_prompt,
 
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)
175
  prompt = current_model.prefix + prompt
176
  result = pipe(
 
181
  )
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,
 
193
  seed=seed
194
  )
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,