o
    h                     @   s0   d dl mZmZ ddlmZ G dd deZdS )   )AutoModelForSeq2SeqLMAutoTokenizer   )PipelineToolc                   @   sH   e Zd ZdZdZdZdZeZe	Z
dgZdgZdd Zdd	 Zd
d ZdS )TextSummarizationToolz
    Example:

    ```py
    from transformers.tools import TextSummarizationTool

    summarizer = TextSummarizationTool()
    summarizer(long_text)
    ```
    z philschmid/bart-large-cnn-samsumzThis is a tool that summarizes an English text. It takes an input `text` containing the text to summarize, and returns a summary of the text.
summarizertextc                 C   s   | j |dddS )NptT)return_tensors
truncation)pre_processor)selfr    r   [/var/www/html/ai/venv/lib/python3.10/site-packages/transformers/tools/text_summarization.pyencode-   s   zTextSummarizationTool.encodec                 C   s   | j jdi |d S )N    r   )modelgenerate)r   inputsr   r   r   forward0   s   zTextSummarizationTool.forwardc                 C   s   | j j|dddS )NT)skip_special_tokensclean_up_tokenization_spaces)r   decode)r   outputsr   r   r   r   3   s   zTextSummarizationTool.decodeN)__name__
__module____qualname____doc__default_checkpointdescriptionnamer   pre_processor_classr   model_classr   r   r   r   r   r   r   r   r   r      s    r   N)models.autor   r   baser   r   r   r   r   r   <module>   s   