
    U[i]                         d dl mZmZ d dlmZ erd dlZ e       deedf   de	dz  de	dz  de
eef   fd	       Z e       d
ede	dz  de	dz  de
eef   fd       Zy)    )TYPE_CHECKINGAny)documentNaudioz
np.ndarray
min_length
max_lengthreturnc                 ~    ||5| \  }}t        |      |z  }|||k  r
ddd| ddS |||kD  r
ddd| ddS dddS )	a  
    Validates that the audio length is within the specified min and max length (in seconds).

    Parameters:
        audio: A tuple of (sample rate in Hz, audio data as numpy array).
        min_length: Minimum length of audio in seconds. If None, no minimum length check is performed.
        max_length: Maximum length of audio in seconds. If None, no maximum length check is performed.
    Returns:
        A dict corresponding to `gr.validate()` indicating whether the audio length is valid and an optional message.
    validateFz(Audio is too short. It must be at least  seconds__type__is_validmessagez&Audio is too long. It must be at most Tr   r   )len)r   r   r   sample_ratedatadurations         _/var/www/html/chatbot/Makanify-Chatbot-3/venv/lib/python3.12/site-packages/gradio/validators.pyis_audio_correct_lengthr   	   s     !7!Tt9{*!h&;&!Ej\QYZ 
 !h&;&!CJ<xX 
 #55    videoc                 t    ddl m} ||* ||       }|||k  r
ddd| ddS |||kD  r
ddd| ddS dd	d
S )a  
    Validates that the video file length is within the specified min and max length (in seconds).

    Parameters:
        video: The path to the video file.
        min_length: Minimum length of video in seconds. If None, no minimum length check is performed.
        max_length: Maximum length of video in seconds. If None, no maximum length check is performed.
    Returns:
        A dict corresponding to `gr.validate()` indicating whether the audio length is valid and an optional message.
    r   )get_video_lengthr   Fz(Video is too short. It must be at least r   r   z&Video is too long. It must be at most Tr   )gradio.processing_utilsr   )r   r   r   r   r   s        r   is_video_correct_lengthr   )   s~     9!7#E*!h&;&!Ej\QYZ 
 !h&;&!CJ<xX 
 #55r   )typingr   r   gradio_client.documentationr   numpynptupleintfloatdictstrr   r    r   r   <module>r(      s    % 0 
6l"#6166KPSW<6	#s(^6 6> 
66!DL66;dl6	#s(^6 6r   