Update app.py
Browse files
app.py
CHANGED
@@ -63,11 +63,17 @@ 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 |
def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator):
|
67 |
|
68 |
result = pipe(
|
69 |
prompt,
|
70 |
-
|
71 |
negative_prompt = neg_prompt,
|
72 |
num_inference_steps = int(steps),
|
73 |
guidance_scale = guidance,
|
@@ -83,7 +89,7 @@ def img_to_img(prompt, neg_prompt, img, strength, guidance, steps, width, height
|
|
83 |
img = img.resize((int(img.width * ratio), int(img.height * ratio)), Image.LANCZOS)
|
84 |
result = pipe_i2i(
|
85 |
prompt,
|
86 |
-
|
87 |
negative_prompt = neg_prompt,
|
88 |
init_image = img,
|
89 |
num_inference_steps = int(steps),
|
|
|
63 |
except Exception as e:
|
64 |
return None, error_str(e)
|
65 |
|
66 |
+
def dummy(images, **kwargs):
|
67 |
+
return images, False
|
68 |
+
|
69 |
+
|
70 |
+
It is similar to the notebook code, but this one works for local run
|
71 |
+
|
72 |
def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator):
|
73 |
|
74 |
result = pipe(
|
75 |
prompt,
|
76 |
+
check_safety = dummy,
|
77 |
negative_prompt = neg_prompt,
|
78 |
num_inference_steps = int(steps),
|
79 |
guidance_scale = guidance,
|
|
|
89 |
img = img.resize((int(img.width * ratio), int(img.height * ratio)), Image.LANCZOS)
|
90 |
result = pipe_i2i(
|
91 |
prompt,
|
92 |
+
check_safety = dummy,
|
93 |
negative_prompt = neg_prompt,
|
94 |
init_image = img,
|
95 |
num_inference_steps = int(steps),
|