Issue in SynapseML when connecting to Azure Form Recognizer

Ali Davoudian 61 Reputation points
2022-06-29T11:27:51.877+00:00

I am using the following Python code in a SPARK Pool notebook in Azure Synapse Analytics in order to connect to the Azure Form Recognizer service:

import synapse.ml
from synapse.ml.cognitive import *
cognitive_service_name = "CognitiveServiceFormRecognizer"
from pyspark.sql.functions import col, flatten, regexp_replace, explode, create_map, lit
emptyDf = spark.createDataFrame([("",)])

listCustomModels = (ListCustomModels()
.setLinkedService(cognitive_service_name)
.setOp("full")
.setOutputCol("models")
.setConcurrency(5))

(listCustomModels
.transform(emptyDf)
.withColumn("modelIds", col("models.modelList.modelId"))
.select("modelIds")).show()

But it returns an empty list. However, when I connect to the Form Recognizer via rest API, it returns the list of all models.

Source: https://video2.skills-academy.com/en-us/azure/synapse-analytics/machine-learning/tutorial-form-recognizer-use-mmlspark

I have already asked the question from the SynapseML Github (https://github.com/microsoft/SynapseML). No answer!!!!!

Please let me know, what should I do.
Another question: Is there any alternative for SynapseML in Synapse analytics?

Thanks for any help.

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,997 questions
Microsoft Configuration Manager
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.