o
    j#                     @   s6   d dl Z d dlZdZdZdd Zedkre  dS dS )    Nz(stabilityai/stable-diffusion-xl-base-1.0zoutput5.pngc               	   C   s  t tjdk rtd td tjd } tj| s'td|   td dd l}dd l	m
} dd l}dd l}dd l}dd l}ddlm} ddlm} |j rTdnd	}|| d
}	d}
|d
|
|
fd}|	d |
|	j d }|
|	j d }||	||f |jt|dkr|jn|j|dkrdnd dd|}|  |dkr|jj|jd d}d}|j |d!d}||||ddd|dj"d }|#t$ tdt$  d S )N   uX   error: 입력 파일을 파라메터로 전달하세요. 예: python3 test2.py test1.png   u1   error: 입력 파일을 찾을 수 없습니다: r   )Image) StableDiffusionXLImg2ImgPipelinecudacpuRGBi   )   r	   r	   )  r
   fp16T)torch_dtypevariantuse_safetensors)dtypeaR  
perfectly symmetrical flat lay clothing, single layer fabric,
completely unfolded and spread out, no overlapping parts,
straight-on orthographic view, dead center,
strictly parallel vertical lines, perfectly horizontal hem,
smooth ironed fabric, no wrinkles, professional studio photography,
white background, high quality catalog photo
z
overlapping fabric, folded layers, crumpled, double layers,
tilted, asymmetrical, distorted, curved lines, warped,
mannequin, body, person, blurry, low quality
)device*   g333333?g      &@2   )promptnegative_promptimagestrengthguidance_scalenum_inference_steps	generatorzResult saved to: )%lensysargvprintexitospathisfiletorchmatplotlib.pyplotpyplot	diffuserstransformersPILr   r   r   is_availableopenconvertnew	thumbnailwidthheightpastefrom_pretrainedMODEL_IDfloat16float32toenable_attention_slicingvae	Generatormanual_seedimagessaveOUTPUT_PATH)
input_pathr"   pltr%   r&   r'   r   r   r   r   canvas_sizecanvasxypiper   r   r   result rD    htdocs/OOTD2/inpainting/test2.pymain   s^   


 
		
rF   __main__)r   r   r1   r;   rF   __name__rD   rD   rD   rE   <module>   s    g
