日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

html调用接口_搜狗ocr识别接口

發布時間:2023/12/9 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 html调用接口_搜狗ocr识别接口 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

詳細情況在代碼中說明,如果不想自己使用TensorFlow,可使用下面接口

這是要識別的圖片:

最終識別的結果:

This is a lot of 12 point text to test the
ocr code and see if it works on all types
of file format.
The quick brown dog jumped over the
lazy fox.The quick brown dog jumped
over the lazy fox.The quick brown dog
jumped over the lazy fox.The quick
brown dog jumped over the lazy fox.

代碼塊:

# _*_ coding: utf-8 _*_ # Time: 2019.4.25 # Author: maxiaohui # Title 搜狗ocr識別接口 # 這個代碼涉及到抓包用的fiddlerimport requests # 庫文件def post_image():img = "one.png" # 圖片路徑files = {"pic_path": open(img, "rb")} # files # 類似data數據url = "http://pic.sogou.com/pic/upload_pic.jsp" # post的urlhtml = requests.post(url, files=files).text # requests 提交圖片print('html is ',html)get_content(html) # 結果是url就是圖片的url sougou 把本地圖片上傳到sougou服務器變成了他的圖片 調用解析函數把url傳入def get_content(keywords):url = "http://pic.sogou.com/pic/ocr/ocrOnline.jsp?query=" + keywords # keywords就是圖片url此方式為get請求ocrResult = requests.get(url).json() # 直接轉換為json格式contents = ocrResult['result'] # 類似字典 把result的value值取出來 是一個list然后里面很多json就是識別的文字for content in contents: # 遍歷所有結果print(content['content'].strip()) # strip去除空格 他返回的結果自帶一個換行post_image() # 調用上傳函數

總結

以上是生活随笔為你收集整理的html调用接口_搜狗ocr识别接口的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。