a
    Ad
                     @   s   d dl mZ d dlZd dlmZ d dlmZ d dlmZm	Z	 d dlm
Z
 d dlmZ d dlZeeeeeeeeeeeeeeeeeeeeejddd	ZdS )
    )closingN)
processing)create_override_settings_dict)optscmd_opts)plaintext_to_html)id_taskpromptnegative_promptstepssampler_namen_iter
batch_size	cfg_scaleheightwidth	enable_hrdenoising_strengthhr_scalehr_upscalerhr_second_pass_stepshr_resize_xhr_resize_yhr_checkpoint_namehr_sampler_name	hr_promptrequestc                 G   sF  t |}tjtjtjptjtjp$tj	|||||||||
|	||rB|nd ||||||dkrZd n||dkrhd n||||d}t
jj|_||_|j|_tjrtd| tjd t|8 t
jjj|g|R  }|d u rt|}W d    n1 s0    Y  tj  | }tjrt| tjr(g |_|j|t|jt|jddfS )NzUse same checkpointzUse same sampler)sd_modeloutpath_samplesoutpath_gridsr	   stylesr
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   hr_negative_promptoverride_settingsz

txt2img: )filecomments)	classname) r   r    StableDiffusionProcessingTxt2Imgsharedr   r   outdir_samplesoutdir_txt2img_samplesoutdir_gridsoutdir_txt2img_gridsmodulesscriptsscripts_txt2imgscript_argsusernameuserr   enable_console_promptsprintprogress_print_outr   runprocess_images
total_tqdmclearjssamples_log_stdoutdo_not_show_imagesimagesr   infor$   )r   r	   r
   prompt_stylesr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r!   override_settings_textsr   argsr"   p	processedgeneration_info_js rD   7/var/www/html/stable-diffusion-webui/modules/txt2img.pytxt2img   sX    




(
rF   )
contextlibr   modules.scriptsr,   r   Z'modules.generation_parameters_copypaster   Zmodules.sharedr   r   r'   
modules.uir   gradiogrstrintfloatboolRequestrF   rD   rD   rD   rE   <module>   s   