我在保存 Google Vision API 提供的输出时遇到问题。我正在使用 Python 并使用演示图像进行测试。我收到以下错误:
TypeError: [mid:...] + is not JSON serializable
Run Code Online (Sandbox Code Playgroud)
我执行的代码:
import io
import os
import json
# Imports the Google Cloud client library
from google.cloud import vision
from google.cloud.vision import types
# Instantiates a client
vision_client = vision.ImageAnnotatorClient()
# The name of the image file to annotate
file_name = os.path.join(
os.path.dirname(__file__),
'demo-image.jpg') # Your image path from current directory
# Loads the image into memory
with io.open(file_name, 'rb') as image_file:
content = image_file.read()
image = …Run Code Online (Sandbox Code Playgroud)