AdamOswald1 commited on
Commit
c734170
1 Parent(s): 35e555c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -140,9 +140,9 @@ def inference(model_name, prompt, guidance, steps, n_images=1, width=512, height
140
 
141
  try:
142
  if img is not None:
143
- return img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance, steps, width, height, generator, seed), None
144
  else:
145
- return txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator, seed), None
146
  except Exception as e:
147
  return None, error_str(e)
148
 
@@ -156,7 +156,7 @@ def txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width,
156
  if model_path != current_model_path or last_mode != "txt2img":
157
  current_model_path = model_path
158
 
159
- update_state("Loading text-to-image model...")
160
 
161
  if is_colab or current_model == custom_model:
162
  pipe = StableDiffusionPipeline.from_pretrained(
@@ -191,7 +191,7 @@ def txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width,
191
  generator = generator,
192
  callback=pipe_callback)
193
 
194
- update_state(f"Done. Seed: {seed}")
195
 
196
  return replace_nsfw_images(result)
197
 
@@ -205,7 +205,7 @@ def img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance
205
  if model_path != current_model_path or last_mode != "img2img":
206
  current_model_path = model_path
207
 
208
- update_state("Loading image-to-image model...")
209
 
210
  if is_colab or current_model == custom_model:
211
  pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
@@ -244,7 +244,7 @@ def img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance
244
  generator = generator,
245
  callback=pipe_callback)
246
 
247
- update_state(f"Done. Seed: {seed}")
248
 
249
  return replace_nsfw_images(result)
250
 
 
140
 
141
  try:
142
  if img is not None:
143
+ return img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance, steps, width, height, generator, seed), f"Done. Seed: {seed}"
144
  else:
145
+ return txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator, seed), f"Done. Seed: {seed}"
146
  except Exception as e:
147
  return None, error_str(e)
148
 
 
156
  if model_path != current_model_path or last_mode != "txt2img":
157
  current_model_path = model_path
158
 
159
+ update_state(f"Loading {current_model.name} text-to-image model...")
160
 
161
  if is_colab or current_model == custom_model:
162
  pipe = StableDiffusionPipeline.from_pretrained(
 
191
  generator = generator,
192
  callback=pipe_callback)
193
 
194
+ # update_state(f"Done. Seed: {seed}")
195
 
196
  return replace_nsfw_images(result)
197
 
 
205
  if model_path != current_model_path or last_mode != "img2img":
206
  current_model_path = model_path
207
 
208
+ update_state(f"Loading {current_model.name} image-to-image model...")
209
 
210
  if is_colab or current_model == custom_model:
211
  pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
 
244
  generator = generator,
245
  callback=pipe_callback)
246
 
247
+ # update_state(f"Done. Seed: {seed}")
248
 
249
  return replace_nsfw_images(result)
250