diff options
Diffstat (limited to 'modules/ui.py')
-rw-r--r-- | modules/ui.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/modules/ui.py b/modules/ui.py index b9af2c86..535afaeb 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -93,7 +93,7 @@ def save_files(js_data, images): at_start = file.tell() == 0
writer = csv.writer(file)
if at_start:
- writer.writerow(["prompt", "seed", "width", "height", "sampler", "cfgs", "steps", "filename"])
+ writer.writerow(["prompt", "seed", "width", "height", "sampler", "cfgs", "steps", "filename", "negative_prompt"])
filename_base = str(int(time.time() * 1000))
for i, filedata in enumerate(images):
@@ -108,7 +108,7 @@ def save_files(js_data, images): filenames.append(filename)
- writer.writerow([data["prompt"], data["seed"], data["width"], data["height"], data["sampler"], data["cfg_scale"], data["steps"], filenames[0]])
+ writer.writerow([data["prompt"], data["seed"], data["width"], data["height"], data["sampler"], data["cfg_scale"], data["steps"], filenames[0], data["negative_prompt"]])
return '', '', plaintext_to_html(f"Saved: {filenames[0]}")
@@ -270,7 +270,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): batch_count = gr.Slider(minimum=1, maximum=cmd_opts.max_batch_count, step=1, label='Batch count', value=1)
batch_size = gr.Slider(minimum=1, maximum=8, step=1, label='Batch size', value=1)
- cfg_scale = gr.Slider(minimum=1.0, maximum=15.0, step=0.5, label='CFG Scale', value=7.0)
+ cfg_scale = gr.Slider(minimum=1.0, maximum=30.0, step=0.5, label='CFG Scale', value=7.0)
with gr.Group():
height = gr.Slider(minimum=64, maximum=2048, step=64, label="Height", value=512)
@@ -384,8 +384,8 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): switch_mode = gr.Radio(label='Mode', elem_id="img2img_mode", choices=['Redraw whole image', 'Inpaint a part of image', 'Loopback', 'SD upscale'], value='Redraw whole image', type="index", show_label=False)
init_img = gr.Image(label="Image for img2img", source="upload", interactive=True, type="pil")
init_img_with_mask = gr.Image(label="Image for inpainting with mask", elem_id="img2maskimg", source="upload", interactive=True, type="pil", tool="sketch", visible=False, image_mode="RGBA")
- init_img_with_mask_comment = gr.HTML(elem_id="mask_bug_info", value="<small>if the editor shows ERROR, switch to another tab and back, then to another img2img mode above and back</small>", visible=False)
init_mask = gr.Image(label="Mask", source="upload", interactive=True, type="pil", visible=False)
+ init_img_with_mask_comment = gr.HTML(elem_id="mask_bug_info", value="<small>if the editor shows ERROR, switch to another tab and back, then to another img2img mode above and back</small>", visible=False)
with gr.Row():
resize_mode = gr.Radio(label="Resize mode", elem_id="resize_mode", show_label=False, choices=["Just resize", "Crop and resize", "Resize and fill"], type="index", value="Just resize")
@@ -413,7 +413,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): batch_size = gr.Slider(minimum=1, maximum=8, step=1, label='Batch size', value=1)
with gr.Group():
- cfg_scale = gr.Slider(minimum=1.0, maximum=15.0, step=0.5, label='CFG Scale', value=7.0)
+ cfg_scale = gr.Slider(minimum=1.0, maximum=30.0, step=0.5, label='CFG Scale', value=7.0)
denoising_strength = gr.Slider(minimum=0.0, maximum=1.0, step=0.01, label='Denoising strength', value=0.75)
denoising_strength_change_factor = gr.Slider(minimum=0.9, maximum=1.1, step=0.01, label='Denoising strength change factor', value=1, visible=False)
@@ -661,19 +661,20 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): info = opts.data_labels[key]
t = type(info.default)
+ args = info.component_args() if callable(info.component_args) else info.component_args
+
if info.component is not None:
- args = info.component_args() if callable(info.component_args) else info.component_args
- item = info.component(label=info.label, value=fun, **(args or {}))
+ comp = info.component
elif t == str:
- item = gr.Textbox(label=info.label, value=fun, lines=1)
+ comp = gr.Textbox
elif t == int:
- item = gr.Number(label=info.label, value=fun)
+ comp = gr.Number
elif t == bool:
- item = gr.Checkbox(label=info.label, value=fun)
+ comp = gr.Checkbox
else:
raise Exception(f'bad options item type: {str(t)} for key {key}')
- return item
+ return comp(label=info.label, value=fun, **(args or {}))
components = []
keys = list(opts.data_labels.keys())
@@ -684,6 +685,10 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): up = []
for key, value, comp in zip(opts.data_labels.keys(), args, components):
+ comp_args = opts.data_labels[key].component_args
+ if comp_args and isinstance(comp_args, dict) and comp_args.get('visible') is False:
+ continue
+
opts.data[key] = value
up.append(comp.update(value=value))
|