
TrWebOCR基于开源项目https://github.com/myhub/tr%E6%9E%84%E5%BB%BA%EF%BC%8C%E6%8F%90%E4%BE%9BHTTP%E8%B0%83%E7%94%A8%E6%8E%A5%E5%8F%A3%E4%BE%BF%E4%BA%8E%E5%85%B6%E4%BB%96%E9%A1%B9%E7%9B%AE%E9%9B%86%E6%88%90%EF%BC%8C%E5%B9%B6%E9%99%84%E5%B8%A6%E6%98%93%E7%94%A8%E7%9A%84Web%E9%A1%B5%E9%9D%A2%E7%94%A8%E4%BA%8E%E8%B0%83%E8%AF%95%E6%88%96%E6%97%A5%E5%B8%B8%E4%BD%BF%E7%94%A8%EF%BC%8C%E6%98%AF%E4%B8%80%E6%AC%BE%E9%AB%98%E6%95%88%E7%9A%84%E7%A6%BB%E7%BA%BFOCR%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E3%80%82
!web页面
适用于需要离线OCR功能的项目集成、日常文字识别需求、文档内容提取、验证码识别等场景。支持Linux直接部署或通过Docker在Windows、MacOS系统使用。
Windows和MacOS系统需通过构建Docker镜像使用,暂不支持直接部署;其他Linux平台未测试,可自行尝试。
安装Python 3.7
推荐使用miniconda管理环境
安装依赖包
shellpip install -r requirements.txt
运行服务
默认运行在8089端口,默认不开启GPU:
shellpython backend/main.py [--port=8089][--open_gpu=0] # --port 指定运行端口,默认8089 # --open_gpu 是否开启GPU,默认0(不开启),可设为1(开启)
成功运行后输出示例:
shelltr 2.3.0 https://github.com/myhub/tr Server is running: http://192.168.31.95:8089 Now version is: cpu
方式1:通过Dockerfile构建
shell# 构建镜像 docker build -t trwebocr:latest . # 运行容器 docker run -itd --rm -p 8089:8089 --name trwebocr trwebocr:latest
方式2:从Dockerhub拉取
shell# 拉取镜像 docker pull mmmz/trwebocr:latest # 运行容器 docker run -itd --rm -p 8089:8089 --name trwebocr mmmz/trwebocr:latest
说明:容器8089端口默认映射到物理机8089端口,若无需端口映射,可去掉
-p 8089:8089,通过Docker IP加8089端口访问。
详细接口文档请参考项目wiki:https://github.com/alisen39/TrWebOCR/wiki/%E6%8E%A5%E5%8F%A3%E6%96%87%E6%A1%A3
pythonimport requests url = 'http://192.168.31.108:8089/api/tr-run/' img1_file = { 'file': open('img1.png', 'rb') } res = requests.post(url=url, data={'compress': 0}, files=img1_file)
pythonimport requests import base64 def img_to_base64(img_path): with open(img_path, 'rb')as read: b64 = base64.b64encode(read.read()) return b64 url = 'http://192.168.31.108:8089/api/tr-run/' img_b64 = img_to_base64('./img1.png') res = requests.post(url=url, data={'img': img_b64})
!文档识别
!验证码识别
https://github.com/alisen39/TrWebOCR/blob/master/updateHistory.md
Apache 2.0
感谢https://github.com/myhub%E5%8F%8A%E5%85%B6%E5%BC%80%E6%BA%90%E9%A1%B9%E7%9B%AEhttps://github.com/myhub/tr
项目在https://github.com/alisen39/TrWebOCR%E5%92%8C%E7%A0%81%E4%BA%91%E5%90%8C%E6%AD%A5%E6%9B%B4%E6%96%B0%EF%BC%8C%E5%9B%BD%E5%86%85%E7%94%A8%E6%88%B7%E5%8F%AF%E9%80%9A%E8%BF%87%E7%A0%81%E4%BA%91%E5%85%8B%E9%9A%86%E9%A1%B9%E7%9B%AE%E3%80%82
如果喜欢本项目,欢迎点亮star (^.^)✨






探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务