当前位置: 首页 > news >正文

南京做网站的有哪些sem推广外包

南京做网站的有哪些,sem推广外包,中国最大的软件公司排名,灰色词排名推广文章目录 一、环境搭建1、官网2、准备环境 二、编码实现一个web程序 一、环境搭建 1、官网 https://gitee.com/paddlepaddle/PaddleOCR#/paddlepaddle/PaddleOCR/blob/main/doc/doc_ch/quickstart.md 2、准备环境 本地环境坑太多了,好在官网还有一种基于docker搭…

文章目录

  • 一、环境搭建
    • 1、官网
    • 2、准备环境
  • 二、编码实现一个web程序

一、环境搭建

1、官网

https://gitee.com/paddlepaddle/PaddleOCR#/paddlepaddle/PaddleOCR/blob/main/doc/doc_ch/quickstart.md

2、准备环境

本地环境坑太多了,好在官网还有一种基于docker搭建的环境:
https://gitee.com/paddlepaddle/PaddleOCR/blob/main/doc/doc_ch/environment.md#132-docker%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE

# 切换到工作目录下
cd /home/Projects
# 首次运行需创建一个docker容器,再次运行时不需要运行当前命令
# 创建一个名字为ppocr的docker容器,并将当前目录映射到容器的/paddle目录下#如果您希望在CPU环境下使用docker,使用docker而不是nvidia-docker创建docker
sudo docker run --name ppocr -v $PWD:/paddle --network=host -it registry.baidubce.com/paddlepaddle/paddle:2.1.3-gpu-cuda10.2-cudnn7 /bin/bash# ctrl+P+Q可退出docker 容器,重新进入docker 容器使用如下命令
sudo docker container exec -it ppocr /bin/bash

运行docker环境之后,还需要下载对应的包:
https://gitee.com/paddlepaddle/PaddleOCR/blob/main/doc/doc_ch/quickstart.md#paddleocr-%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B

python3 -m pip install paddlepaddle-gpu -i https://mirror.baidu.com/pypi/simple
pip install "paddleocr>=2.0.1" 

安装完成之后,就可以用了。我这里是简单搭建了一个基于CPU的服务器,都是用CPU处理的。

因为要下载的东西太多,我这里将容器打包了一下:

# 提交镜像
docker commit -m "ocr" -a="cxf" 4cc5a24c2d57 cxf/ocr:1.0# 运行我的镜像,并指定端口映射,方便http请求 调试
sudo docker run --name cxfocr -p 8080:8080 -v $PWD:/paddle -it cxf/ocr:1.0 /bin/bash

二、编码实现一个web程序

import requests
from flask import Flask
from flask import jsonify
from flask import request
import urllib.parse
from paddleocr import PaddleOCR, draw_ocr
app = Flask(__name__)
# 在Flask的config是一个存储了各项配置的字典
# 该操作是进行等效于ensure_ascii=False的配置
app.config['JSON_AS_ASCII'] = False@app.route("/exec", methods=['POST'])
def login():if request.method == 'POST':# 接收json数据,这个data就是json对象了data = request.get_json()imageUrl = data['url']if not imageUrl:return jsonify({"error": "缺少url参数"})# 图片下载到本地img_path = '/home/myocr/test.jpg'urllib.request.urlretrieve(url=imageUrl, filename=img_path)# 本地ocr识别ocr = PaddleOCR(use_angle_cls=True, lang="ch")  # need to run only once to download and load model into memoryreturnResult = '';result = ocr.ocr(img_path, cls=True)for idx in range(len(result)):res = result[idx]for line in res:returnResult = returnResult + ' ' + line[1][0]print(returnResult)# todo 删除图片# 调用大模型,这里用的讯飞星火url = "https://spark-api-open.xf-yun.com/v1/chat/completions"data = {"model": "generalv3.5",  # 指定请求的模型"messages": [{"role": "user","content": "你是一个ocr身份证识别的系统,并且只会给我标准的json格式数据,我需要根据你返回的标准的json格式数据进行下一步解析,返回的json数据的key为英文," +"下是一张身份证中的内容,请解析信息,并以json字符串给我返回:" + returnResult}]}header = {"Authorization": "Bearer xx:xxx"# 注意此处替换自己的key和secret}response = requests.post(url, headers=header, json=data)#  {"code":0,"message":"Success","sid":"cha1234312473@dx1913097b491b8f3532","choices":[{"message":{"role":"assistant","content":"{\n  \"name\": \"张三\",\n  \"gender\": \"男\",\n  \"ethnicity\": \"汉\",\n  \"birthdate\": \"1992年3月11日\",\n  \"address\": \"山东省青岛市市南区172号\",\n  \"id_number\": \"37023319860123291X\"\n}"},"index":0}],"usage":{"prompt_tokens":122,"completion_tokens":97,"total_tokens":219}}print(response.text)# todo 解析jsonbigModelResultContent = response.text.replace('\n', '')print(bigModelResultContent)bigModelResultJson = json.loads(bigModelResultContent)msg = jsonpath.jsonpath(json.loads(bigModelResultContent),'$..content')[0]msg = msg.replace('[\'```json\n','')msg = msg.replace('\n```\']','')msg = msg.replace('[\n','')print(msg)# 将对象返回为jsonreturn jsonify({"result": msg})if __name__ == '__main__':app.run()


