Skip to content

clip

ClipCompareResponse

Bases: InferenceResponse

Response for CLIP comparison.

Attributes:

Name Type Description
similarity Union[List[float], Dict[str, float]]

Similarity scores.

time float

The time in seconds it took to produce the similarity scores including preprocessing.

Source code in inference/core/entities/responses/clip.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class ClipCompareResponse(InferenceResponse):
    """Response for CLIP comparison.

    Attributes:
        similarity (Union[List[float], Dict[str, float]]): Similarity scores.
        time (float): The time in seconds it took to produce the similarity scores including preprocessing.
    """

    similarity: Union[List[float], Dict[str, float]]
    time: Optional[float] = Field(
        None,
        description="The time in seconds it took to produce the similarity scores including preprocessing",
    )
    parent_id: Optional[str] = Field(
        description="Identifier of parent image region. Useful when stack of detection-models is in use to refer the RoI being the input to inference",
        default=None,
    )

ClipEmbeddingResponse

Bases: InferenceResponse

Response for CLIP embedding.

Attributes:

Name Type Description
embeddings List[List[float]]

A list of embeddings, each embedding is a list of floats.

time float

The time in seconds it took to produce the embeddings including preprocessing.

Source code in inference/core/entities/responses/clip.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class ClipEmbeddingResponse(InferenceResponse):
    """Response for CLIP embedding.

    Attributes:
        embeddings (List[List[float]]): A list of embeddings, each embedding is a list of floats.
        time (float): The time in seconds it took to produce the embeddings including preprocessing.
    """

    embeddings: List[List[float]] = Field(
        examples=["[[0.12, 0.23, 0.34, ..., 0.43]]"],
        description="A list of embeddings, each embedding is a list of floats",
    )
    time: Optional[float] = Field(
        None,
        description="The time in seconds it took to produce the embeddings including preprocessing",
    )