o
    «ôj
  ã                   @   sp   d dl Z d dlmZmZ d dlZd dlZd dlZ	ddeeej	j	f deej	j	gej	j	f dej	j	fdd„Z
dS )	é    N)ÚCallableÚUnionÚimageÚconvert_methodÚreturnc                 C   s¬   t | tƒr1|  d¡s|  d¡rtj tj| dd�j¡} n#t	j
 | ¡r)tj | ¡} ntd| › d�ƒ‚t | tjjƒr;| } ntdƒ‚tj | ¡} |durO|| ƒ} | S |  d	¡} | S )
aµ  
    Loads `image` to a PIL Image.

    Args:
        image (`str` or `PIL.Image.Image`):
            The image to convert to the PIL Image format.
        convert_method (Callable[[PIL.Image.Image], PIL.Image.Image], optional):
            A conversion method to apply to the image after loading it. When set to `None` the image will be converted
            "RGB".

    Returns:
        `PIL.Image.Image`:
            A PIL Image.
    zhttp://zhttps://T)ÚstreamzIIncorrect path or URL. URLs must start with `http://` or `https://`, and z is not a valid path.zgIncorrect format used for the image. Should be a URL linking to an image, a local path, or a PIL image.NÚRGB)Ú
isinstanceÚstrÚ
startswithÚPILÚImageÚopenÚrequestsÚgetÚrawÚosÚpathÚisfileÚ
ValueErrorÚImageOpsÚexif_transposeÚconvert)r   r   © r   úp/var/www/html/academy/tools/voices/clone/cosy-venv/lib/python3.10/site-packages/diffusers/utils/loading_utils.pyÚ
load_image	   s&   

ÿÿ
þr   )N)r   Útypingr   r   Ú	PIL.Imager   ÚPIL.ImageOpsr   r
   r   r   r   r   r   r   Ú<module>   s    ÿÿÿþ