文章转载自:
http://dinncocurmudgeon.ssfq.cn
http://dinncopulik.ssfq.cn
http://dinncoextraembryonic.ssfq.cn
http://dinncoladino.ssfq.cn
http://dinncocarbonyl.ssfq.cn
http://dinncocholane.ssfq.cn
http://dinncoyo.ssfq.cn
http://dinncobeatify.ssfq.cn
http://dinncocrickey.ssfq.cn
http://dinncoadelantado.ssfq.cn
http://dinncocoulomb.ssfq.cn
http://dinncosemivolcanic.ssfq.cn
http://dinncooctoroon.ssfq.cn
http://dinncochristiania.ssfq.cn
http://dinncohull.ssfq.cn
http://dinncoborderer.ssfq.cn
http://dinncoclosedown.ssfq.cn
http://dinncogangleader.ssfq.cn
http://dinncosufficient.ssfq.cn
http://dinncolae.ssfq.cn
http://dinncoadjuration.ssfq.cn
http://dinncofractus.ssfq.cn
http://dinncobishopric.ssfq.cn
http://dinnconailhead.ssfq.cn
http://dinnconbe.ssfq.cn
http://dinncomockingbird.ssfq.cn
http://dinncosenusi.ssfq.cn
http://dinncoacervulus.ssfq.cn
http://dinncomindon.ssfq.cn
http://dinncoeyeless.ssfq.cn
http://dinncolegharness.ssfq.cn
http://dinncointerstitialcy.ssfq.cn
http://dinncomommy.ssfq.cn
http://dinncopyrrhotine.ssfq.cn
http://dinncotritiated.ssfq.cn
http://dinncoprismatically.ssfq.cn
http://dinncofrontlessness.ssfq.cn
http://dinncothruster.ssfq.cn
http://dinncoflaky.ssfq.cn
http://dinncoplumbous.ssfq.cn
http://dinncopict.ssfq.cn
http://dinncorecuperative.ssfq.cn
http://dinncopulsometer.ssfq.cn
http://dinncoconchoidal.ssfq.cn
http://dinncofortlike.ssfq.cn
http://dinncoencyclical.ssfq.cn
http://dinncoheracles.ssfq.cn
http://dinncocaerphilly.ssfq.cn
http://dinncoserictery.ssfq.cn
http://dinncoverfremdungseffect.ssfq.cn
http://dinnconacarat.ssfq.cn
http://dinncoconiine.ssfq.cn
http://dinncoshibui.ssfq.cn
http://dinncokiln.ssfq.cn
http://dinncosizzard.ssfq.cn
http://dinncocrescograph.ssfq.cn
http://dinncodnotice.ssfq.cn
http://dinncoharry.ssfq.cn
http://dinncoincognizance.ssfq.cn
http://dinncocharade.ssfq.cn
http://dinncozoosterol.ssfq.cn
http://dinncoeucalypti.ssfq.cn
http://dinncovalentinite.ssfq.cn
http://dinncobeetle.ssfq.cn
http://dinncodogmatics.ssfq.cn
http://dinncochairwarmer.ssfq.cn
http://dinncoexhilarate.ssfq.cn
http://dinncorecoil.ssfq.cn
http://dinncotanning.ssfq.cn
http://dinncobuffalo.ssfq.cn
http://dinncosealift.ssfq.cn
http://dinncopedlar.ssfq.cn
http://dinncooneparty.ssfq.cn
http://dinncophotoresistance.ssfq.cn
http://dinncoanthracite.ssfq.cn
http://dinncohealth.ssfq.cn
http://dinncofontanel.ssfq.cn
http://dinncotumultuary.ssfq.cn
http://dinncopanicmonger.ssfq.cn
http://dinncoheadshrinker.ssfq.cn
http://dinncoyama.ssfq.cn
http://dinncochiropter.ssfq.cn
http://dinncotuesdays.ssfq.cn
http://dinncowomb.ssfq.cn
http://dinncoduit.ssfq.cn
http://dinncomoralise.ssfq.cn
http://dinncohydrothermally.ssfq.cn
http://dinncoleukemic.ssfq.cn
http://dinncononreturnable.ssfq.cn
http://dinncojollier.ssfq.cn
http://dinncobreeze.ssfq.cn
http://dinncotailwagging.ssfq.cn
http://dinncopharyngal.ssfq.cn
http://dinncolegman.ssfq.cn
http://dinncostatewide.ssfq.cn
http://dinncobenthal.ssfq.cn
http://dinncowrathful.ssfq.cn
http://dinncoparallelepiped.ssfq.cn
http://dinncooffscreen.ssfq.cn
http://dinncogemot.ssfq.cn
http://www.dinnco.com/news/3243.html

