mirror of
https://github.com/Extraltodeus/test_my_prompt.git
synced 2026-05-01 03:31:23 +00:00
@@ -14,10 +14,11 @@ class Script(scripts.Script):
|
|||||||
neg_pos = gr.Dropdown(label="Test negative or positive", choices=["Positive","Negative"], value="Positive")
|
neg_pos = gr.Dropdown(label="Test negative or positive", choices=["Positive","Negative"], value="Positive")
|
||||||
skip_x_first = gr.Slider(minimum=0, maximum=32, step=1, label='Skip X first words', value=0)
|
skip_x_first = gr.Slider(minimum=0, maximum=32, step=1, label='Skip X first words', value=0)
|
||||||
separator = gr.Textbox(label="Separator used", lines=1, value=", ")
|
separator = gr.Textbox(label="Separator used", lines=1, value=", ")
|
||||||
|
always_grid = gr.Checkbox(label='Always generate a grid', value=True)
|
||||||
font_size = gr.Slider(minimum=12, maximum=64, step=1, label='Font size', value=32)
|
font_size = gr.Slider(minimum=12, maximum=64, step=1, label='Font size', value=32)
|
||||||
return [neg_pos,skip_x_first,separator,font_size]
|
return [neg_pos,skip_x_first,separator,always_grid,font_size]
|
||||||
|
|
||||||
def run(self, p,neg_pos,skip_x_first,separator,font_size):
|
def run(self, p,neg_pos,skip_x_first,separator,always_grid,font_size):
|
||||||
def write_on_image(img, msg):
|
def write_on_image(img, msg):
|
||||||
ix,iy = img.size
|
ix,iy = img.size
|
||||||
draw = ImageDraw.Draw(img)
|
draw = ImageDraw.Draw(img)
|
||||||
@@ -66,7 +67,7 @@ class Script(scripts.Script):
|
|||||||
proc = process_images(p)
|
proc = process_images(p)
|
||||||
|
|
||||||
if f >= 0:
|
if f >= 0:
|
||||||
proc.images[0] = write_on_image(proc.images[0], prompt_array[f])
|
proc.images[0] = write_on_image(proc.images[0], "no "+prompt_array[f])
|
||||||
else:
|
else:
|
||||||
proc.images[0] = write_on_image(proc.images[0], "full prompt")
|
proc.images[0] = write_on_image(proc.images[0], "full prompt")
|
||||||
|
|
||||||
@@ -74,8 +75,8 @@ class Script(scripts.Script):
|
|||||||
images.save_image(proc.images[0], p.outpath_samples, "", proc.seed, proc.prompt, opts.samples_format, info= proc.info, p=p)
|
images.save_image(proc.images[0], p.outpath_samples, "", proc.seed, proc.prompt, opts.samples_format, info= proc.info, p=p)
|
||||||
|
|
||||||
unwanted_grid_because_of_img_count = len(output_images) < 2 and opts.grid_only_if_multiple
|
unwanted_grid_because_of_img_count = len(output_images) < 2 and opts.grid_only_if_multiple
|
||||||
if (opts.return_grid or opts.grid_save) and not p.do_not_save_grid and not unwanted_grid_because_of_img_count:
|
if ((opts.return_grid or opts.grid_save) and not p.do_not_save_grid and not unwanted_grid_because_of_img_count) or always_grid:
|
||||||
grid = images.image_grid(output_images)
|
grid = images.image_grid(output_images)
|
||||||
if opts.grid_save:
|
if opts.grid_save or always_grid:
|
||||||
images.save_image(grid, p.outpath_grids, "grid", initial_seed, initial_prompt, opts.grid_format, info=proc.info, short_filename=not opts.grid_extended_filename, p=p, grid=True)
|
images.save_image(grid, p.outpath_grids, "grid", initial_seed, initial_prompt, opts.grid_format, info=proc.info, short_filename=not opts.grid_extended_filename, p=p, grid=True)
|
||||||
return proc
|
return proc
|
||||||
|
|||||||
Reference in New Issue
Block a user