BentoML icon indicating copy to clipboard operation
BentoML copied to clipboard

feat: restrict mime types on Image IO descriptor

Open ssheng opened this issue 2 years ago • 1 comments

Allow only a subset of image mime types and reject the rest.

@api(input=Image(mime_type=['image/jpeg', 'image/png'], validate=True), output=JSON())
def predict(input_image: PIL.Image.Image) -> dict:
  ...

ssheng avatar Aug 31 '22 20:08 ssheng

Potentially extend the validation to all IO descriptors for mime_types.

ssheng avatar Sep 02 '22 03:09 ssheng