Spaces:
Running
on
Zero
Running
on
Zero
Alexander Bagus
commited on
Commit
·
8d6757d
1
Parent(s):
fbb7b15
22
Browse files
app.py
CHANGED
|
@@ -125,7 +125,7 @@ def inference(
|
|
| 125 |
scale_target = 2
|
| 126 |
# rescale to prevent OOM
|
| 127 |
input_image = edit_dict['background']
|
| 128 |
-
input_image, width, height = image_utils.rescale_image(input_image,
|
| 129 |
sample_size = [height, width]
|
| 130 |
|
| 131 |
print("DEBUG: inpaint_image")
|
|
@@ -136,14 +136,14 @@ def inference(
|
|
| 136 |
|
| 137 |
print("DEBUG: mask_image")
|
| 138 |
if mask_image is not None:
|
| 139 |
-
mask_image, w, h = image_utils.rescale_image(mask_image,
|
| 140 |
mask_image = get_image_latent(mask_image, sample_size=sample_size)[:, :1, 0]
|
| 141 |
else:
|
| 142 |
mask_image = torch.ones([1, 1, sample_size[0], sample_size[1]]) * 255
|
| 143 |
|
| 144 |
print("DEBUG: control_image_torch")
|
| 145 |
processor = Processor('canny')
|
| 146 |
-
control_image, w, h = image_utils.rescale_image(input_image,
|
| 147 |
control_image = control_image.resize((1024, 1024))
|
| 148 |
control_image = processor(control_image, to_pil=True)
|
| 149 |
control_image = control_image.resize((width, height))
|
|
@@ -198,7 +198,7 @@ with gr.Blocks() as demo:
|
|
| 198 |
brush= gr.Brush(
|
| 199 |
colors=["#FFFFFF"],
|
| 200 |
color_mode="fixed",
|
| 201 |
-
default_size=75
|
| 202 |
),
|
| 203 |
label="Edit Image"
|
| 204 |
)
|
|
|
|
| 125 |
scale_target = 2
|
| 126 |
# rescale to prevent OOM
|
| 127 |
input_image = edit_dict['background']
|
| 128 |
+
input_image, width, height = image_utils.rescale_image(input_image, scale_target, 8, max_size=1280)
|
| 129 |
sample_size = [height, width]
|
| 130 |
|
| 131 |
print("DEBUG: inpaint_image")
|
|
|
|
| 136 |
|
| 137 |
print("DEBUG: mask_image")
|
| 138 |
if mask_image is not None:
|
| 139 |
+
mask_image, w, h = image_utils.rescale_image(mask_image, scale_target, 8, max_size=1280)
|
| 140 |
mask_image = get_image_latent(mask_image, sample_size=sample_size)[:, :1, 0]
|
| 141 |
else:
|
| 142 |
mask_image = torch.ones([1, 1, sample_size[0], sample_size[1]]) * 255
|
| 143 |
|
| 144 |
print("DEBUG: control_image_torch")
|
| 145 |
processor = Processor('canny')
|
| 146 |
+
control_image, w, h = image_utils.rescale_image(input_image, scale_target, 8, max_size=1280)
|
| 147 |
control_image = control_image.resize((1024, 1024))
|
| 148 |
control_image = processor(control_image, to_pil=True)
|
| 149 |
control_image = control_image.resize((width, height))
|
|
|
|
| 198 |
brush= gr.Brush(
|
| 199 |
colors=["#FFFFFF"],
|
| 200 |
color_mode="fixed",
|
| 201 |
+
# default_size=75
|
| 202 |
),
|
| 203 |
label="Edit Image"
|
| 204 |
)
|