Predictions

Predictions

Use your deployed models to make predictions (inferences) on new data.

Make a prediction

Make a prediction using a model’s active version:

from seeme.types import ApplicationType

prediction = client.predict(
    model_id=my_model.id,
    item="path/to/image.jpg",
    application_type=ApplicationType.IMAGE_CLASSIFICATION
)
ParameterTypeDescription
model_idstrThe model id
itemstr or dictThe input item (file path for images, text string for text, dict for structured data)
application_typeApplicationTypeThe type of application. Default: IMAGE_CLASSIFICATION. Possible values: IMAGE_CLASSIFICATION, OBJECT_DETECTION, TEXT_CLASSIFICATION, STRUCTURED, LANGUAGE_MODEL, NER, OCR, SPEECH_TO_TEXT, SEARCH

The prediction result contains the following properties:

PropertyTypeDescription
idstrUnique id for the inference
created_atstrThe creation date
updated_atstrLast updated date
predictionstrThe predicted label (deprecated, use inference_items)
confidencefloatThe prediction confidence (deprecated, use inference_items)
model_idstrThe model id used for prediction
model_version_idstrThe model version id used for prediction
extensionstrThe file extension of the input
inference_itemsList[InferenceItem]List of prediction results
inference_timestrTime taken for inference
resultstrRaw result as JSON string

Each InferenceItem has:

PropertyTypeDescription
predictionstrThe predicted label/class
confidencefloatThe confidence score (0-1)
inference_idstrThe parent inference id
coordinatesstrBounding box coordinates (for object detection)

Predict with a specific model version

Make a prediction using a specific model version instead of the active version:

prediction = client.version_predict(
    version=my_model_version,
    item="path/to/image.jpg",
    application_type=ApplicationType.IMAGE_CLASSIFICATION
)
ParameterTypeDescription
versionModelVersionThe model version object
itemstr or dictThe input item
application_typeApplicationTypeThe type of application

Application-specific examples

Image Classification

prediction = client.predict(
    model_id=my_model.id,
    item="path/to/cat.jpg",
    application_type=ApplicationType.IMAGE_CLASSIFICATION
)

for item in prediction.inference_items:
    print(f"{item.prediction}: {item.confidence:.2%}")

Object Detection

prediction = client.predict(
    model_id=my_model.id,
    item="path/to/image.jpg",
    application_type=ApplicationType.OBJECT_DETECTION
)

for item in prediction.inference_items:
    print(f"{item.prediction} at {item.coordinates}")

Text Classification

prediction = client.predict(
    model_id=my_model.id,
    item="This movie was fantastic!",
    application_type=ApplicationType.TEXT_CLASSIFICATION
)

Structured/Tabular Data

input_data = {
    "feature1": 10,
    "feature2": "category_a",
    "feature3": 3.14
}

prediction = client.predict(
    model_id=my_model.id,
    item=input_data,
    application_type=ApplicationType.STRUCTURED
)

Get prediction history

Retrieve past predictions for a model:

inferences = client.get_inferences(
    model_id=my_model.id,
    model_version_ids=[],
    page_count=0,
    page_size=25,
    include_already_added=False,
    show_hidden=False
)
ParameterTypeDescription
model_idstrThe model id
model_version_idsList[str]Filter by specific model versions (empty for all)
page_countintPage number (0-indexed). Default: 0
page_sizeintNumber of results per page. Default: 25
include_already_addedboolInclude inferences already added to datasets. Default: False
show_hiddenboolShow hidden inferences. Default: False

Get prediction statistics

Get statistics about predictions made with a model:

stats = client.get_inference_stats(my_model.id)
ParameterTypeDescription
model_idstrThe model id