
    1;ji
                         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Z
dS )    N)CallableUnionimageconvert_methodreturnc                    t          | t                    r|                     d          s|                     d          r9t          j                            t          j        | d          j                  } nt          j
                            |           r t          j                            |           } nDt          d|  d          t          | t          j        j                  r| } nt          d          t          j                            |           } | ||           } n|                     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   s     W/root/voice-cloning/.venv/lib/python3.11/site-packages/diffusers/utils/loading_utils.py
load_imager   	   s,   " % 
I&& 	%*:*::*F*F 	INN8<d#C#C#C#GHHEEW^^E"" 	INN5))EEx\axxx   
E39?	+	+ 
u
 
 	
 L''..E!u%%e$$L    )N)r   typingr   r   	PIL.Imager   PIL.ImageOpsr   r   r   r    r   r   <module>r"      s    				 " " " " " " " "          hl( (cio%&(8@#)/ARTWT]TcAc8d(Y_( ( ( ( ( (r   