#quick dictionary to class object conversion. Its necessary due apply_filename_pattern requiring it
classMyObject:
def__init__(self,d=None):
ifdisnotNone:
forkey,valueind.items():
setattr(self,key,value)
data=json.loads(js_data)
p=MyObject(data)
path=opts.outdir_save
save_to_dirs=opts.use_save_to_dirs_for_ui
extension:str=opts.samples_format
start_index=0
ifindex>-1andopts.save_selected_onlyand(index>=data["index_of_first_image"]):# ensures we are looking at a specific non-grid picture, and we have save_selected_only
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.",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.",elem_id="extras_batch_output_dir")
show_extras_results=gr.Checkbox(label='Show result images',value=True,elem_id="extras_show_extras_results")
#quick dictionary to class object conversion. Its necessary due apply_filename_pattern requiring it
classMyObject:
def__init__(self,d=None):
ifdisnotNone:
forkey,valueind.items():
setattr(self,key,value)
data=json.loads(js_data)
p=MyObject(data)
path=shared.opts.outdir_save
save_to_dirs=shared.opts.use_save_to_dirs_for_ui
extension:str=shared.opts.samples_format
start_index=0
ifindex>-1andshared.opts.save_selected_onlyand(index>=data["index_of_first_image"]):# ensures we are looking at a specific non-grid picture, and we have save_selected_only
withgr.TabItem('Batch from Directory',elem_id="extras_batch_directory_tab")astab_batch_dir:
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.",elem_id="extras_batch_output_dir")
show_extras_results=gr.Checkbox(label='Show result images',value=True,elem_id="extras_show_extras_results")