Skip to content
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

[DOC] add examples of query with requests for adapters #1202

Merged
merged 2 commits into from
Oct 23, 2020

Conversation

bojiang
Copy link
Member

@bojiang bojiang commented Oct 22, 2020

Description

As title.

Motivation and Context

#1201

How Has This Been Tested?

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature and improvements (non-breaking change which adds/improves functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Code Refactoring (internal change which is not user facing)
  • Documentation
  • Test, CI, or build

Component(s) if applicable

  • BentoService (service definition, dependency management, API input/output adapters)
  • Model Artifact (model serialization, multi-framework support)
  • Model Server (mico-batching, dockerisation, logging, OpenAPI, instruments)
  • YataiService gRPC server (model registry, cloud deployment automation)
  • YataiService web server (nodejs HTTP server and web UI)
  • Internal (BentoML's own configuration, logging, utility, exception handling)
  • BentoML CLI

Checklist:

  • My code follows the bentoml code style, both ./dev/format.sh and
    ./dev/lint.sh script have passed
    (instructions).
  • My change reduces project test coverage and requires unit tests to be added
  • I have added unit tests covering my code change
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@codecov
Copy link

codecov bot commented Oct 22, 2020

Codecov Report

Merging #1202 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1202   +/-   ##
=======================================
  Coverage   65.98%   65.98%           
=======================================
  Files         135      135           
  Lines        8563     8563           
=======================================
  Hits         5650     5650           
  Misses       2913     2913           
Impacted Files Coverage Δ
bentoml/adapters/annotated_image_input.py 84.90% <ø> (ø)
bentoml/adapters/file_input.py 88.23% <ø> (ø)
bentoml/adapters/image_input.py 91.89% <ø> (ø)
bentoml/adapters/multi_file_input.py 97.77% <ø> (ø)
bentoml/adapters/multi_image_input.py 90.69% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 76ec5cf...dd4d828. Read the comment docs.


with open("test.jpg", "rb") as f:
image_bytes = f.read()
with open("anno.json", "rb") as f:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

give the user an alternative to use some in-memory data as the JSON annotation data?

e.g.

annotations = { "age": 10, "bar": "foo" }
anno_bytes = json.dumps(annotations).encode()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is definitely helpful! I think in many cases the annotation part of the request is created at runtime and not read from file.

import requests

with open("test.jpg", "rb") as f:
image_bytes = f.read()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly let's give the user another example to turn a PIL image object into a request?

pietermarsman
pietermarsman previously approved these changes Oct 22, 2020
Copy link

@pietermarsman pietermarsman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very helpful!

@parano parano merged commit 4efb41b into bentoml:master Oct 23, 2020
pncnmnp pushed a commit to MLH-Fellowship/BentoML that referenced this pull request Nov 1, 2020
* [DOC] add examples of query with requests for adapters

* add query example that post images from PIL Image
aarnphm pushed a commit to aarnphm/BentoML that referenced this pull request Jul 29, 2022
* [DOC] add examples of query with requests for adapters

* add query example that post images from PIL Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using requests is much more difficult for an AnnotatedImageInput than I expected
3 participants