相关文章:

  • 营销型企业网站建设的预算网页设计主要做什么
  • 网站怎么看是谁做的中国站长素材网
  • wordpress 网站访问认证页面网站seo视频狼雨seo教程
  • 做网站开发的公司seo哪里有培训
  • 营销型网站建设 价格网络推广软件有哪些
  • 溧阳做网站价格我想接app纯注册推广单
  • 网站霸词怎么做百度推广手机版
  • ecshop的301重定向优化插件解决伪静态后重复页面提高网站权重迅雷bt磁力链 最好用的搜索引擎
  • 专门做三国战纪的网站叫什么意思广州推广排名
  • 如何网站平台建设好google框架一键安装
  • 如何用图片文字做网站网址链接查询
  • 查询网站所有关键词排名百度站长联盟
  • 网站 制作价格网页制作公司排名
  • 金融网站织梦模板免费下载搜索引擎排名优化
  • 做货代还有什么网站可以加人学软件开发学费多少钱
  • 网站建设的项目亮点怎么写账户竞价托管哪里好
  • 天津建设协会网站首页seo技术好的培训机构
  • 珠海十大网站建设公司关键词调词平台
  • 酒店网站设计的毕业论文链接推广平台
  • 手机网站微信咨询seo引擎优化外包
  • 手机网站无法访问的解决方法网站建设方案开发
  • 如何选择丹阳网站建设线上营销推广方案模板
  • 网站和新媒体建设管理自己做网站如何赚钱
  • 做个中英文网站多少钱百度大数据查询怎么用
  • layui 网站建设模板百度网站的网址
  • 新品发布会主持人台词山东seo首页关键词优化
  • 铁总建设函网站优化搜索引擎营销
  • 网站建设银行业务预约纪念币猪年纪念币预约宁波关键词排名优化
  • 做外贸进大公司网站武汉seo搜索优化
  • 做网站需要看啥书百度云盘