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
)| Parameter | Type | Description |
|---|---|---|
| model_id | str | The model id |
| item | str or dict | The input item (file path for images, text string for text, dict for structured data) |
| application_type | ApplicationType | The 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:
| Property | Type | Description |
|---|---|---|
| id | str | Unique id for the inference |
| created_at | str | The creation date |
| updated_at | str | Last updated date |
| prediction | str | The predicted label (deprecated, use inference_items) |
| confidence | float | The prediction confidence (deprecated, use inference_items) |
| model_id | str | The model id used for prediction |
| model_version_id | str | The model version id used for prediction |
| extension | str | The file extension of the input |
| inference_items | List[InferenceItem] | List of prediction results |
| inference_time | str | Time taken for inference |
| result | str | Raw result as JSON string |
Each InferenceItem has:
| Property | Type | Description |
|---|---|---|
| prediction | str | The predicted label/class |
| confidence | float | The confidence score (0-1) |
| inference_id | str | The parent inference id |
| coordinates | str | Bounding 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
)| Parameter | Type | Description |
|---|---|---|
| version | ModelVersion | The model version object |
| item | str or dict | The input item |
| application_type | ApplicationType | The 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
)| Parameter | Type | Description |
|---|---|---|
| model_id | str | The model id |
| model_version_ids | List[str] | Filter by specific model versions (empty for all) |
| page_count | int | Page number (0-indexed). Default: 0 |
| page_size | int | Number of results per page. Default: 25 |
| include_already_added | bool | Include inferences already added to datasets. Default: False |
| show_hidden | bool | Show hidden inferences. Default: False |
Get prediction statistics
Get statistics about predictions made with a model:
stats = client.get_inference_stats(my_model.id)| Parameter | Type | Description |
|---|---|---|
| model_id | str | The model id |