get_predictions_once()¶
This async method returns the model’s predictions just once at the
moment it is called. It is used when the model is activated with
continues_msg in False. In this manner, the server does not
continually publish predictions to a topic; instead, it waits for the
prediction retrieval service to be called.
Reference¶
Arguments¶
Arguments |
Type |
Default value |
Description |
|---|---|---|---|
as_dict |
|
|
If set to
|
get_timestamp |
|
|
If set to
|
Return¶
if as_dict is True and get_timestamp is True:
Type |
Description |
|---|---|
|
( |
if as_dict is True and get_timestamp is False:
Type |
Description |
|---|---|
|
Dictionary with prediccions. |
if as_dict is False and get_timestamp is True:
Type |
Description |
|---|---|
|
( |
if as_dict is False and get_timestamp is False:
Type |
Description |
|---|---|
|
List with prediccions. |
Exceptions¶
None
See the complete list of cv exceptions.
Examples¶
...
self.predictor = await self.cv.enable_model(
name='predictor_name',
continues_msg=False,
source='chest',
)
...
last_predictions, timestamp = \
await self.predictor.get_predictions_once(get_timestamp=True)
...