简体   繁体   中英

How to perform Azure Databricks with Form Recognizer

I am trying to use the Azure Form Recognizer in Databricks. every time I am getting invalid error.

I followed this link

My code does not provide any output:

Can someone please help?

Yes, you can use OCR extract data from PDFs

When I try to connect blob storage I got similar kind of error, Please follow below approach.

Code:

Install these packages:

pip install azure.storage.blob 
pip install azure.ai.formrecognizer 

Connect to azure databricks to azure storage account

from azure.storage.blob import ContainerClient

url = "https://<formrecognizer_name>.blob.core.windows.net/<folder_name>"
container = ContainerClient.from_container_url(container_url)

for blob in container.list_blobs():
    blob_url = url + "/" + blob.name
    print(blob_url)

Enable Congitive Services:

import requests
from azure.ai.formrecognizer import FormRecognizerClient
from azure.core.credentials import AzureKeyCredential

endpoint = "<cognitiveServices_Endpoint>"
key = "<cognitiveServices_Key>"

form_recognizer_client = FormRecognizerClient(endpoint=endpoint, credential=AzureKeyCredential(key))

For more information refer this SO thread and Github link .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM