mirror of
https://github.com/hanzo-ml/kserve.git
synced 2026-10-30 20:53:49 +00:00
* Fix python linter Signed-off-by: Sivanantham Chinnaiyan <[email protected]> * Format e2e tests Signed-off-by: Sivanantham Chinnaiyan <[email protected]> * Format hack, docs Signed-off-by: Sivanantham Chinnaiyan <[email protected]> * Add py-fmt target Signed-off-by: Sivanantham Chinnaiyan <[email protected]> * Update python lint workflow Signed-off-by: Sivanantham Chinnaiyan <[email protected]> * Rebase master Signed-off-by: Sivanantham Chinnaiyan <[email protected]> --------- Signed-off-by: Sivanantham Chinnaiyan <[email protected]>
21 lines
480 B
Python
Executable File
21 lines
480 B
Python
Executable File
#!/usr/bin/python3
|
|
import os
|
|
import argparse
|
|
import json
|
|
import cv2
|
|
from img_preprocess import preprocess
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("filename", help="converts image to json request", type=str)
|
|
args = parser.parse_args()
|
|
|
|
input_file = args.filename
|
|
|
|
img = preprocess(cv2.imread(input_file))
|
|
|
|
request = {"instances": img.tolist()}
|
|
|
|
output_file = os.path.splitext(input_file)[0] + ".json"
|
|
with open(output_file, "w") as out:
|
|
json.dump(request, out)
|