0

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?

1 Answers1

0

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.

B. B. Naga Sai Vamsi
  • 2,386
  • 2
  • 3
  • 11