
    +j                        d Z ddlmZ ddlmZmZ ddlmZmZm	Z	 ddl
mZ ddlmZ ddlmZmZ ddlmZ dd	lmZ erdd
lmZ  e             G d dee                      ZdS )zgr.WorkflowCanvas() component.    )annotations)CallableSequence)TYPE_CHECKINGAnyLiteral)document)BlockContext)	Componentserver)Events)I18nData)Timerc                  x    e Zd ZdZej        gZ	 d(dddddddddddddd)dZd*d Zd*d!Z	d+d#Z
d,d$Zd-d&Zd' ZdS ).WorkflowCanvasa  
    Visual canvas for building AI pipelines by connecting Hugging Face Spaces.

    Used internally by `gr.Workflow`. Can also be used directly if you need fine-grained
    control over the server functions exposed to the canvas.

    Example:
        ```python
        import gradio as gr

        with gr.Blocks() as demo:
            canvas = gr.WorkflowCanvas(server_functions=[my_fn])
        demo.launch()
        ```
    NFTvalue)labeleveryinputs
show_labelvisibleelem_idelem_classesrenderkeypreserved_by_key	containerserver_functions&str | Callable[..., str | None] | Noner   str | I18nData | Noner   Timer | float | Noner   7Component | Sequence[Component] | set[Component] | Noner   boolr   bool | Literal['hidden']r   
str | Noner   list[str] | str | Noner   r   (int | str | tuple[int | str, ...] | Noner   r   r   list[Callable] | Nonec                  t          j        | ||||	|
|           t          j        | ||||||||	|
|||           |rt                      }|D ]}t	          |dt          |                    }||v rt          d| d          |                    |           t          |          }t          | ||           | j
                            |           dS dS )a  
        Parameters:
            value: Initial workflow JSON string. If a callable is passed, it is called on each browser session load and its return value is used as the initial workflow.
            label: Label for this component.
            every: Continously calls `value` to recalculate it if `value` is a function.
            inputs: Components used as inputs to calculate `value` if `value` is a function.
            show_label: If True, the label will be displayed.
            visible: If False, component will be hidden.
            elem_id: Optional string assigned as the id of this component in the DOM.
            elem_classes: Optional list of strings assigned as the classes of this component.
            render: If False, component will not be rendered in the Blocks context.
            key: In a gr.render, components with the same key across re-renders are treated as the same component.
            preserved_by_key: Parameters preserved across re-renders with the same key.
            container: If True, displayed in a container.
            server_functions: Python functions callable from the canvas frontend via the `server` object.
        )r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   __name__z0WorkflowCanvas: duplicate server_function name 'z-'. Each function must have a unique __name__.N)r
   __init__r   setgetattrstr
ValueErroraddr   setattr
server_fnsappend)selfr   r   r   r   r   r   r   r   r   r   r   r   r   seenfnfn_name	decorateds                     d/home/wildlama/visual-decline/.venv/lib/python3.11/site-packages/gradio/components/workflowcanvas.pyr+   zWorkflowCanvas.__init__'   sC   B 	%-	
 	
 	
 	
 	!%-	
 	
 	
 	
  	2 UUD& 
2 
2!"j#b''::d??$E7 E E E   !!!"2JJ	gy111&&y1111	2 	2
2 
2    returnr   c                    d S N r4   s    r9   example_payloadzWorkflowCanvas.example_payloadn       tr:   c                    d S r=   r>   r?   s    r9   example_valuezWorkflowCanvas.example_valueq   rA   r:   payloadc                    |S r=   r>   )r4   rD   s     r9   
preprocesszWorkflowCanvas.preprocesst   s    r:   c                    |S r=   r>   )r4   r   s     r9   postprocesszWorkflowCanvas.postprocessw   s    r:   dict[str, Any]c                
    ddiS )Ntypestringr>   r?   s    r9   api_infozWorkflowCanvas.api_infoz   s    !!r:   c                    dS )Nworkflowcanvasr>   r?   s    r9   get_block_namezWorkflowCanvas.get_block_name}   s    r:   r=   )r   r   r   r    r   r!   r   r"   r   r#   r   r$   r   r%   r   r&   r   r#   r   r'   r   r&   r   r#   r   r(   )r;   r   )rD   r%   r;   r%   )r   r%   r;   r%   )r;   rI   )r*   
__module____qualname____doc__r   changeEVENTSr+   r@   rC   rF   rH   rM   rP   r>   r:   r9   r   r      s           m_F 9=E2 (,&*JN ,0"/38<3:26E2 E2 E2 E2 E2 E2N            " " " "         r:   r   N)rS   
__future__r   collections.abcr   r   typingr   r   r   gradio_client.documentationr	   gradio.blocksr
   gradio.components.baser   r   gradio.eventsr   gradio.i18nr   gradio.componentsr   r   r>   r:   r9   <module>r_      s   $ $ " " " " " " . . . . . . . . . . . . . . . . . . 0 0 0 0 0 0 & & & & & & 4 4 4 4 4 4 4 4                         ('''''' 
j  j  j  j  j \9 j  j  j  j  j r:   