a
    Ad
                     @   s<   d dl Zd dlmZmZmZmZmZ d dlm	Z
 dd ZdS )    N)scriptsshared	ui_commonpostprocessing
call_queuec                  C   s  t jdd} t jddd t jdd` t jdd t jd	d
dd$}t jdddddd}W d    n1 sx0    Y  t jdddd }t jdddd}W d    n1 s0    Y  t jdddd`}t jf ddit	j
ddd}t jf dd it	j
d!d"d}t jd#dd$d%}W d    n1 s:0    Y  W d    n1 sZ0    Y  t jd&d'd(d)}	tj }
W d    n1 s0    Y  t  ( td*t	jj\}}}}W d    n1 s0    Y  W d    n1 s0    Y  |jd+d, g | gd- |jd.d, g | gd- |jd/d, g | gd- |	jtjtjd d0gd1| |||||g|
|||gd- td*|d  |jtjjg g d- d S )2Nr   )valueFcompact)equal_heightvariant)r
   Zmode_extras)elem_idzSingle ImageZsingle_imageZextras_single_tab)idr   SourceuploadTpilextras_image)labelsourceinteractivetyper   zBatch ProcessZbatch_processZextras_batch_process_tabZextras_image_batch)r   r   r   zBatch from DirectoryZbatch_from_directoryZextras_batch_directory_tabr   zInput directoryz<A directory on the same machine where the server is running.extras_batch_input_dir)placeholderr   zOutput directoryz/Leave blank to save images to the default path.extras_batch_output_dirzShow result imagesZextras_show_extras_results)r   r   r   GenerateZextras_generateprimary)r   r
   extrasc                   S   s   dS )Nr    r   r   r   A/var/www/html/stable-diffusion-webui/modules/ui_postprocessing.py<lambda>       zcreate_ui.<locals>.<lambda>)fninputsoutputsc                   S   s   dS )N   r   r   r   r   r   r      r   c                   S   s   dS )N   r   r   r   r   r   r       r    )extra_outputs)grStateRowColumnTabsTabItemImageFilesTextboxr   	hide_dirsCheckboxButtonr   scripts_postprocsetup_uir   create_output_paneloptsoutdir_extras_samplesselectclickr   wrap_gradio_gpu_callr   Zrun_postprocessingparameters_copypasteadd_paste_fieldschangeimage_changed)Z	tab_indexZ
tab_singler   	tab_batchZimage_batchZtab_batch_dirr   r   Zshow_extras_resultssubmitZscript_inputsZresult_imageshtml_info_x	html_infohtml_logr   r   r   	create_ui   sP    2.  P*
X
rC   )gradior&   modulesr   r   r   r   r   'modules.generation_parameters_copypastegeneration_parameters_copypaster:   rC   r   r   r   r   <module>   s   