-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow submiting images alongside notes in the sdk #232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I tried it out and it was pretty straightforward. I wonder if we want to allow users to submit images in other formats (PIL and numpy) like we do in other situations, but it's not a big deal.
src/groundlight/client.py
Outdated
:param image_query: Either an ImageQuery object (returned from | ||
`submit_image_query`) or an image_query id as a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
returned from
submit_image_query
My understanding is that we encourage users to use ask_*
methods instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. Does 'ask_ml or similar method' sound better? ask_* feels a little cheeky
src/groundlight/experimental_api.py
Outdated
@@ -180,16 +181,26 @@ def get_notes(self, detector: Union[str, Detector]) -> Dict[str, Any]: | |||
det_id = detector.id if isinstance(detector, Detector) else detector | |||
return self.notes_api.get_notes(det_id) | |||
|
|||
def create_note(self, detector: Union[str, Detector], note: Union[str, NoteRequest]) -> None: | |||
def create_note(self, detector: Union[str, Detector], note: str, image: Union[str, None] = None) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I though Union
was replaced with |
, e.g. detector: str | Detector
. Maybe this doesn't work for some of the python versions we support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nailed it, we still support python before 3.10
# TODO: The openapi generator doesn't handle file submissions well at the moment, so we manually implement this | ||
# kwargs = {"image": img_bytes} | ||
# self.notes_api.create_note(det_id, note, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will we ever resolve this TODO? Or is it a permanent issue? If permanent I'm not sure you need to include how we would have solved it if the generator worked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I very much would like to resolve the issue, but it really just doesn't make sense to sink more time right now. This may be resolved in the openapi-generator project. It shouldn't affect us until we decide we want to start porting the SDK into other languages (so not very soon)
… into note_images
We previously allowed users to create text notes for detectors. (Notes allow users to provide additional instruction for their task, which can aid human reviewers and improve ML performance). Now users can attach an image as well!