// Get the following values from portal :
blob_storage_Connection_String = ""
Cognitive_Service_key = ""
Cognitive_Service_endpoint = ""
container_name = "testcontainer"
storage_account_name = ""
blob_service_client = BlobServiceClient.from_connection_string(blob_storage_Connection_String)
computervision_client = ComputerVisionClient(Cognitive_Service_endpoint, CognitiveServicesCredentials(Cognitive_Service_key))
container_client = blob_service_client.get_container_client(container_name)
// List of Blobs
blob_list = container_client.list_blobs()
for blob in blob_list:
blob_url = "https://"+storage_account_name+".blob.core.windows.net/"+container_name+"/"+blob.name
read_response = computervision_client.read(blob_url, raw=True)
read_operation_location = read_response.headers["Operation-Location"]
operation_id = read_operation_location.split("/")[-1]
while True:
read_result = computervision_client.get_read_result(operation_id)
if read_result.status not in ['notStarted', 'running']:
break
time.sleep(1)
for textresult in read_result.analyze_result.read_results:
for line in textresult.lines:
print("Text: ",line.text)
print("Confidence: ", line.appearance.style.confidence)
1条答案
按热度按时间6rvt4ljy1#
1.在这里我安装了以下打包
1.蓝色存储blob
1.蓝色-认知服务-视觉-计算机视觉
使用
pip install <Package Name>
输出:
xlwt
模块在excel工作表中添加line.text
和line.appearance.style.confidence
。在向excel添加数据时,请参考aishwarya.27
。