OCR文字识别
调用百度免费的api接口实现,网络图片中文字的提取。
一.api接口文档
https://ai.baidu.com/tech/ocr_others/webimage
相关介绍不做赘述。
二.代码实现
import requests
import os
import json
import base64
import time
# 获取access_token
def getAccessToken():
URL = "https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials"
Api_key = 'api_key'
Secret_key = 'Secret_key'
requests_url = URL + '&client_id=' + Api_key + '&client_secret=' +Secret_key
respo