我正在使用Python对Google的visionapi进行查询以从图像中获取标签,但是我无法设置超时,以防在给定的时间内没有收到响应。
我使用以下基于调用选项的Google's Documentation的代码。
这是我的代码:
class GoogleQuery():
def __init__(self, VisionTools):
self.client = vision.ImageAnnotatorClient()
self.QueryOptions = google.gax.CallOptions(timeout=0.1)
... more init fields
def QueryImage(self, frame):
image = types.Image(content=frame)
# Make query to Google
response = self.client.label_detection(image=image, options=self.QueryOptions)
我尝试过直接将这些论点传递给Google,但没有成功,比如:
^{pr2}$
目前没有回答
相关问题 更多 >
编程相关推荐