FairyFromAbove commited on
Commit
0507455
·
verified ·
1 Parent(s): f468220

Upload 6 files

Browse files
Files changed (6) hide show
  1. Revision by XpucT.py +617 -0
  2. config.json +437 -0
  3. styles.csv +30 -0
  4. ui-config.json +0 -0
  5. user.css +256 -0
  6. user.js +67 -0
Revision by XpucT.py ADDED
@@ -0,0 +1,617 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Author: XpucT
2
+ # Script's homepage: https://boosty.to/xpuct
3
+
4
+ import modules.scripts as scripts
5
+ import gradio as gr
6
+ import numpy as np
7
+ import cv2
8
+ import math
9
+ import random
10
+ import modules.images as images
11
+
12
+ from modules.processing import Processed
13
+ from PIL import ImageEnhance, Image, ImageDraw, ImageFilter, ImageChops, ImageOps, ImageFont
14
+ from blendmodes.blend import blendLayers, BlendType
15
+ from typing import List
16
+
17
+
18
+ def resetValues(saturationSlider, temperatureSlider, brightnessSlider, contrastSlider, sharpnessSlider, blurSlider, noiseSlider, vignetteSlider, exposureOffsetSlider, hdrSlider):
19
+ saturationSlider = 1
20
+ temperatureSlider = 1
21
+ brightnessSlider = 1
22
+ contrastSlider = 1
23
+ sharpnessSlider = 0
24
+ blurSlider = 0
25
+ noiseSlider = 0
26
+ vignetteSlider = 0
27
+ exposureOffsetSlider = 0
28
+ hdrSlider = 0
29
+ return [saturationSlider, temperatureSlider, brightnessSlider, contrastSlider, sharpnessSlider, blurSlider, noiseSlider, vignetteSlider, exposureOffsetSlider, hdrSlider]
30
+
31
+
32
+ def bestChoiceValues(saturationSlider, temperatureSlider, brightnessSlider, contrastSlider, sharpnessSlider, blurSlider, noiseSlider, vignetteSlider, exposureOffsetSlider, hdrSlider):
33
+ saturationSlider = .98
34
+ temperatureSlider = 1.04
35
+ brightnessSlider = 1.01
36
+ contrastSlider = .97
37
+ sharpnessSlider = .02
38
+ blurSlider = 0
39
+ noiseSlider = .03
40
+ vignetteSlider = .05
41
+ exposureOffsetSlider = .1
42
+ hdrSlider = .16
43
+ return [saturationSlider, temperatureSlider, brightnessSlider, contrastSlider, sharpnessSlider, blurSlider, noiseSlider, vignetteSlider, exposureOffsetSlider, hdrSlider]
44
+
45
+
46
+ def add_chromatic(im, strength: float = 1, no_blur: bool = False):
47
+
48
+ if (im.size[0] % 2 == 0 or im.size[1] % 2 == 0):
49
+ if (im.size[0] % 2 == 0):
50
+ im = im.crop((0, 0, im.size[0] - 1, im.size[1]))
51
+ im.load()
52
+ if (im.size[1] % 2 == 0):
53
+ im = im.crop((0, 0, im.size[0], im.size[1] - 1))
54
+ im.load()
55
+
56
+ def cartesian_to_polar(data: np.ndarray) -> np.ndarray:
57
+ width = data.shape[1]
58
+ height = data.shape[0]
59
+ assert (width > 2)
60
+ assert (height > 2)
61
+ assert (width % 2 == 1)
62
+ assert (height % 2 == 1)
63
+ perimeter = 2 * (width + height - 2)
64
+ halfdiag = math.ceil(((width ** 2 + height ** 2) ** 0.5) / 2)
65
+ halfw = width // 2
66
+ halfh = height // 2
67
+ ret = np.zeros((halfdiag, perimeter, 3))
68
+
69
+ ret[0:(halfw + 1), halfh] = data[halfh, halfw::-1]
70
+ ret[0:(halfw + 1), height + width - 2 +
71
+ halfh] = data[halfh, halfw:(halfw * 2 + 1)]
72
+ ret[0:(halfh + 1), height - 1 +
73
+ halfw] = data[halfh:(halfh * 2 + 1), halfw]
74
+ ret[0:(halfh + 1), perimeter - halfw] = data[halfh::-1, halfw]
75
+
76
+ for i in range(0, halfh):
77
+ slope = (halfh - i) / (halfw)
78
+ diagx = ((halfdiag ** 2) / (slope ** 2 + 1)) ** 0.5
79
+ unit_xstep = diagx / (halfdiag - 1)
80
+ unit_ystep = diagx * slope / (halfdiag - 1)
81
+ for row in range(halfdiag):
82
+ ystep = round(row * unit_ystep)
83
+ xstep = round(row * unit_xstep)
84
+ if ((halfh >= ystep) and halfw >= xstep):
85
+ ret[row, i] = data[halfh - ystep, halfw - xstep]
86
+ ret[row, height - 1 - i] = data[halfh + ystep, halfw - xstep]
87
+ ret[row, height + width - 2 +
88
+ i] = data[halfh + ystep, halfw + xstep]
89
+ ret[row, height + width + height - 3 -
90
+ i] = data[halfh - ystep, halfw + xstep]
91
+ else:
92
+ break
93
+
94
+ for j in range(1, halfw):
95
+ slope = (halfh) / (halfw - j)
96
+ diagx = ((halfdiag ** 2) / (slope ** 2 + 1)) ** 0.5
97
+ unit_xstep = diagx / (halfdiag - 1)
98
+ unit_ystep = diagx * slope / (halfdiag - 1)
99
+ for row in range(halfdiag):
100
+ ystep = round(row * unit_ystep)
101
+ xstep = round(row * unit_xstep)
102
+ if (halfw >= xstep and halfh >= ystep):
103
+ ret[row, height - 1 + j] = data[halfh + ystep, halfw - xstep]
104
+ ret[row, height + width - 2 -
105
+ j] = data[halfh + ystep, halfw + xstep]
106
+ ret[row, height + width + height - 3 +
107
+ j] = data[halfh - ystep, halfw + xstep]
108
+ ret[row, perimeter - j] = data[halfh - ystep, halfw - xstep]
109
+ else:
110
+ break
111
+ return ret
112
+
113
+ def polar_to_cartesian(data: np.ndarray, width: int, height: int) -> np.ndarray:
114
+ assert (width > 2)
115
+ assert (height > 2)
116
+ assert (width % 2 == 1)
117
+ assert (height % 2 == 1)
118
+ perimeter = 2 * (width + height - 2)
119
+ halfdiag = math.ceil(((width ** 2 + height ** 2) ** 0.5) / 2)
120
+ halfw = width // 2
121
+ halfh = height // 2
122
+ ret = np.zeros((height, width, 3))
123
+
124
+ def div0():
125
+ ret[halfh, halfw::-1] = data[0:(halfw + 1), halfh]
126
+ ret[halfh, halfw:(halfw * 2 + 1)] = data[0:(halfw + 1),
127
+ height + width - 2 + halfh]
128
+ ret[halfh:(halfh * 2 + 1), halfw] = data[0:(halfh + 1),
129
+ height - 1 + halfw]
130
+ ret[halfh::-1, halfw] = data[0:(halfh + 1), perimeter - halfw]
131
+
132
+ div0()
133
+
134
+ def part1():
135
+ for i in range(0, halfh):
136
+ slope = (halfh - i) / (halfw)
137
+ diagx = ((halfdiag ** 2) / (slope ** 2 + 1)) ** 0.5
138
+ unit_xstep = diagx / (halfdiag - 1)
139
+ unit_ystep = diagx * slope / (halfdiag - 1)
140
+ for row in range(halfdiag):
141
+ ystep = round(row * unit_ystep)
142
+ xstep = round(row * unit_xstep)
143
+ if ((halfh >= ystep) and halfw >= xstep):
144
+ ret[halfh - ystep, halfw - xstep] = \
145
+ data[row, i]
146
+ ret[halfh + ystep, halfw - xstep] = \
147
+ data[row, height - 1 - i]
148
+ ret[halfh + ystep, halfw + xstep] = \
149
+ data[row, height + width - 2 + i]
150
+ ret[halfh - ystep, halfw + xstep] = \
151
+ data[row, height + width + height - 3 - i]
152
+ else:
153
+ break
154
+
155
+ part1()
156
+
157
+ def part2():
158
+ for j in range(1, halfw):
159
+ slope = (halfh) / (halfw - j)
160
+ diagx = ((halfdiag ** 2) / (slope ** 2 + 1)) ** 0.5
161
+ unit_xstep = diagx / (halfdiag - 1)
162
+ unit_ystep = diagx * slope / (halfdiag - 1)
163
+ for row in range(halfdiag):
164
+ ystep = round(row * unit_ystep)
165
+ xstep = round(row * unit_xstep)
166
+ if (halfw >= xstep and halfh >= ystep):
167
+ ret[halfh + ystep, halfw - xstep] = \
168
+ data[row, height - 1 + j]
169
+ ret[halfh + ystep, halfw + xstep] = \
170
+ data[row, height + width - 2 - j]
171
+ ret[halfh - ystep, halfw + xstep] = \
172
+ data[row, height + width + height - 3 + j]
173
+ ret[halfh - ystep, halfw - xstep] = \
174
+ data[row, perimeter - j]
175
+ else:
176
+ break
177
+
178
+ part2()
179
+
180
+ def set_zeros():
181
+ zero_mask = ret[1:-1, 1:-1] == 0
182
+ ret[1:-1, 1:-1] = np.where(zero_mask, (ret[:-2,
183
+ 1:-1] + ret[2:, 1:-1]) / 2, ret[1:-1, 1:-1])
184
+
185
+ set_zeros()
186
+
187
+ return ret
188
+
189
+ def get_gauss(n: int) -> List[float]:
190
+ sigma = 0.3 * (n / 2 - 1) + 0.8
191
+ r = range(-int(n / 2), int(n / 2) + 1)
192
+ new_sum = sum([1 / (sigma * math.sqrt(2 * math.pi)) *
193
+ math.exp(-float(x) ** 2 / (2 * sigma ** 2)) for x in r])
194
+ return [(1 / (sigma * math.sqrt(2 * math.pi)) *
195
+ math.exp(-float(x) ** 2 / (2 * sigma ** 2))) / new_sum for x in r]
196
+
197
+ def vertical_gaussian(data: np.ndarray, n: int) -> np.ndarray:
198
+ padding = n - 1
199
+ width = data.shape[1]
200
+ height = data.shape[0]
201
+ padded_data = np.zeros((height + padding * 2, width))
202
+ padded_data[padding: -padding, :] = data
203
+ ret = np.zeros((height, width))
204
+ kernel = None
205
+ old_radius = - 1
206
+ for i in range(height):
207
+ radius = round(i * padding / (height - 1)) + 1
208
+ if (radius != old_radius):
209
+ old_radius = radius
210
+ kernel = np.tile(get_gauss(1 + 2 * (radius - 1)),
211
+ (width, 1)).transpose()
212
+ ret[i, :] = np.sum(np.multiply(
213
+ padded_data[padding + i - radius + 1:padding + i + radius, :], kernel), axis=0)
214
+ return ret
215
+
216
+ r, g, b = im.split()
217
+ rdata = np.asarray(r)
218
+ gdata = np.asarray(g)
219
+ bdata = np.asarray(b)
220
+ if no_blur:
221
+ rfinal = r
222
+ gfinal = g
223
+ bfinal = b
224
+ else:
225
+ poles = cartesian_to_polar(np.stack([rdata, gdata, bdata], axis=-1))
226
+ rpolar, gpolar, bpolar = poles[:, :,
227
+ 0], poles[:, :, 1], poles[:, :, 2],
228
+
229
+ bluramount = (im.size[0] + im.size[1] - 2) / 100 * strength
230
+ if round(bluramount) > 0:
231
+ rpolar = vertical_gaussian(rpolar, round(bluramount))
232
+ gpolar = vertical_gaussian(gpolar, round(bluramount * 1.2))
233
+ bpolar = vertical_gaussian(bpolar, round(bluramount * 1.4))
234
+
235
+ rgbpolar = np.stack([rpolar, gpolar, bpolar], axis=-1)
236
+ cartes = polar_to_cartesian(
237
+ rgbpolar, width=rdata.shape[1], height=rdata.shape[0])
238
+ rcartes, gcartes, bcartes = cartes[:, :,
239
+ 0], cartes[:, :, 1], cartes[:, :, 2],
240
+
241
+ rfinal = Image.fromarray(np.uint8(rcartes), 'L')
242
+ gfinal = Image.fromarray(np.uint8(gcartes), 'L')
243
+ bfinal = Image.fromarray(np.uint8(bcartes), 'L')
244
+
245
+ gfinal = gfinal.resize((round((1 + 0.018 * strength) * rdata.shape[1]),
246
+ round((1 + 0.018 * strength) * rdata.shape[0])), Image.ANTIALIAS)
247
+ bfinal = bfinal.resize((round((1 + 0.044 * strength) * rdata.shape[1]),
248
+ round((1 + 0.044 * strength) * rdata.shape[0])), Image.ANTIALIAS)
249
+
250
+ rwidth, rheight = rfinal.size
251
+ gwidth, gheight = gfinal.size
252
+ bwidth, bheight = bfinal.size
253
+ rhdiff = (bheight - rheight) // 2
254
+ rwdiff = (bwidth - rwidth) // 2
255
+ ghdiff = (bheight - gheight) // 2
256
+ gwdiff = (bwidth - gwidth) // 2
257
+
258
+ im = Image.merge("RGB", (
259
+ rfinal.crop((-rwdiff, -rhdiff, bwidth - rwdiff, bheight - rhdiff)),
260
+ gfinal.crop((-gwdiff, -ghdiff, bwidth - gwdiff, bheight - ghdiff)),
261
+ bfinal))
262
+
263
+ return im.crop((rwdiff, rhdiff, rwidth + rwdiff, rheight + rhdiff))
264
+
265
+
266
+ def tilt_shift(im, dof=60, focus_height=None):
267
+ above_focus, below_focus = im[:focus_height, :], im[focus_height:, :]
268
+ above_focus = increasing_blur(above_focus[::-1, ...], dof)[::-1, ...]
269
+ below_focus = increasing_blur(below_focus, dof)
270
+ out = np.vstack((above_focus, below_focus))
271
+ return out
272
+
273
+ def increasing_blur(im, dof=60):
274
+ blur_region = cv2.GaussianBlur(im[dof:, :], ksize=(15, 15), sigmaX=0)
275
+ if blur_region.shape[0] > dof:
276
+ blur_region = increasing_blur(blur_region, dof)
277
+ blend_col = np.linspace(1.0, 0, num=dof)
278
+ blend_mask = np.tile(blend_col, (im.shape[1], 1)).T
279
+ res = np.zeros_like(im)
280
+ res[:dof, :] = im[:dof, :]
281
+ dof_actual = min(dof, im.shape[0] - dof, blur_region.shape[0])
282
+ blend_mask = blend_mask[:dof_actual, :]
283
+ res[dof:dof + dof_actual, :] = im[dof:dof + dof_actual, :] * blend_mask[:, :, None] + blur_region[:dof_actual, :] * (1 - blend_mask[:, :, None])
284
+ if dof + dof < im.shape[0]:
285
+ res[dof + dof_actual:, :] = blur_region[dof_actual:]
286
+ return res
287
+
288
+ class Script(scripts.Script):
289
+ def title(self):
290
+ return 'Revision'
291
+
292
+ def show(self, is_img2img):
293
+ return scripts.AlwaysVisible
294
+
295
+ def ui(self, is_img2img):
296
+ with gr.Accordion('Revision', open=False):
297
+ with gr.Tab(label='Options', id=1):
298
+ enabled = gr.Checkbox(label="Enable")
299
+ clearEXIFCheckbox = gr.Checkbox(label="Clear EXIF (all metadata)")
300
+ flipImageCheckbox = gr.Checkbox(label="Flip image")
301
+ dontShowOriginalCheckbox = gr.Checkbox(label="Don't show original image")
302
+
303
+ with gr.Tab(label='Adjustments', id=2):
304
+ saturationSlider = gr.Slider(0, 2, 1, label='Saturation')
305
+ temperatureSlider = gr.Slider(0, 2, 1, label='Temperature')
306
+ brightnessSlider = gr.Slider(0, 2, 1, label='Brightness')
307
+ contrastSlider = gr.Slider(0, 2, 1, label='Contrast')
308
+ sharpnessSlider = gr.Slider(0, 1, 0, label='Sharpness')
309
+ blurSlider = gr.Slider(0, 1, 0, label='Blur')
310
+ noiseSlider = gr.Slider(0, 1, 0, label='Noise')
311
+ vignetteSlider = gr.Slider(0, 1, 0, step=.05, label='Vignette')
312
+ exposureOffsetSlider = gr.Slider(0, 1, 0, step=.05, label='Exposure offset')
313
+ hdrSlider = gr.Slider(0, 1, 0, label='HDR')
314
+
315
+ bestChoiceButton = gr.Button(value="Best Choice")
316
+ bestChoiceButton.click(bestChoiceValues, inputs=[saturationSlider, temperatureSlider, brightnessSlider, contrastSlider, sharpnessSlider, blurSlider, noiseSlider, vignetteSlider, exposureOffsetSlider, hdrSlider],
317
+ outputs=[saturationSlider, temperatureSlider, brightnessSlider, contrastSlider, sharpnessSlider, blurSlider, noiseSlider, vignetteSlider, exposureOffsetSlider, hdrSlider])
318
+
319
+ resetSlidersButton = gr.Button(value="Reset Sliders")
320
+ resetSlidersButton.click(resetValues, inputs=[saturationSlider, temperatureSlider, brightnessSlider, contrastSlider, sharpnessSlider, blurSlider, noiseSlider, vignetteSlider, exposureOffsetSlider, hdrSlider],
321
+ outputs=[saturationSlider, temperatureSlider, brightnessSlider, contrastSlider, sharpnessSlider, blurSlider, noiseSlider, vignetteSlider, exposureOffsetSlider, hdrSlider])
322
+
323
+ with gr.Tab(label='Effects', id=3):
324
+ lensDistortionRadioButton = gr.Radio(["None", "Lens Distortion", "Fish Eye"], label="Lens effect", value="None")
325
+ chromaticAberrationSlider = gr.Slider(0, 1, 0, label='Chromatic aberration')
326
+ snowfallSlider = gr.Slider(0, 3000, 0, step=1, label='Snowfall')
327
+ asciiSlider = gr.Slider(0, 20, 0, step=1, label='ASCII')
328
+ tiltShiftRadioButton = gr.Radio(["None", "Top", "Center", "Bottom"], label="Tilt Shift", value="None")
329
+ glitchCheckbox = gr.Checkbox(label="Glitch")
330
+ vhsCheckbox = gr.Checkbox(label="VHS")
331
+ watermark = gr.Textbox(label="Watermark text")
332
+
333
+ with gr.Tab(label='Custom EXIF', id=4):
334
+ customEXIF = gr.TextArea(
335
+ label="Here you can fill in your custom EXIF")
336
+
337
+ return [enabled, saturationSlider, temperatureSlider, brightnessSlider, contrastSlider, sharpnessSlider, blurSlider, noiseSlider, vignetteSlider, exposureOffsetSlider, hdrSlider,
338
+ clearEXIFCheckbox, flipImageCheckbox, dontShowOriginalCheckbox, lensDistortionRadioButton, chromaticAberrationSlider, customEXIF, tiltShiftRadioButton,
339
+ glitchCheckbox, vhsCheckbox, snowfallSlider, asciiSlider, watermark]
340
+
341
+ def postprocess(self, p, processed, enabled, saturationSlider, temperatureSlider, brightnessSlider, contrastSlider, sharpnessSlider, blurSlider, noiseSlider, vignetteSlider, exposureOffsetSlider, hdrSlider,
342
+ clearEXIFCheckbox, flipImageCheckbox, dontShowOriginalCheckbox, lensDistortionRadioButton, chromaticAberrationSlider, customEXIF, tiltShiftRadioButton,
343
+ glitchCheckbox, vhsCheckbox, snowfallSlider, asciiSlider, watermark):
344
+
345
+ if not enabled:
346
+ return
347
+
348
+ proc = processed
349
+ result = []
350
+
351
+ for i in range(len(proc.images)):
352
+ image = proc.images[i]
353
+ img = ImageEnhance.Color(image).enhance(saturationSlider)
354
+ img = ImageEnhance.Brightness(img).enhance(brightnessSlider)
355
+ img = ImageEnhance.Contrast(img).enhance(contrastSlider)
356
+
357
+ if vignetteSlider > 0:
358
+ width, height = img.size
359
+ mask = Image.new("L", (width, height), 0)
360
+ draw = ImageDraw.Draw(mask)
361
+ padding = 100 - vignetteSlider * 100
362
+ draw.ellipse((-padding, -padding, width +
363
+ padding, height + padding), fill=255)
364
+ mask = mask.filter(ImageFilter.GaussianBlur(radius=100))
365
+ img = Image.composite(img, Image.new(
366
+ "RGB", img.size, "black"), mask)
367
+
368
+ if hdrSlider > 0:
369
+ blurred = img.filter(ImageFilter.GaussianBlur(radius=2.8))
370
+ difference = ImageChops.difference(img, blurred)
371
+ sharpEdges = Image.blend(img, difference, 1)
372
+
373
+ convertedOriginalImage = np.array(
374
+ image)[:, :, ::-1].copy().astype('float32') / 255.0
375
+ convertedSharped = np.array(
376
+ sharpEdges)[:, :, ::-1].copy().astype('float32') / 255.0
377
+
378
+ colorDodge = convertedOriginalImage / (1 - convertedSharped)
379
+ convertedColorDodge = (
380
+ 255 * colorDodge).clip(0, 255).astype(np.uint8)
381
+
382
+ tempImage = Image.fromarray(cv2.cvtColor(
383
+ convertedColorDodge, cv2.COLOR_BGR2RGB))
384
+ invertedColorDodge = ImageOps.invert(tempImage)
385
+ blackWhiteColorDodge = ImageEnhance.Color(
386
+ invertedColorDodge).enhance(0)
387
+ hue = blendLayers(tempImage, blackWhiteColorDodge, BlendType.HUE)
388
+ hdrImage = blendLayers(hue, tempImage, BlendType.NORMAL, .7)
389
+
390
+ img = blendLayers(img, hdrImage, BlendType.NORMAL,
391
+ hdrSlider * 2).convert("RGB")
392
+
393
+ if sharpnessSlider > 0:
394
+ img = ImageEnhance.Sharpness(img).enhance(
395
+ (sharpnessSlider + 1) * 1.5)
396
+
397
+ if blurSlider > 0:
398
+ img = img.filter(ImageFilter.BoxBlur(blurSlider * 10))
399
+
400
+ if temperatureSlider != 1:
401
+ pixels = img.load()
402
+ for i in range(img.width):
403
+ for j in range(img.height):
404
+ (r, g, b) = pixels[i, j]
405
+ if temperatureSlider > 1:
406
+ r *= 1 + ((temperatureSlider - 1) / 4)
407
+ b *= 1 - (((temperatureSlider - 1) / 4))
408
+ else:
409
+ r *= 1 - (1 - temperatureSlider) / 4
410
+ b *= 1 + (((1 - temperatureSlider) / 4))
411
+ pixels[i, j] = (int(r), int(g), int(b))
412
+
413
+ if noiseSlider > 0:
414
+ noise = np.random.randint(0, noiseSlider * 100, img.size, np.uint8)
415
+ noise_img = Image.fromarray(noise, 'L').resize(
416
+ img.size).convert(img.mode)
417
+ img = ImageChops.add(img, noise_img)
418
+
419
+ if exposureOffsetSlider > 0:
420
+ np_img = np.array(img).astype(float) + exposureOffsetSlider * 75
421
+ np_img = np.clip(np_img, 0, 255).astype(np.uint8)
422
+ img = Image.fromarray(np_img)
423
+ img = ImageEnhance.Brightness(img).enhance(
424
+ brightnessSlider - exposureOffsetSlider / 4)
425
+
426
+ if flipImageCheckbox:
427
+ img = Image.fromarray(np.fliplr(np.array(img)))
428
+
429
+ if lensDistortionRadioButton != "None":
430
+ def add_lens_distortion(img, k1, k2):
431
+ img = np.array(img)[:, :, ::-1].copy()
432
+ rows, cols = img.shape[:2]
433
+ map_x, map_y = np.zeros((rows, cols), np.float32), np.zeros(
434
+ (rows, cols), np.float32)
435
+ for i in range(rows):
436
+ for j in range(cols):
437
+ r = np.sqrt((i - rows/2)**2 + (j - cols/2)**2)
438
+ x = j + (j - cols/2) * (k1 * r**2 + k2 * r**4)
439
+ y = i + (i - rows/2) * (k1 * r**2 + k2 * r**4)
440
+ if x >= 0 and x < cols and y >= 0 and y < rows:
441
+ map_x[i, j] = x
442
+ map_y[i, j] = y
443
+ return cv2.remap(img, map_x, map_y, cv2.INTER_LINEAR)
444
+
445
+ if lensDistortionRadioButton == "Lens Distortion":
446
+ img = add_lens_distortion(img, 1e-12, -1e-12)
447
+ else:
448
+ img = add_lens_distortion(img, 1e-12, 1e-12)
449
+ img = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
450
+
451
+ if chromaticAberrationSlider > 0:
452
+ img = add_chromatic(img, chromaticAberrationSlider + .12, True)
453
+
454
+ if tiltShiftRadioButton != "None":
455
+ width, height = img.size
456
+ ratio = 1/5 if tiltShiftRadioButton == "Top" else 1 / \
457
+ 2 if tiltShiftRadioButton == "Center" else 4/5
458
+ img = Image.fromarray(cv2.cvtColor(tilt_shift(np.array(
459
+ img)[:, :, ::-1].copy(), 60, round(height * ratio)), cv2.COLOR_BGR2RGB))
460
+
461
+ if glitchCheckbox:
462
+ img = np.array(img)[:, :, ::-1].copy()
463
+ num_glitches = 5
464
+ height, width = img.shape[:2]
465
+
466
+ for _ in range(num_glitches):
467
+ y = np.random.randint(height)
468
+ h = np.random.randint(10, 50)
469
+ y1 = np.clip(y - h // 2, 0, height)
470
+ y2 = np.clip(y + h // 2, 0, height)
471
+ w = np.random.randint(20, width // 4)
472
+ channel = np.random.randint(0, 3)
473
+ img[y1:y2, w:, channel] = img[y1:y2, :-w, channel]
474
+ img[y1:y2, :w, channel] = np.random.randint(0, 256, (y2 - y1, w), dtype=np.uint8)
475
+
476
+ img = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
477
+
478
+ if vhsCheckbox:
479
+ # Коррекция насыщености, яркости и контрастности
480
+ img = ImageEnhance.Color(img).enhance(0.88)
481
+ img = ImageEnhance.Brightness(img).enhance(1.06)
482
+ img = ImageEnhance.Contrast(img).enhance(0.88)
483
+
484
+ # Цветной шум
485
+ noise = np.random.normal(loc=128, scale=128, size=img.size[::-1] + (3,)).clip(0, 255).astype(np.uint8)
486
+ dust_and_scratches = Image.fromarray(noise, 'RGB').filter(ImageFilter.GaussianBlur(1))
487
+ img = Image.blend(img, dust_and_scratches, alpha=0.02)
488
+
489
+ # Размытие в движении
490
+ img = np.array(img)[:, :, ::-1].copy()
491
+ size = 4
492
+ kernel = np.zeros((size, size))
493
+ kernel[int((size-1)/2), :] = np.ones(size)
494
+ kernel = kernel / size
495
+ img = cv2.filter2D(img, -1, kernel)
496
+ img = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
497
+
498
+ # Резкость
499
+ img = ImageEnhance.Sharpness(img).enhance((1.2))
500
+
501
+ # Тиснение
502
+ img = blendLayers(img, img.filter(ImageFilter.EMBOSS()), BlendType.HARDLIGHT, 1.8)
503
+
504
+ # Glitch от плёнки
505
+ img = np.array(img)[:, :, ::-1].copy()
506
+ num_glitches = 5
507
+ height, width = img.shape[:2]
508
+ for _ in range(num_glitches):
509
+ y = np.random.randint(height)
510
+ h = np.random.randint(1, 3)
511
+ y1 = np.clip(y - h // 2, 0, height)
512
+ y2 = np.clip(y + h // 2, 0, height)
513
+ w = np.random.randint(20, width // 4)
514
+ channel = np.random.randint(0, 3)
515
+ img[y1:y2, w:, channel] = img[y1:y2, :-w, channel]
516
+ img[y1:y2, :w, channel] = np.random.randint(100, 156, (y2 - y1, w), dtype=np.uint8)
517
+
518
+ img = Image.fromarray(img[:, :, ::-1])
519
+
520
+ if snowfallSlider > 0:
521
+ img = np.array(img)[:, :, ::-1].copy()
522
+ height, width = img.shape[:2]
523
+ num_snowflakes = snowfallSlider
524
+
525
+ first_snow_layer = np.zeros_like(img)
526
+ second_snow_layer = np.zeros_like(img)
527
+
528
+ for _ in range(num_snowflakes):
529
+ center_x, center_y = random.randint(0, width - 1), random.randint(0, height - 1)
530
+ num_vertices = random.randint(3, 6)
531
+ radius = random.randint(1, 3)
532
+
533
+ polygon = np.array([[
534
+ center_x + random.randint(-radius, radius),
535
+ center_y + random.randint(-radius, radius)
536
+ ] for _ in range(num_vertices)], np.int32)
537
+ polygon = polygon.reshape((-1, 1, 2))
538
+ blur = random.choice([True, False])
539
+
540
+ if blur:
541
+ cv2.fillPoly(second_snow_layer, [polygon], (255, 255, 255))
542
+ else:
543
+ cv2.fillPoly(first_snow_layer, [polygon], (255, 255, 255))
544
+
545
+ first_snow_layer = cv2.GaussianBlur(first_snow_layer, (5, 5), 0)
546
+ second_snow_layer = cv2.GaussianBlur(second_snow_layer, (15, 15), 0)
547
+
548
+ snowy_img = cv2.addWeighted(img, 1, first_snow_layer, 1, 0)
549
+ img = cv2.addWeighted(snowy_img, 1, second_snow_layer, 1, 0)
550
+ img = Image.fromarray(img[:, :, ::-1])
551
+
552
+ if asciiSlider > 0:
553
+ chars = " .'`^\",:;I1!i><-+_-?][}{1)(|\/tfjrxnuvczXYUCLQ0OZmwqpbdkhao*#MW&8%B@$"
554
+ small_image = img.resize((img.width // asciiSlider, img.height // asciiSlider), Image.Resampling.NEAREST)
555
+ ascii_image = Image.new('RGB', img.size, 'black')
556
+ font = ImageFont.truetype("arial.ttf", asciiSlider)
557
+ draw = ImageDraw.Draw(ascii_image)
558
+
559
+ for i in range(small_image.height):
560
+ for j in range(small_image.width):
561
+ pixel = small_image.getpixel((j, i))
562
+ gray = sum(pixel) // 3
563
+ char = chars[gray * len(chars) // 256]
564
+ draw.text((j * asciiSlider, i * asciiSlider), char, font=font, fill=pixel)
565
+
566
+ img = ascii_image
567
+
568
+ if len(watermark) > 0:
569
+ tempImg = Image.new('RGBA', (img.width, img.height), (0, 0, 0, 0))
570
+ draw = ImageDraw.Draw(tempImg)
571
+
572
+ userText = watermark.upper()
573
+ textSize = round(img.width / 5)
574
+ font = ImageFont.truetype('impact.ttf', textSize)
575
+ text_width, text_height = draw.textsize(userText, font)
576
+ right = (img.width - text_width) - 35
577
+ bottom = (img.height - text_height) - img.height / 3
578
+
579
+ shadowcolor = (111, 0, 0)
580
+ draw.text((right + (textSize / 48), bottom + (textSize / 48)), userText,
581
+ font=font, fill=shadowcolor)
582
+
583
+ textcolor = (20, 25, 30)
584
+ draw.text((right, bottom), userText, font=font, fill=textcolor)
585
+
586
+ tempImg = tempImg.transform(tempImg.size, Image.AFFINE, (
587
+ 1, 0, 0, 0.1, 1, 0), resample=Image.BICUBIC, fillcolor=(0, 0, 0, 0))
588
+
589
+ img_arr = np.array(tempImg)
590
+ mask = np.random.randint(
591
+ 0, 2, size=img_arr.shape[:2]).astype(bool)
592
+ mask = np.repeat(mask[:, :, np.newaxis], 4, axis=2)
593
+
594
+ img_arr[mask] = img_arr[np.roll(mask, 5, axis=1)]
595
+ tempImg = Image.fromarray(img_arr)
596
+
597
+ img = blendLayers(img, tempImg, BlendType.NORMAL, .44)
598
+
599
+ if not clearEXIFCheckbox:
600
+ img.info['parameters'] = proc.info
601
+
602
+ if len(customEXIF) > 0:
603
+ img.info['parameters'] = customEXIF
604
+
605
+ result.append(img)
606
+
607
+ if dontShowOriginalCheckbox:
608
+ proc.images.clear()
609
+
610
+ for i in result:
611
+ proc.images.append(i)
612
+ try:
613
+ images.save_image(i, p.outpath_samples, "", info=i.info['parameters'])
614
+ except:
615
+ images.save_image(i, p.outpath_samples, "", info='')
616
+
617
+ return Processed(p, proc.images, p.seed, '')
config.json ADDED
@@ -0,0 +1,437 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "samples_save": true,
3
+ "samples_format": "png",
4
+ "samples_filename_pattern": "[seed]-[datetime<%M%S>]-[prompt_spaces]",
5
+ "save_images_add_number": true,
6
+ "save_images_replace_action": "Replace",
7
+ "grid_save": true,
8
+ "grid_format": "png",
9
+ "grid_extended_filename": true,
10
+ "grid_only_if_multiple": true,
11
+ "grid_prevent_empty_spots": false,
12
+ "grid_zip_filename_pattern": "",
13
+ "n_rows": -1,
14
+ "font": "Segoe UI Semilight",
15
+ "grid_text_active_color": "#d5d6d7",
16
+ "grid_text_inactive_color": "#999999",
17
+ "grid_background_color": "#121517",
18
+ "save_images_before_face_restoration": false,
19
+ "save_images_before_highres_fix": false,
20
+ "save_images_before_color_correction": false,
21
+ "save_mask": false,
22
+ "save_mask_composite": false,
23
+ "jpeg_quality": 80,
24
+ "webp_lossless": false,
25
+ "export_for_4chan": false,
26
+ "img_downscale_threshold": 4.0,
27
+ "target_side_length": 4000,
28
+ "img_max_size_mp": 1000.0,
29
+ "use_original_name_batch": true,
30
+ "use_upscaler_name_as_suffix": false,
31
+ "save_selected_only": true,
32
+ "save_init_img": false,
33
+ "temp_dir": "",
34
+ "clean_temp_dir_at_start": false,
35
+ "save_incomplete_images": false,
36
+ "notification_audio": true,
37
+ "notification_volume": 100,
38
+ "outdir_samples": "output",
39
+ "outdir_txt2img_samples": "output",
40
+ "outdir_img2img_samples": "",
41
+ "outdir_extras_samples": "",
42
+ "outdir_grids": "output",
43
+ "outdir_txt2img_grids": "output",
44
+ "outdir_img2img_grids": "output",
45
+ "outdir_save": "output",
46
+ "outdir_init_images": "output",
47
+ "save_to_dirs": false,
48
+ "grid_save_to_dirs": false,
49
+ "use_save_to_dirs_for_ui": false,
50
+ "directories_filename_pattern": "[date]",
51
+ "directories_max_prompt_words": 8,
52
+ "ESRGAN_tile": 192,
53
+ "ESRGAN_tile_overlap": 8,
54
+ "realesrgan_enabled_models": [],
55
+ "upscaler_for_img2img": "4x_NMKD-Siax_200k",
56
+ "face_restoration": false,
57
+ "face_restoration_model": "CodeFormer",
58
+ "code_former_weight": 0.5,
59
+ "face_restoration_unload": false,
60
+ "auto_launch_browser": "Local",
61
+ "enable_console_prompts": false,
62
+ "show_warnings": false,
63
+ "show_gradio_deprecation_warnings": true,
64
+ "memmon_poll_rate": 8,
65
+ "samples_log_stdout": false,
66
+ "multiple_tqdm": false,
67
+ "print_hypernet_extra": true,
68
+ "list_hidden_files": true,
69
+ "disable_mmap_load_safetensors": false,
70
+ "hide_ldm_prints": true,
71
+ "dump_stacks_on_signal": false,
72
+ "api_enable_requests": true,
73
+ "api_forbid_local_requests": true,
74
+ "api_useragent": "",
75
+ "unload_models_when_training": true,
76
+ "pin_memory": true,
77
+ "save_optimizer_state": false,
78
+ "save_training_settings_to_txt": false,
79
+ "dataset_filename_word_regex": "",
80
+ "dataset_filename_join_string": " ",
81
+ "training_image_repeats_per_epoch": 1,
82
+ "training_write_csv_every": 0.0,
83
+ "training_xattention_optimizations": true,
84
+ "training_enable_tensorboard": false,
85
+ "training_tensorboard_save_images": false,
86
+ "training_tensorboard_flush_every": 120,
87
+ "sd_model_checkpoint": "Deliberate_v6.safetensors [bcce73a08e]",
88
+ "sd_checkpoints_limit": 3,
89
+ "sd_checkpoints_keep_in_cpu": false,
90
+ "sd_checkpoint_cache": 3,
91
+ "sd_unet": "Automatic",
92
+ "enable_quantization": true,
93
+ "enable_emphasis": true,
94
+ "enable_batch_seeds": true,
95
+ "comma_padding_backtrack": 20,
96
+ "CLIP_stop_at_last_layers": 1,
97
+ "upcast_attn": false,
98
+ "randn_source": "GPU",
99
+ "tiling": false,
100
+ "hires_fix_refiner_pass": "second pass",
101
+ "sdxl_crop_top": 0,
102
+ "sdxl_crop_left": 0,
103
+ "sdxl_refiner_low_aesthetic_score": 2.5,
104
+ "sdxl_refiner_high_aesthetic_score": 6.0,
105
+ "sd_vae_checkpoint_cache": 2,
106
+ "sd_vae": "None",
107
+ "sd_vae_overrides_per_model_preferences": true,
108
+ "auto_vae_precision": true,
109
+ "sd_vae_encode_method": "Full",
110
+ "sd_vae_decode_method": "Full",
111
+ "inpainting_mask_weight": 1.0,
112
+ "initial_noise_multiplier": 1.0,
113
+ "img2img_extra_noise": 0.0,
114
+ "img2img_color_correction": false,
115
+ "img2img_fix_steps": false,
116
+ "img2img_background_color": "#ffffff",
117
+ "img2img_editor_height": 720,
118
+ "img2img_sketch_default_brush_color": "#ffffff",
119
+ "img2img_inpaint_mask_brush_color": "#ff0000",
120
+ "img2img_inpaint_sketch_default_brush_color": "#ffffff",
121
+ "return_mask": false,
122
+ "return_mask_composite": false,
123
+ "img2img_batch_show_results_limit": 32,
124
+ "cross_attention_optimization": "Automatic",
125
+ "s_min_uncond": 0.0,
126
+ "token_merging_ratio": 0.0,
127
+ "token_merging_ratio_img2img": 0.0,
128
+ "token_merging_ratio_hr": 0.0,
129
+ "pad_cond_uncond": false,
130
+ "persistent_cond_cache": true,
131
+ "batch_cond_uncond": true,
132
+ "use_old_emphasis_implementation": false,
133
+ "use_old_karras_scheduler_sigmas": false,
134
+ "no_dpmpp_sde_batch_determinism": false,
135
+ "use_old_hires_fix_width_height": false,
136
+ "dont_fix_second_order_samplers_schedule": false,
137
+ "hires_fix_use_firstpass_conds": false,
138
+ "use_old_scheduling": false,
139
+ "interrogate_keep_models_in_memory": false,
140
+ "interrogate_return_ranks": false,
141
+ "interrogate_clip_num_beams": 1,
142
+ "interrogate_clip_min_length": 24,
143
+ "interrogate_clip_max_length": 48,
144
+ "interrogate_clip_dict_limit": 1500,
145
+ "interrogate_clip_skip_categories": [
146
+ "artists"
147
+ ],
148
+ "interrogate_deepbooru_score_threshold": 0.5,
149
+ "deepbooru_sort_alpha": true,
150
+ "deepbooru_use_spaces": true,
151
+ "deepbooru_escape": true,
152
+ "deepbooru_filter_tags": "",
153
+ "extra_networks_show_hidden_directories": true,
154
+ "extra_networks_dir_button_function": false,
155
+ "extra_networks_hidden_models": "When searched",
156
+ "extra_networks_default_multiplier": 0.9,
157
+ "extra_networks_card_width": 140.0,
158
+ "extra_networks_card_height": 210.0,
159
+ "extra_networks_card_text_scale": 1.0,
160
+ "extra_networks_card_show_desc": true,
161
+ "extra_networks_card_order_field": "Path",
162
+ "extra_networks_card_order": "Ascending",
163
+ "extra_networks_add_text_separator": " ",
164
+ "ui_extra_networks_tab_reorder": "Lora",
165
+ "textual_inversion_print_at_load": false,
166
+ "textual_inversion_add_hashes_to_infotext": true,
167
+ "sd_hypernetwork": "None",
168
+ "keyedit_precision_attention": 0.1,
169
+ "keyedit_precision_extra": 0.1,
170
+ "keyedit_delimiters": " .,\\/!?%^*;:{}=`~() ",
171
+ "keyedit_delimiters_whitespace": [
172
+ "Tab",
173
+ "Carriage Return",
174
+ "Line Feed"
175
+ ],
176
+ "keyedit_move": true,
177
+ "disable_token_counters": false,
178
+ "return_grid": false,
179
+ "do_not_show_images": false,
180
+ "js_modal_lightbox": true,
181
+ "js_modal_lightbox_initially_zoomed": false,
182
+ "js_modal_lightbox_gamepad": false,
183
+ "js_modal_lightbox_gamepad_repeat": 250,
184
+ "gallery_height": "",
185
+ "compact_prompt_box": false,
186
+ "samplers_in_dropdown": true,
187
+ "dimensions_and_batch_together": true,
188
+ "sd_checkpoint_dropdown_use_short": false,
189
+ "hires_fix_show_sampler": true,
190
+ "hires_fix_show_prompts": false,
191
+ "txt2img_settings_accordion": false,
192
+ "img2img_settings_accordion": false,
193
+ "localization": "None",
194
+ "quicksettings_list": [
195
+ "sd_model_checkpoint"
196
+ ],
197
+ "ui_tab_order": [],
198
+ "hidden_tabs": [
199
+ "Train"
200
+ ],
201
+ "ui_reorder_list": [
202
+ "prompt",
203
+ "image",
204
+ "inpaint",
205
+ "sampler",
206
+ "accordions",
207
+ "checkboxes",
208
+ "dimensions",
209
+ "cfg",
210
+ "denoising",
211
+ "seed",
212
+ "batch",
213
+ "override_settings",
214
+ "scripts",
215
+ "extra_options"
216
+ ],
217
+ "gradio_theme": "Default",
218
+ "gradio_themes_cache": true,
219
+ "show_progress_in_title": true,
220
+ "send_seed": true,
221
+ "send_size": true,
222
+ "enable_pnginfo": true,
223
+ "save_txt": false,
224
+ "add_model_name_to_info": true,
225
+ "add_model_hash_to_info": true,
226
+ "add_vae_name_to_info": true,
227
+ "add_vae_hash_to_info": true,
228
+ "add_user_name_to_info": false,
229
+ "add_version_to_infotext": true,
230
+ "disable_weights_auto_swap": true,
231
+ "infotext_skip_pasting": [],
232
+ "infotext_styles": "Apply if any",
233
+ "show_progressbar": true,
234
+ "live_previews_enable": true,
235
+ "live_previews_image_format": "jpeg",
236
+ "show_progress_grid": true,
237
+ "show_progress_every_n_steps": 1,
238
+ "show_progress_type": "Approx NN",
239
+ "live_preview_allow_lowvram_full": false,
240
+ "live_preview_content": "Prompt",
241
+ "live_preview_refresh_period": 100.0,
242
+ "live_preview_fast_interrupt": true,
243
+ "js_live_preview_in_modal_lightbox": false,
244
+ "hide_samplers": [
245
+ "DPM++ SDE Karras",
246
+ "DPM++ 2M SDE Exponential",
247
+ "DPM++ 2M SDE Karras",
248
+ "Euler",
249
+ "LMS",
250
+ "DPM2",
251
+ "DPM2 a",
252
+ "DPM++ 2S a",
253
+ "DPM++ 2M SDE",
254
+ "DPM++ 2M SDE Heun",
255
+ "DPM++ 2M SDE Heun Karras",
256
+ "DPM++ 2M SDE Heun Exponential",
257
+ "DPM++ 3M SDE",
258
+ "DPM++ 3M SDE Karras",
259
+ "DPM++ 3M SDE Exponential",
260
+ "DPM fast",
261
+ "DPM adaptive",
262
+ "LMS Karras",
263
+ "DPM2 Karras",
264
+ "DPM2 a Karras",
265
+ "DPM++ 2S a Karras",
266
+ "DDIM",
267
+ "PLMS",
268
+ "LCM"
269
+ ],
270
+ "eta_ddim": 0.0,
271
+ "eta_ancestral": 1.0,
272
+ "ddim_discretize": "uniform",
273
+ "s_churn": 0.0,
274
+ "s_tmin": 0.0,
275
+ "s_tmax": 0.0,
276
+ "s_noise": 1.0,
277
+ "k_sched_type": "Automatic",
278
+ "sigma_min": 0.0,
279
+ "sigma_max": 0.0,
280
+ "rho": 0.0,
281
+ "eta_noise_seed_delta": 31337,
282
+ "always_discard_next_to_last_sigma": false,
283
+ "sgm_noise_multiplier": false,
284
+ "uni_pc_variant": "bh2",
285
+ "uni_pc_skip_type": "time_uniform",
286
+ "uni_pc_order": 3,
287
+ "uni_pc_lower_order_final": true,
288
+ "postprocessing_enable_in_main_ui": [],
289
+ "postprocessing_operation_order": [],
290
+ "upscaling_max_images_in_cache": 5,
291
+ "postprocessing_existing_caption_action": "Ignore",
292
+ "disabled_extensions": [
293
+ "canvas-zoom-and-pan"
294
+ ],
295
+ "disable_all_extensions": "none",
296
+ "restore_config_state_file": "",
297
+ "sd_checkpoint_hash": "bcce73a08e95a4d4a3332875342792a50ab9bf9f07fdedcab49fd425fac173be",
298
+ "ldsr_steps": 100,
299
+ "ldsr_cached": false,
300
+ "SCUNET_tile": 256,
301
+ "SCUNET_tile_overlap": 8,
302
+ "SWIN_tile": 192,
303
+ "SWIN_tile_overlap": 8,
304
+ "hypertile_enable_unet": true,
305
+ "hypertile_enable_unet_secondpass": true,
306
+ "hypertile_max_depth_unet": 3,
307
+ "hypertile_max_tile_unet": 256,
308
+ "hypertile_swap_size_unet": 3,
309
+ "hypertile_enable_vae": false,
310
+ "hypertile_max_depth_vae": 3,
311
+ "hypertile_max_tile_vae": 128,
312
+ "hypertile_swap_size_vae": 3,
313
+ "ad_max_models": 2,
314
+ "ad_extra_models_dir": "",
315
+ "ad_save_previews": false,
316
+ "ad_save_images_before": false,
317
+ "ad_only_seleted_scripts": true,
318
+ "ad_script_names": "dynamic_prompting,dynamic_thresholding,wildcard_recursive,wildcards,lora_block_weight,negpip",
319
+ "ad_bbox_sortby": "None",
320
+ "ad_same_seed_for_each_tap": false,
321
+ "control_net_detectedmap_dir": "detected_maps",
322
+ "control_net_models_path": "",
323
+ "control_net_modules_path": "",
324
+ "control_net_unit_count": 3,
325
+ "control_net_model_cache_size": 1,
326
+ "control_net_inpaint_blur_sigma": 7,
327
+ "control_net_no_high_res_fix": false,
328
+ "control_net_no_detectmap": true,
329
+ "control_net_detectmap_autosaving": false,
330
+ "control_net_allow_script_control": true,
331
+ "control_net_sync_field_args": true,
332
+ "controlnet_show_batch_images_in_ui": false,
333
+ "controlnet_increment_seed_during_batch": false,
334
+ "controlnet_disable_openpose_edit": false,
335
+ "controlnet_ignore_noninpaint_mask": false,
336
+ "lora_functional": false,
337
+ "sd_lora": "None",
338
+ "lora_preferred_name": "Alias from file",
339
+ "lora_add_hashes_to_infotext": true,
340
+ "lora_show_all": false,
341
+ "lora_hide_unknown_for_versions": [],
342
+ "lora_in_memory_limit": 2,
343
+ "extra_options_txt2img": [
344
+ "tiling",
345
+ "CLIP_stop_at_last_layers"
346
+ ],
347
+ "extra_options_img2img": [],
348
+ "extra_options_cols": 1,
349
+ "extra_options_accordion": false,
350
+ "canvas_disabled_functions": [
351
+ "Overlap"
352
+ ],
353
+ "canvas_hotkey_zoom": "Alt",
354
+ "canvas_hotkey_adjust": "Ctrl",
355
+ "canvas_hotkey_move": "F",
356
+ "canvas_hotkey_fullscreen": "S",
357
+ "canvas_hotkey_reset": "R",
358
+ "canvas_hotkey_overlap": "O",
359
+ "canvas_show_tooltip": true,
360
+ "canvas_auto_expand": true,
361
+ "canvas_blur_prompt": true,
362
+ "canvas_zoom_undo_extra_key": "Ctrl",
363
+ "canvas_zoom_hotkey_undo": "Z",
364
+ "canvas_zoom_inc_brush_size": "]",
365
+ "canvas_zoom_dec_brush_size": "[",
366
+ "canvas_zoom_hotkey_open_colorpanel": "Q",
367
+ "canvas_zoom_hotkey_pin_colorpanel": "T",
368
+ "canvas_zoom_hotkey_dropper": "A",
369
+ "canvas_zoom_hotkey_fill": "X",
370
+ "canvas_zoom_hotkey_transparency": "C",
371
+ "canvas_zoom_hide_btn": true,
372
+ "canvas_zoom_mask_clear": true,
373
+ "canvas_zoom_enable_integration": true,
374
+ "canvas_zoom_brush_size": 250,
375
+ "canvas_zoom_brush_size_change": 5,
376
+ "canvas_zoom_transparency_level": 60,
377
+ "canvas_zoom_brush_opacity": true,
378
+ "canvas_zoom_inpaint_label": false,
379
+ "canvas_zoom_inpaint_warning": true,
380
+ "canvas_zoom_inpaint_change_btn_color": true,
381
+ "canvas_zoom_inpaint_btn_color": "#ff1486",
382
+ "canvas_zoom_brush_outline": true,
383
+ "canvas_zoom_add_buttons": false,
384
+ "canvas_zoom_draw_staight_lines": true,
385
+ "canvas_zoom_inpaint_brushcolor": "#ff0000",
386
+ "canvas_zoom_disabled_functions": [
387
+ "Overlap"
388
+ ],
389
+ "SWIN_torch_compile": false,
390
+ "auto_backcompat": true,
391
+ "use_downcasted_alpha_bar": false,
392
+ "extra_networks_card_description_is_html": false,
393
+ "extra_networks_tree_view_default_enabled": false,
394
+ "lora_not_found_warning_console": false,
395
+ "lora_not_found_gradio_warning": false,
396
+ "pad_cond_uncond_v0": false,
397
+ "fp8_storage": "Disable",
398
+ "cache_fp16_weight": false,
399
+ "sd_noise_schedule": "Default",
400
+ "emphasis": "Original",
401
+ "enable_prompt_comments": true,
402
+ "auto_vae_precision_bfloat16": false,
403
+ "overlay_inpaint": true,
404
+ "sd_webui_modal_lightbox_icon_opacity": 1,
405
+ "sd_webui_modal_lightbox_toolbar_opacity": 0.9,
406
+ "open_dir_button_choice": "Subdirectory",
407
+ "include_styles_into_token_counters": true,
408
+ "interrupt_after_current": false,
409
+ "enable_upscale_progressbar": true,
410
+ "dat_enabled_models": [
411
+ "DAT x2",
412
+ "DAT x3",
413
+ "DAT x4"
414
+ ],
415
+ "DAT_tile": 192,
416
+ "DAT_tile_overlap": 8,
417
+ "refiner_switch_by_sample_steps": false,
418
+ "extra_networks_tree_view_style": "Dirs",
419
+ "extra_networks_tree_view_default_width": 180.0,
420
+ "enable_reloading_ui_scripts": false,
421
+ "prioritized_callbacks_app_started": [],
422
+ "prioritized_callbacks_model_loaded": [],
423
+ "prioritized_callbacks_ui_settings": [],
424
+ "prioritized_callbacks_infotext_pasted": [],
425
+ "prioritized_callbacks_script_unloaded": [],
426
+ "prioritized_callbacks_before_ui": [],
427
+ "prioritized_callbacks_list_optimizers": [],
428
+ "prioritized_callbacks_before_token_counter": [],
429
+ "prioritized_callbacks_script_before_process": [],
430
+ "prioritized_callbacks_script_process": [],
431
+ "prioritized_callbacks_script_postprocess": [],
432
+ "prioritized_callbacks_script_post_sample": [],
433
+ "prioritized_callbacks_script_on_mask_blend": [],
434
+ "prioritized_callbacks_script_postprocess_maskoverlay": [],
435
+ "postprocessing_disable_in_extras": [],
436
+ "set_scale_by_when_changing_upscaler": false
437
+ }
styles.csv ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name,prompt,negative_prompt
2
+ + Details,maximum details,
3
+ + Natural Skin,"{prompt}, natural skin texture, hyperrealism, soft light, muted colors","oversaturated, illustration, anime, (mannequin:0.6), graphic, cg, cgi, cartoon, glitch, 3d, 2d, octane, sketch, acrylic, painting, drawing"
4
+ - Negative Lite,,"oversaturated, disfigured, poorly, bad, wrong, mutated"
5
+ - Negative Basic,,"oversaturated, [disfigured, poorly drawn], [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, mutated, blurry"
6
+ - Negative Strong,,"(deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, oversaturated"
7
+ - Anime Negative,,"(worst quality:1.2), mutated hands and fingers, [bad : wrong] anatomy"
8
+ Illustration,"(illustration:1.15), {prompt}, [cory loftis, strobist, pascal campion :: 0.2]","octane, 3d, {prompt}, photo"
9
+ Painting,"(pascal campion:0.38), vivid colors, (painting art:0.06), [eclectic:clear:0.8]","vignette, cinematic, grayscale, bokeh, blurred, depth of field"
10
+ Acrylic,"acrylic illustration, {prompt}, acrylic paint, oily sketch","red, photo, 3d, octane, {prompt}"
11
+ Retro futuristic,"{prompt}, art by angus mckie","watermark, signature"
12
+ Caricature,"big head, big eyes, caricature, a caricature, rendering, (figurativism:0.8)",
13
+ Paper-cut,"(paper-cut craft:1.2), {prompt}","photo, {prompt}"
14
+ 3d (render) 👎,"eevee, 3d, render, 3 point light, (glossy:0.76), ambient occlusion","watermark, signature"
15
+ 3d (render) 👍,"epic realistic, hyperdetailed, (cycles render:1.3), caustics, (glossy:0.58), (artstation:0.82)",
16
+ 3d (movie),"epic realistic, pixar style, disney, (cycles render:1.3), caustics, (glossy:0.58), (artstation:0.2), cute",
17
+ Isometric,"{prompt}, (isometric:1.2) 3d art, artstation, demo","watermark, signature"
18
+ 8bit,"pixel art, 8bit, aliasing","photo, octane, fabric, realistic, material, grain, grainy"
19
+ Logo,"(logo:1.3), vector graphics, brand, design, inspired, (straight:1.3), (symmetrical:0.4)",
20
+ Logo (minimalistic),"art by keith negley, (logo:1.3), vector graphics, design, (straight:1.3), (symmetrical:0.4), by keith negley, [[jean arp]], minimalistic",
21
+ Engraving,"(grayscale, woodcut:1.2), (etching:1.1), (engraving:0.2), {prompt}","photo, 3d, colored"
22
+ Comic book,"comic style, illustration, cartoon, {prompt}, [[by phil jimenez]]",bw {prompt}
23
+ Cinematic,"{prompt}, cinematic, (muted colors:1.2), background (filmic:0.7)","3d, dof, rutkowski, oversaturated, [doll :: 0.33], {prompt}"
24
+ Cinematic (horror),"slate atmosphere, cinematic, dimmed colors, dark shot, muted colors, film grainy, lut, spooky",
25
+ Cinematic (art),"art by greg rutkowski and artgerm, soft cinematic light, adobe lightroom, photolab, hdr, intricate, highly detailed, (depth of field:1.4)",
26
+ Gloomy,"complex background, background, highly detailed, gloomy, eerie, dark, dimmed, hdr, vignette, grimy, (slate atmosphere:0.4)","(depth of field:1.3), (bokeh:1.2), (blur), pink"
27
+ Professional photo,"professional detailed photography, {prompt}, (muted colors, dim colors, soothing tones), (vsco:0.3)","oversaturated, [doll :: 0.5], {prompt}"
28
+ Midjourney,"hdr, epic realistic, {prompt}, rutkowski, rim light",
29
+ XpucT (Art),"[dark theme :: 0.3], {prompt}, (hdr:1.2), art (by jordan grimmer:0.2)","dof, {prompt}"
30
+ XpucT (cinemArt),"hyperrealism, atmospheric","dof, {prompt}"
ui-config.json ADDED
The diff for this file is too large to render. See raw diff
 
user.css ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ * {
2
+ font-family: Arial !important;
3
+ }
4
+
5
+ div#txt2img_prompt > label > textarea,
6
+ div#img2img_prompt > label > textarea {
7
+ font: 20px Arimo, Arial !important;
8
+ color: #a7b4c4 !important;
9
+ }
10
+
11
+ div#txt2img_gallery,
12
+ div#img2img_gallery
13
+ {
14
+ height: 512px;
15
+ }
16
+
17
+ .livePreview img {
18
+ height: 452px;
19
+ }
20
+
21
+
22
+ div#txt2img_neg_prompt > label > textarea,
23
+ div#img2img_neg_prompt > label > textarea {
24
+ font-size: 14px !important;
25
+ color: #4d5967 !important;
26
+ }
27
+
28
+ .dark {
29
+ --body-background-fill: #131a25;
30
+ }
31
+
32
+ .gradio-container-3-28-1 .prose * {
33
+ color: #9fa8b6;
34
+ }
35
+
36
+ div#html_info_txt2img,
37
+ div#html_info_img2img,
38
+ button#txt2img_clear_prompt,
39
+ button#img2img_clear_prompt
40
+ {
41
+ display: none;
42
+ }
43
+
44
+ .primary.svelte-cmf5ev {
45
+ border: none;
46
+ }
47
+
48
+ .primary.svelte-cmf5ev {
49
+ border: none;
50
+ background: #2772c3;
51
+ border-radius: 5px;
52
+ }
53
+ .primary.svelte-cmf5ev:hover {
54
+ background: #266ab4;
55
+ }
56
+
57
+ button#txt2img_generate {
58
+ background: #2772c3;
59
+ }
60
+
61
+ .dark .panel.svelte-vt1mxs {
62
+ background: #131a25;
63
+ padding: 0;
64
+ }
65
+
66
+ .dark .preview.svelte-1b19cri.svelte-1b19cri,
67
+ .dark .preview.svelte-1b19cri img.svelte-1b19cri {
68
+ background: #1f2937;
69
+ }
70
+
71
+ .livePreview {
72
+ background: transparent;
73
+ }
74
+
75
+ .selected.svelte-1g805jl {
76
+ background: #131a25;
77
+ }
78
+
79
+ #context-menu {
80
+ border: 1px solid rgba(255, 255, 255, 0.1);
81
+ box-shadow: 0px 1px 1px black !important;
82
+ background: #18212d !important;
83
+ }
84
+
85
+ .context-menu-items a {
86
+ padding: 8px;
87
+ }
88
+
89
+ .context-menu-items a:hover {
90
+ background: #226bb954;
91
+ transition: 0.1s;
92
+ }
93
+
94
+ .thumbnail-small.selected.svelte-1b19cri.svelte-1b19cri,
95
+ .thumbnail-item.svelte-1b19cri.svelte-1b19cri:hover {
96
+ --ring-color: none;
97
+ border-color: transparent;
98
+ }
99
+
100
+ #settings > div.tab-nav {
101
+ width: 14em;
102
+ }
103
+
104
+ .progressDiv .progress {
105
+ font-family: Verdana !important;
106
+ font-size: 12px;
107
+ font-weight: normal;
108
+ background: #0d4f7e;
109
+ color: #9ecfe9;
110
+ border-radius: 5px;
111
+ }
112
+ #txt2img_progressbar {
113
+ width: 118.4% !important;
114
+ }
115
+
116
+ .progressDiv {
117
+ z-index: 9999;
118
+ }
119
+
120
+ .dark .progressDiv {
121
+ background: #1d2938;
122
+ }
123
+
124
+ .block.border_focus {
125
+ border-color: #5290bd !important;
126
+ }
127
+
128
+ #txt2img_interrupt,
129
+ #img2img_interrupt,
130
+ #txt2img_skip {
131
+ background: #718396;
132
+ }
133
+
134
+ #lightboxModal {
135
+ background-color: #090b0df7;
136
+ }
137
+
138
+ #txt2img_preview {
139
+ margin-right: 0 !important;
140
+ }
141
+
142
+ .dark #txt2img_settings {
143
+ background: #1f2937 !important;
144
+ }
145
+
146
+ div#txt2img_settings {
147
+ padding: 10px !important;
148
+ }
149
+
150
+ button#save_txt2img,
151
+ button#save_zip_txt2img,
152
+ button#save_img2img,
153
+ button#save_zip_img2img {
154
+ display: none;
155
+ }
156
+
157
+ .gradio-container {
158
+ line-height: 1.15;
159
+ }
160
+
161
+ #settings > div.flex-wrap {
162
+ width: 13em;
163
+ }
164
+
165
+ .extra-network-cards .card .actions .name {
166
+ font-size: 1.3em;
167
+ font-weight: 100;
168
+ }
169
+
170
+ .extra-network-cards .card .metadata-button:hover,
171
+ .extra-network-cards .card ul a:hover {
172
+ color: #5bffa8;
173
+ }
174
+
175
+ #footer {
176
+ display: none;
177
+ }
178
+
179
+ .unpadded_box.large.svelte-1u5vjgs {
180
+ min-height: 450px;
181
+ }
182
+
183
+ .dark .options.svelte-1aonegi {
184
+ background: #131a25;
185
+ }
186
+ .dark .item.svelte-1aonegi:hover {
187
+ background: #17202d;
188
+ }
189
+ .dark .gradio-dropdown ul.options li.item.selected {
190
+ background: #1b2533;
191
+ }
192
+
193
+ .eta-bar.svelte-j1gjts {
194
+ background: #2c394b;
195
+ }
196
+
197
+ svg.svelte-zyxd38 path.svelte-zyxd38 {
198
+ fill: #6a9cd2;
199
+ }
200
+
201
+ .wrap.svelte-j1gjts {
202
+ background: #1f2937;
203
+ }
204
+
205
+ .block.token-counter span,
206
+ .block.token-counter.error span {
207
+ box-shadow: none;
208
+ }
209
+
210
+ .dark .svelte-116rqfv.center.boundedheight.flex {
211
+ background: #131a25;
212
+ }
213
+
214
+ .error.svelte-j1gjts {
215
+ border: solid 1px #de8ab175;
216
+ border-radius: 7px;
217
+ background: #181622de;
218
+ color: #f57cb4;
219
+ }
220
+
221
+ div#txt2img_column_size {
222
+ min-width: min(200px, 100%) !important;
223
+ }
224
+
225
+ button#arc_show_calculator_button,
226
+ div#arc_empty_space {
227
+ display: none;
228
+ }
229
+
230
+ #txt2img_row_resolutions button,
231
+ #img2img_row_resolutions button,
232
+ #txt2img_row_aspect_ratio button,
233
+ #img2img_row_aspect_ratio button {
234
+ max-width: 100% !important;
235
+ }
236
+
237
+ a {
238
+ font-weight: normal;
239
+ }
240
+
241
+ .panel.svelte-15lo0d8 {
242
+ background: none;
243
+ }
244
+
245
+ .extra-network-cards {
246
+ height: 100% !important;
247
+ max-height: 800px !important;
248
+ }
249
+
250
+ .selected.svelte-kqij2n {
251
+ background: transparent;
252
+ }
253
+
254
+ .extra-networks > div.tab-nav {
255
+ min-height: auto;
256
+ }
user.js ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Custom scripts by XpucT
2
+ // Homepage: https://boosty.to/xpuct
3
+
4
+ document.addEventListener('keydown', function(e)
5
+ {
6
+ // Показать предыдущую генерацию по клавише Shift
7
+ if (e.keyCode === 16 && document.querySelector('.livePreview'))
8
+ document.querySelector('.livePreview').style.display = 'none'
9
+
10
+ // Переключить Mask Mode по Ctrl + F2
11
+ else if (e.ctrlKey && e.code === 'F2')
12
+ {
13
+ const commonRadio = document.querySelector('#img2img_mask_mode').children[2]
14
+ commonRadio.children[0].className.includes('selected') ? commonRadio.children[1].click() : commonRadio.children[0].click()
15
+
16
+ e.preventDefault()
17
+ }
18
+
19
+ // Выгрузить модели по F4
20
+ else if (e.code === 'F4')
21
+ {
22
+ document.querySelector('#sett_unload_sd_model').click()
23
+ e.preventDefault()
24
+ }
25
+
26
+ // Reload UI по F2
27
+ else if (e.code === 'F2')
28
+ {
29
+ document.querySelector('#settings_restart_gradio').click()
30
+ e.preventDefault()
31
+ }
32
+ })
33
+
34
+ document.addEventListener('keyup', function(e)
35
+ {
36
+ if (e.keyCode === 16 && document.querySelector('.livePreview'))
37
+ {
38
+ document.querySelector('.livePreview').style.display = 'block'
39
+ }
40
+ })
41
+
42
+ onUiLoaded(function()
43
+ {
44
+ // Удаление рекламы в Photopea (работает не всегда)
45
+ const result = document.evaluate("//div[@class='flexrow app']/div[2]", document, null, XPathResult.ANY_TYPE, null)
46
+ var ad = result.iterateNext()
47
+ while (ad)
48
+ {
49
+ ad.parentNode.removeChild(ad)
50
+ ad = result.iterateNext()
51
+ }
52
+
53
+
54
+ // Граница в txt2img немного левее, а не посередине
55
+ document.querySelector('gradio-app .resize-handle-row').style.gridTemplateColumns = '676px 16px 1fr'
56
+
57
+ document.querySelectorAll('button[id$=_generate]').forEach((x) => x.addEventListener('mousedown', (e) =>
58
+ {
59
+ if (e.button === 1)
60
+ {
61
+ get_uiCurrentTabContent().querySelector('div[id$=_adetailer_ad_enable]').children[1].click()
62
+ get_uiCurrentTabContent().querySelector('button[id$=_generate]').click()
63
+ setTimeout(() => get_uiCurrentTabContent().querySelector('div[id$=_adetailer_ad_enable]').children[1].click(), 100)
64
+ e.preventDefault()
65
+ }
66
+ }))
67
+ })