Update app.py
Browse files
app.py
CHANGED
|
@@ -63,13 +63,12 @@ def inference(prompt, guidance, steps, width=512, height=512, seed=0, img=None,
|
|
| 63 |
except Exception as e:
|
| 64 |
return None, error_str(e)
|
| 65 |
|
| 66 |
-
|
| 67 |
|
| 68 |
def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator):
|
| 69 |
|
| 70 |
result = pipe(
|
| 71 |
prompt,
|
| 72 |
-
pipe.safety_checker = dummy,
|
| 73 |
negative_prompt = neg_prompt,
|
| 74 |
num_inference_steps = int(steps),
|
| 75 |
guidance_scale = guidance,
|
|
@@ -85,7 +84,6 @@ def img_to_img(prompt, neg_prompt, img, strength, guidance, steps, width, height
|
|
| 85 |
img = img.resize((int(img.width * ratio), int(img.height * ratio)), Image.LANCZOS)
|
| 86 |
result = pipe_i2i(
|
| 87 |
prompt,
|
| 88 |
-
pipe.safety_checker = dummy,
|
| 89 |
negative_prompt = neg_prompt,
|
| 90 |
init_image = img,
|
| 91 |
num_inference_steps = int(steps),
|
|
|
|
| 63 |
except Exception as e:
|
| 64 |
return None, error_str(e)
|
| 65 |
|
| 66 |
+
pipe.safety_checker = lambda images, clip_input: (images, False)
|
| 67 |
|
| 68 |
def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator):
|
| 69 |
|
| 70 |
result = pipe(
|
| 71 |
prompt,
|
|
|
|
| 72 |
negative_prompt = neg_prompt,
|
| 73 |
num_inference_steps = int(steps),
|
| 74 |
guidance_scale = guidance,
|
|
|
|
| 84 |
img = img.resize((int(img.width * ratio), int(img.height * ratio)), Image.LANCZOS)
|
| 85 |
result = pipe_i2i(
|
| 86 |
prompt,
|
|
|
|
| 87 |
negative_prompt = neg_prompt,
|
| 88 |
init_image = img,
|
| 89 |
num_inference_steps = int(steps),
|