-
Notifications
You must be signed in to change notification settings - Fork 448
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
如何修改使http请求能支持传入图片的base64编码? #2476
Comments
哈哈,我之前也提过,让自己改。看你用的是什么模型,以图片分类为例,只需要修改preprocess模型中model.py的execute函数,将读取输入图片的格式修改为base64就可以了,如下所示: 获取输入的base64字符串input_tensor = pb_utils.get_input_tensor_by_name(request, self.input_names[0]) 解码 base64 字符串为图像image_bytes = base64.b64decode(base64_string) |
OK非常感谢,我试下 |
@KyleWang-Hunter 我修改代码后出现
|
是的哦,请求的时候需要修改"datatype" : "BYTES", 另外,preprocess模型的config.pbtxt文件的数据类型也需要修改 input [ output [ version_policy: { all { }}version_policy: { specific: { versions: [1,3]}}version_policy: { latest: { num_versions: 2}}instance_group [ The output of the model is configured in the same format as the inputoutput [ |
在http服务中传递list太慢了,如果希望datatype是base64编码,要如何修改代码?
The text was updated successfully, but these errors were encountered: