o
    Ďi                     @   s<   d dl mZ d dlmZmZ d dlmZ G dd deZdS )    )Optional)INSTANCE_SEGMENTATION_MODELINSTANCE_SEGMENTATION_URL)InferenceModelc                       s`   e Zd ZdZ			ddededee dee de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  || |p
t}| 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 (str): localhost address and port if pointing towards local inference engine
        /N)super__init__r   
dataset_idversionapi_urlr	   r
   )selfr   r   r	   r
   r   base_url	__class__ a/home/jeff/fluffinator/venv/lib/python3.10/site-packages/roboflow/models/instance_segmentation.pyr      s
   z"InstanceSegmentationModel.__init__(   c                    s   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   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__B   s   "z!InstanceSegmentationModel.__str__)NNN)r   )r    
__module____qualname____doc__strr   dictr   r   r"   __classcell__r   r   r   r   r      s$    	r   N)typingr   roboflow.configr   r   roboflow.models.inferencer   r   r   r   r   r   <module>   s    