如何通过curl和python读取将图像文件发送到googlecloud函数?
我想通过curl向google cloud函数发送一个image.png文件,并对其进行keras模型预测。(此处未指定模型…) 我看过各种各样的线索,但没有一条完全符合我的问题。(就像这个:我不想把文件保存在云存储中…)关键的部分是从google cloud函数上python环境中给定的“request”对象中获取“image”实例如何通过curl和python读取将图像文件发送到googlecloud函数?,python,image,function,curl,cloud,Python,Image,Function,Curl,Cloud,我想通过curl向google cloud函数发送一个image.png文件,并对其进行keras模型预测。(此处未指定模型…) 我看过各种各样的线索,但没有一条完全符合我的问题。(就像这个:我不想把文件保存在云存储中…)关键的部分是从google cloud函数上python环境中给定的“request”对象中获取“image”实例 # the request instance is automatically created by google cloud functions # in a
# the request instance is automatically created by google cloud functions
# in advance
def print_prediction(request):
result = 'Hello, you are looking good today!'
if request.method == 'POST':
image_raw = [request.form.get('image')]
result = 'show me whats in there'... + str(request) + str(image_raw)
return result
当我通过以下命令传递图像文件时,我希望“request”变量(在google cloud函数中自动从请求传递到python环境中)具有类似“image”的属性,我可以通过request.form.get()提取这些属性
curl--form'image=@path\u to\u image/some\u image.png'
为了了解请求对象具有哪些属性,我尝试了对象的各种打印,但我无法控制自己
执行curl命令后,上述函数的输出为:
“给我看看里面有什么http://europe-west1-chris-weather-app-1.cloudfunctions.net/“[发布]>[无]”
所以我想我根本没有从请求中提取任何东西。当我使用变量(请求)作为输出时,它也没有帮助