o
    e	                     @   s0   d dl mZmZ d dlmZ G dd deZdS )    )INSTANCE_SEGMENTATION_MODELINSTANCE_SEGMENTATION_URL)InferenceModelc                       sT   e Zd ZdZ			ddededededef
 fdd	Zd fdd	Zdd Z	  Z
S )InstanceSegmentationModelzy
    Run inference on a instance segmentation model hosted on
        Roboflow or served through Roboflow Inference.
    Napi_key
version_idcolorspreprocessinglocalc                    s~   t t| || |du rt d| j d| j | _n| d| j d| j | _|du r.i n|| _|du r:i | _dS || _dS )a  
        Create a InstanceSegmentationModel object through which you can run inference.

        Args:
            api_key (str): private roboflow api key
            version_id (str): the workspace/project id
            colors (dict): colors to use for the image
            preprocessing (dict): preprocessing to use for the image
            local (bool): whether the image is local or hosted
        N/)	superr   __init__r   
dataset_idversionapi_urlr   r	   )selfr   r   r   r	   r
   	__class__ T/var/www/myenv/lib/python3.10/site-packages/roboflow/models/instance_segmentation.pyr      s   z"InstanceSegmentationModel.__init__(   c                    s   t t| j||tdS )ac  
        Infers detections based on image from a specified model and image path.

        Args:
            image_path (str): path to the image you'd like to perform prediction on
            confidence (int): confidence threshold for predictions, on a scale from 0-100

        Returns:
            PredictionGroup Object

        Example:
            >>> import roboflow

            >>> rf = roboflow.Roboflow(api_key="")

            >>> project = rf.workspace().project("PROJECT_ID")

            >>> model = project.version("1").model

            >>> prediction = model.predict("YOUR_IMAGE.jpg")
        )
confidenceprediction_type)r   r   predictr   )r   
image_pathr   r   r   r   r   %   s
   
z!InstanceSegmentationModel.predictc                 C   s"   dt | j d| j d| j dS )N<z id=z
, api_url=>)type__name__idr   )r   r   r   r   __str__A   s   "z!InstanceSegmentationModel.__str__)NNN)r   )r   
__module____qualname____doc__strdictboolr   r   r    __classcell__r   r   r   r   r      s$    	r   N)roboflow.configr   r   roboflow.models.inferencer   r   r   r   r   r   <module>   s    