Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -126,9 +126,9 @@ def inference(model_name, prompt, guidance, steps, n_images=1, width=512, height
|
|
126 |
|
127 |
try:
|
128 |
if img is not None:
|
129 |
-
return img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance, steps, width, height, generator, seed),
|
130 |
else:
|
131 |
-
return txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator, seed),
|
132 |
except Exception as e:
|
133 |
return None, error_str(e)
|
134 |
|
@@ -142,7 +142,7 @@ def txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width,
|
|
142 |
if model_path != current_model_path or last_mode != "txt2img":
|
143 |
current_model_path = model_path
|
144 |
|
145 |
-
update_state("Loading text-to-image model...")
|
146 |
|
147 |
if is_colab or current_model == custom_model:
|
148 |
pipe = StableDiffusionPipeline.from_pretrained(
|
@@ -177,7 +177,7 @@ def txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width,
|
|
177 |
generator = generator,
|
178 |
callback=pipe_callback)
|
179 |
|
180 |
-
update_state(f"Done. Seed: {seed}")
|
181 |
|
182 |
return replace_nsfw_images(result)
|
183 |
|
@@ -191,7 +191,7 @@ def img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance
|
|
191 |
if model_path != current_model_path or last_mode != "img2img":
|
192 |
current_model_path = model_path
|
193 |
|
194 |
-
update_state("Loading image-to-image model...")
|
195 |
|
196 |
if is_colab or current_model == custom_model:
|
197 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
|
@@ -230,7 +230,7 @@ def img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance
|
|
230 |
generator = generator,
|
231 |
callback=pipe_callback)
|
232 |
|
233 |
-
update_state(f"Done. Seed: {seed}")
|
234 |
|
235 |
return replace_nsfw_images(result)
|
236 |
|
|
|
126 |
|
127 |
try:
|
128 |
if img is not None:
|
129 |
+
return img_to_img(model_path, prompt, n_images, neg_prompt, img, strength, guidance, steps, width, height, generator, seed), f"Done. Seed: {seed}"
|
130 |
else:
|
131 |
+
return txt_to_img(model_path, prompt, n_images, neg_prompt, guidance, steps, width, height, generator, seed), f"Done. Seed: {seed}"
|
132 |
except Exception as e:
|
133 |
return None, error_str(e)
|
134 |
|
|
|
142 |
if model_path != current_model_path or last_mode != "txt2img":
|
143 |
current_model_path = model_path
|
144 |
|
145 |
+
update_state(f"Loading {current_model.name} text-to-image model...")
|
146 |
|
147 |
if is_colab or current_model == custom_model:
|
148 |
pipe = StableDiffusionPipeline.from_pretrained(
|
|
|
177 |
generator = generator,
|
178 |
callback=pipe_callback)
|
179 |
|
180 |
+
# update_state(f"Done. Seed: {seed}")
|
181 |
|
182 |
return replace_nsfw_images(result)
|
183 |
|
|
|
191 |
if model_path != current_model_path or last_mode != "img2img":
|
192 |
current_model_path = model_path
|
193 |
|
194 |
+
update_state(f"Loading {current_model.name} image-to-image model...")
|
195 |
|
196 |
if is_colab or current_model == custom_model:
|
197 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
|
|
|
230 |
generator = generator,
|
231 |
callback=pipe_callback)
|
232 |
|
233 |
+
# update_state(f"Done. Seed: {seed}")
|
234 |
|
235 |
return replace_nsfw_images(result)
|
236 |
|