o
    *j	                     @   s   d dl mZmZ d dlmZ d dlmZ d dlmZm	Z	m
Z
 d dlmZ d dlmZmZ d dlmZmZ d dlmZ e Zejejejd	G d
d de
ZdS )    )AnyDict)	Pipelines)
OutputKeys)InputModelPipeline)	PIPELINES)is_modelis_official_hub_path)InvokeTasks)
get_logger)module_namec                       s   e Zd ZdZd fdd	Zdeeef deeef fddZd	eeef deeef fd
dZ	deeef deeef fddZ
  ZS )SurfaceReconCommonPipelinea   Surface reconstruction common pipeline
    Example:

    ```python
    >>> from modelscope.pipelines import pipeline
    >>> surface_recon_common = pipeline(Tasks.surface_recon_common,
                'damo/cv_surface-reconstruction-common')
    >>> surface_recon_common({
            'data_dir': '/data/lego', # data dir path (str)
            'save_dir': './output', # save dir path (str)
        })
    >>> #
    ```
    gpuc                    sb   t |rtj||dtjdn|}t jdd|i| t| jts*t	
d tdt	d dS )z
        use model to create a image sky change pipeline for image editing
        Args:
            model (str or Model): model_id on modelscope hub
            device (str): only support gpu
        T)deviceZmodel_prefetchedZ
invoked_bymodelz model object is not initialized.zload model doneN )r
   r   Zfrom_pretrainedr   ZPIPELINEsuper__init__
isinstancer   loggererror	Exceptioninfo)selfr   r   kwargs	__class__r   v/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/modelscope/pipelines/cv/surface_recon_common_pipeline.pyr   !   s   
z#SurfaceReconCommonPipeline.__init__inputsreturnc                 C      |S Nr   r   r!   r   r   r    
preprocess4      z%SurfaceReconCommonPipeline.preprocessinputc                 C   sX   |d }|d }d|v r|d }nd}d|v r|d }nd}| j |||| tjdiS )Ndata_dirsave_dircolorFn_directions   Done)r   Zsurface_reconstructionr   ZOUTPUT)r   r(   r)   r*   r+   r,   r   r   r    forward7   s   


z"SurfaceReconCommonPipeline.forwardc                 C   r#   r$   r   r%   r   r   r    postprocessF   r'   z&SurfaceReconCommonPipeline.postprocess)r   )__name__
__module____qualname____doc__r   r   strr   r&   r/   r0   __classcell__r   r   r   r    r      s    ""*r   N)typingr   r   Zmodelscope.metainfor   Zmodelscope.outputsr   Zmodelscope.pipelines.baser   r   r   Zmodelscope.pipelines.builderr	   Zmodelscope.pipelines.utilr
   r   Zmodelscope.utils.constantr   r   Zmodelscope.utils.loggerr   r   Zregister_moduleZsurface_recon_commonr   r   r   r   r    <module>   s   