o
    ॵiD                     @   s   d dl mZmZ d dlZd dl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 d d	l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DictN)	Pipelines)
hand_model)
OutputKeys)InputPipeline)	PIPELINES)	LoadImage)Tasks)
get_logger)module_namec                       s   e Zd Zdef fddZde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 )HandStaticPipelinemodelc                    s$   t  jdd|i| td dS )z
        use `model` to create hand static pipeline for prediction
        Args:
            model: model id on modelscope hub.
        r   zload model doneN )super__init__loggerinfo)selfr   kwargs	__class__r   `/home/ubuntu/.local/lib/python3.10/site-packages/modelscope/pipelines/cv/hand_static_pipeline.pyr      s   zHandStaticPipeline.__init__inputreturnc                 C   s   t |}|S N)r
   convert_to_ndarray)r   r   imgr   r   r   
preprocess    s   
zHandStaticPipeline.preprocessc                 C   s   t || j| j}tj|iS r   )r   inferr   devicer   OUTPUT)r   r   resultr   r   r   forward$   s   
zHandStaticPipeline.forwardinputsc                 C   s   |S r   r   )r   r%   r   r   r   postprocess(   s   zHandStaticPipeline.postprocess)__name__
__module____qualname__strr   r   r   r   r   r$   r&   __classcell__r   r   r   r   r      s
    
"*r   )typingr   r   numpynpmodelscope.metainfor    modelscope.models.cv.hand_staticr   modelscope.outputsr   modelscope.pipelines.baser   r   modelscope.pipelines.builderr	   modelscope.preprocessorsr
   modelscope.utils.constantr   modelscope.utils.loggerr   r   register_modulehand_staticr   r   r   r   r   <module>   s   