(image, mask)
| 134 | |
| 135 | |
| 136 | def fooocus_fill(image, mask): |
| 137 | current_image = image.copy() |
| 138 | raw_image = image.copy() |
| 139 | area = np.where(mask < 127) |
| 140 | store = raw_image[area] |
| 141 | |
| 142 | for k, repeats in [(512, 2), (256, 2), (128, 4), (64, 4), (33, 8), (15, 8), (5, 16), (3, 16)]: |
| 143 | for _ in range(repeats): |
| 144 | current_image = box_blur(current_image, k) |
| 145 | current_image[area] = store |
| 146 | |
| 147 | return current_image |
| 148 | |
| 149 | |
| 150 | class InpaintWorker: |