Skip to content

Better string representation for IQ result #165

@robotrapta

Description

@robotrapta

Currently if you try to print out an image-query result you get back from the SDK like this:

result = gl.ask_ml(detector, frame)
print(result)

You get something pretty nasty to read like this:

id='iq_2cHNunx4LvBid4lnEJrYKNbR' type=<ImageQueryTypeEnum.image_query: 'image_query'>
created_at=datetime.datetime(2024, 2, 12, 19, 6, 8, 889722, tzinfo=tzutc()) query='Is the door open?'
detector_id='det_2cHEfNOgWSsavUE4JIgM6BtE' result_type=<ResultTypeEnum.binary_classification:
'binary_classification'> result=ClassificationResult(confidence=0.8437289317084585, label=<Label.NO: 
'NO'>) metadata=None

Most of the time if somebody is printing this, they probably want to see the label and confidence, so those should be at the front much easier to find. A bunch can probably be simplified out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions