init_img=gr.Image(label="Image for img2img",elem_id="img2img_image",show_label=False,source="upload",interactive=True,type="pil",tool=cmd_opts.gradio_img2img_tool,image_mode="RGBA").style(height=480)
init_img=gr.Image(label="Image for img2img",elem_id="img2img_image",show_label=False,source="upload",interactive=True,type="pil",tool=cmd_opts.gradio_img2img_tool,image_mode="RGBA").style(height=480)
init_img_with_mask=gr.Image(label="Image for inpainting with mask",show_label=False,elem_id="img2maskimg",source="upload",interactive=True,type="pil",tool=cmd_opts.gradio_inpaint_tool,image_mode="RGBA").style(height=480)
init_img_with_mask=gr.Image(label="Image for inpainting with mask",show_label=False,elem_id="img2maskimg",source="upload",interactive=True,type="pil",tool=cmd_opts.gradio_inpaint_tool,image_mode="RGBA").style(height=480)
inpaint_full_res=gr.Checkbox(label='Inpaint at full resolution',value=False)
inpaint_full_res=gr.Checkbox(label='Inpaint at full resolution',value=False,elem_id="img2img_inpaint_full_res")
inpaint_full_res_padding=gr.Slider(label='Inpaint at full resolution padding, pixels',minimum=0,maximum=256,step=4,value=32)
inpaint_full_res_padding=gr.Slider(label='Inpaint at full resolution padding, pixels',minimum=0,maximum=256,step=4,value=32,elem_id="img2img_inpaint_full_res_padding")
hidden='<br>Disabled when launched with --hide-ui-dir-config.'ifshared.cmd_opts.hide_ui_dir_configelse''
hidden='<br>Disabled when launched with --hide-ui-dir-config.'ifshared.cmd_opts.hide_ui_dir_configelse''
gr.HTML(f"<p class=\"text-gray-500\">Process images in a directory on the same machine where the server is running.<br>Use an empty output directory to save pictures normally instead of writing to the output directory.{hidden}</p>")
gr.HTML(f"<p class=\"text-gray-500\">Process images in a directory on the same machine where the server is running.<br>Use an empty output directory to save pictures normally instead of writing to the output directory.{hidden}</p>")
withgr.TabItem('Batch from Directory',elem_id="extras_batch_directory_tab"):
extras_batch_input_dir=gr.Textbox(label="Input directory",**shared.hide_dirs,placeholder="A directory on the same machine where the server is running.")
extras_batch_input_dir=gr.Textbox(label="Input directory",**shared.hide_dirs,placeholder="A directory on the same machine where the server is running.",elem_id="extras_batch_input_dir")
extras_batch_output_dir=gr.Textbox(label="Output directory",**shared.hide_dirs,placeholder="Leave blank to save images to the default path.")
extras_batch_output_dir=gr.Textbox(label="Output directory",**shared.hide_dirs,placeholder="Leave blank to save images to the default path.",elem_id="extras_batch_output_dir")
show_extras_results=gr.Checkbox(label='Show result images',value=True)
show_extras_results=gr.Checkbox(label='Show result images',value=True,elem_id="extras_show_extras_results")
custom_name=gr.Textbox(label="Custom Name (Optional)")
custom_name=gr.Textbox(label="Custom Name (Optional)",elem_id="modelmerger_custom_name")
interp_amount=gr.Slider(minimum=0.0,maximum=1.0,step=0.05,label='Multiplier (M) - set to 0 to get model A',value=0.3)
interp_amount=gr.Slider(minimum=0.0,maximum=1.0,step=0.05,label='Multiplier (M) - set to 0 to get model A',value=0.3,elem_id="modelmerger_interp_amount")
new_hypernetwork_layer_structure=gr.Textbox("1, 2, 1",label="Enter hypernetwork layer structure",placeholder="1st and last digit must be 1. ex:'1, 2, 1'")
new_hypernetwork_layer_structure=gr.Textbox("1, 2, 1",label="Enter hypernetwork layer structure",placeholder="1st and last digit must be 1. ex:'1, 2, 1'",elem_id="train_new_hypernetwork_layer_structure")
new_hypernetwork_activation_func=gr.Dropdown(value="linear",label="Select activation function of hypernetwork. Recommended : Swish / Linear(none)",choices=modules.hypernetworks.ui.keys)
new_hypernetwork_activation_func=gr.Dropdown(value="linear",label="Select activation function of hypernetwork. Recommended : Swish / Linear(none)",choices=modules.hypernetworks.ui.keys,elem_id="train_new_hypernetwork_activation_func")
new_hypernetwork_initialization_option=gr.Dropdown(value="Normal",label="Select Layer weights initialization. Recommended: Kaiming for relu-like, Xavier for sigmoid-like, Normal otherwise",choices=["Normal","KaimingUniform","KaimingNormal","XavierUniform","XavierNormal"])
new_hypernetwork_initialization_option=gr.Dropdown(value="Normal",label="Select Layer weights initialization. Recommended: Kaiming for relu-like, Xavier for sigmoid-like, Normal otherwise",choices=["Normal","KaimingUniform","KaimingNormal","XavierUniform","XavierNormal"],elem_id="train_new_hypernetwork_initialization_option")
process_focal_crop_face_weight=gr.Slider(label='Focal point face weight',value=0.9,minimum=0.0,maximum=1.0,step=0.05)
process_focal_crop_face_weight=gr.Slider(label='Focal point face weight',value=0.9,minimum=0.0,maximum=1.0,step=0.05,elem_id="train_process_focal_crop_face_weight")
process_focal_crop_entropy_weight=gr.Slider(label='Focal point entropy weight',value=0.15,minimum=0.0,maximum=1.0,step=0.05)
process_focal_crop_entropy_weight=gr.Slider(label='Focal point entropy weight',value=0.15,minimum=0.0,maximum=1.0,step=0.05,elem_id="train_process_focal_crop_entropy_weight")
process_focal_crop_edges_weight=gr.Slider(label='Focal point edges weight',value=0.5,minimum=0.0,maximum=1.0,step=0.05)
process_focal_crop_edges_weight=gr.Slider(label='Focal point edges weight',value=0.5,minimum=0.0,maximum=1.0,step=0.05,elem_id="train_process_focal_crop_edges_weight")
dataset_directory=gr.Textbox(label='Dataset directory',placeholder="Path to directory with input images")
dataset_directory=gr.Textbox(label='Dataset directory',placeholder="Path to directory with input images",elem_id="train_dataset_directory")
log_directory=gr.Textbox(label='Log directory',placeholder="Path to directory where to write outputs",value="textual_inversion")
log_directory=gr.Textbox(label='Log directory',placeholder="Path to directory where to write outputs",value="textual_inversion",elem_id="train_log_directory")
create_image_every=gr.Number(label='Save an image to log directory every N steps, 0 to disable',value=500,precision=0)
create_image_every=gr.Number(label='Save an image to log directory every N steps, 0 to disable',value=500,precision=0,elem_id="train_create_image_every")
save_embedding_every=gr.Number(label='Save a copy of embedding to log directory every N steps, 0 to disable',value=500,precision=0)
save_embedding_every=gr.Number(label='Save a copy of embedding to log directory every N steps, 0 to disable',value=500,precision=0,elem_id="train_save_embedding_every")
save_image_with_stored_embedding=gr.Checkbox(label='Save images with embedding in PNG chunks',value=True)
save_image_with_stored_embedding=gr.Checkbox(label='Save images with embedding in PNG chunks',value=True,elem_id="train_save_image_with_stored_embedding")
preview_from_txt2img=gr.Checkbox(label='Read parameters (prompt, etc...) from txt2img tab when making previews',value=False)
preview_from_txt2img=gr.Checkbox(label='Read parameters (prompt, etc...) from txt2img tab when making previews',value=False,elem_id="train_preview_from_txt2img")
withgr.Row():
withgr.Row():
shuffle_tags=gr.Checkbox(label="Shuffle tags by ',' when creating prompts.",value=False)
shuffle_tags=gr.Checkbox(label="Shuffle tags by ',' when creating prompts.",value=False,elem_id="train_shuffle_tags")
tag_drop_out=gr.Slider(minimum=0,maximum=1,step=0.1,label="Drop out tags when creating prompts.",value=0)
tag_drop_out=gr.Slider(minimum=0,maximum=1,step=0.1,label="Drop out tags when creating prompts.",value=0,elem_id="train_tag_drop_out")
reload_script_bodies=gr.Button(value='Reload custom script bodies (No ui updates, No restart)',variant='secondary')
reload_script_bodies=gr.Button(value='Reload custom script bodies (No ui updates, No restart)',variant='secondary',elem_id="settings_reload_script_bodies")
restart_gradio=gr.Button(value='Restart Gradio and Refresh components (Custom Scripts, ui.py, js and css only)',variant='primary')
restart_gradio=gr.Button(value='Restart Gradio and Refresh components (Custom Scripts, ui.py, js and css only)',variant='primary',elem_id="settings_restart_gradio")