
    g                     >    d dl mZmZ ddlmZ  G d de          ZdS )   )WhisperForConditionalGenerationWhisperProcessor   )PipelineToolc                   F    e Zd ZdZdZdZeZeZ	ddddiZ
dZd Zd	 Zd
 ZdS )SpeechToTextToolzdistil-whisper/distil-large-v3zTThis is a tool that transcribes an audio into text. It returns the transcribed text.transcriberaudiozThe audio to transcribe)typedescriptionstringc                 0    |                      |d          S )Npt)return_tensors)pre_processor)selfr
   s     ^/var/www/html/ai-engine/env/lib/python3.11/site-packages/transformers/agents/speech_to_text.pyencodezSpeechToTextTool.encode    s    !!%!===    c                 B    | j                             |d                   S )Ninput_features)modelgenerate)r   inputss     r   forwardzSpeechToTextTool.forward#   s    z""6*:#;<<<r   c                 F    | j                             |d          d         S )NT)skip_special_tokens    )r   batch_decode)r   outputss     r   decodezSpeechToTextTool.decode&   s$    !..wD.QQRSTTr   N)__name__
__module____qualname__default_checkpointr   namer   pre_processor_classr   model_classr   output_typer   r   r!    r   r   r   r      sy        9hKD*1K8QRRSFK> > >= = =U U U U Ur   r   N)models.whisperr   r   toolsr   r   r*   r   r   <module>r-      sp   $ O N N N N N N N      U U U U U| U U U U Ur   