当我使用Forms Recognizer的 API 时,它返回了一个 JSON 文件。现在,我将表单识别器与 SDK 和 Python 结合使用,它返回的数据类型似乎是库 azure.ai.formrecognizer 中的特定数据类型。
有谁知道如何将从Form Recognizer SDK Python 获取的数据保存在 JSON 文件中,就像从Form Recognzier API收到的文件一样?
from azure.ai.formrecognizer import FormRecognizerClient
from azure.identity import ClientSecretCredential
client_secret_credential = ClientSecretCredential(tenant_id, client_id, client_secret)
form_recognizer_client = FormRecognizerClient(endpoint, client_secret_credential)
with open(os.path.join(path, file_name), "rb") as fd:
form = fd.read()
poller = form_recognizer_client.begin_recognize_content(form)
form_pages = poller.result()