{"id":29136366,"url":"https://github.com/openlistteam/ocr_api_server","last_synced_at":"2025-06-30T11:08:06.628Z","repository":{"id":299173272,"uuid":"1002267048","full_name":"OpenListTeam/ocr_api_server","owner":"OpenListTeam","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-21T09:59:29.000Z","size":156,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-21T10:32:05.770Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenListTeam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-15T04:50:10.000Z","updated_at":"2025-06-21T09:59:32.000Z","dependencies_parsed_at":"2025-06-21T10:34:04.545Z","dependency_job_id":"897a8e86-f4a8-4936-b380-da9d12861e64","html_url":"https://github.com/OpenListTeam/ocr_api_server","commit_stats":null,"previous_names":["suyunmeng/openlist-ocr-server","openlistteam/ocr_api_server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/OpenListTeam/ocr_api_server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenListTeam%2Focr_api_server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenListTeam%2Focr_api_server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenListTeam%2Focr_api_server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenListTeam%2Focr_api_server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenListTeam","download_url":"https://codeload.github.com/OpenListTeam/ocr_api_server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenListTeam%2Focr_api_server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262762466,"owners_count":23360330,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-30T11:08:04.866Z","updated_at":"2025-06-30T11:08:06.606Z","avatar_url":"https://github.com/OpenListTeam.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ocr_api_server\n使用ddddocr的最简api搭建项目，支持docker\n\n**建议python版本3.7-3.9 64位**\n\n再有不好好看文档的我就不管了啊！！！\n\n# 运行方式\n\n## 最简单运行方式\n\n```shell\n# 安装依赖\npip install -r requirements.txt -i https://pypi.douban.com/simple\n\n# 运行  可选参数如下\n# --port 9898 指定端口,默认为9898\n# --ocr 开启ocr模块 默认开启\n# --old 只有ocr模块开启的情况下生效 默认不开启\n# --det 开启目标检测模式\n\n# 最简单运行方式，只开启ocr模块并以新模型计算\npython ocr_server.py --port 9898 --ocr\n\n# 开启ocr模块并使用旧模型计算\npython ocr_server.py --port 9898 --ocr --old\n\n# 只开启目标检测模块\npython ocr_server.py --port 9898  --det\n\n# 同时开启ocr模块以及目标检测模块\npython ocr_server.py --port 9898 --ocr --det\n\n# 同时开启ocr模块并使用旧模型计算以及目标检测模块\npython ocr_server.py --port 9898 --ocr --old --det\n\n```\n\n## docker运行方式(目测只能在Linux下部署)\n\n```shell\ngit clone https://github.com/sml2h3/ocr_api_server.git\n# docker怎么安装？百度吧\n\ncd ocr_api_server\n\n# 修改entrypoint.sh中的参数，具体参数往上翻，默认9898端口，同时开启ocr模块以及目标检测模块\n\n# 编译镜像\ndocker build -t ocr_server:v1 .\n\n# 运行镜像\ndocker run -p 9898:9898 -d ocr_server:v1\n\n```\n\n# 接口\n\n**具体请看test_api.py文件**\n\n```python\n# 1、测试是否启动成功，可以通过直接GET访问http://{host}:{port}/ping来测试，如果返回pong则启动成功\n\n# 2、OCR/目标检测请求接口格式：\n\n# http://{host}:{port}/{opt}/{img_type}/{ret_type}\n# opt：操作类型 ocr=OCR det=目标检测 slide=滑块（match和compare两种算法，默认为compare)\n# img_type: 数据类型 file=文件上传方式 b64=base64(imgbyte)方式 默认为file方式\n# ret_type: 返回类型 json=返回json（识别出错会在msg里返回错误信息） text=返回文本格式（识别出错时回直接返回空文本）\n\n# 例子：\n\n# OCR请求\n# resp = requests.post(\"http://{host}:{port}/ocr/file\", files={'image': image_bytes})\n# resp = requests.post(\"http://{host}:{port}/ocr/b64/text\", data=base64.b64encode(file).decode())\n\n# 目标检测请求\n# resp = requests.post(\"http://{host}:{port}/det/file\", files={'image': image_bytes})\n# resp = requests.post(\"http://{host}:{port}/det/b64/json\", data=base64.b64encode(file).decode())\n\n# 滑块识别请求\n# resp = requests.post(\"http://{host}:{port}/slide/match/file\", files={'target_img': target_bytes, 'bg_img': bg_bytes})\n# jsonstr = json.dumps({'target_img': target_b64str, 'bg_img': bg_b64str})\n# resp = requests.post(\"http://{host}:{port}/slide/compare/b64\", files=base64.b64encode(jsonstr.encode()).decode())\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenlistteam%2Focr_api_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenlistteam%2Focr_api_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenlistteam%2Focr_api_server/lists"}