{"id":19999158,"url":"https://github.com/mr-addict/captcha","last_synced_at":"2025-06-30T07:37:54.392Z","repository":{"id":107623856,"uuid":"544955031","full_name":"MR-Addict/captcha","owner":"MR-Addict","description":"Captcha识别器","archived":false,"fork":false,"pushed_at":"2023-05-29T07:19:56.000Z","size":20063,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-01T23:29:12.408Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://caelcaptcha.azurewebsites.net","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MR-Addict.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2022-10-03T14:27:50.000Z","updated_at":"2023-11-16T07:06:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"b5eaa155-fe95-4457-ad64-80d454dad580","html_url":"https://github.com/MR-Addict/captcha","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/MR-Addict/captcha","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MR-Addict%2Fcaptcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MR-Addict%2Fcaptcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MR-Addict%2Fcaptcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MR-Addict%2Fcaptcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MR-Addict","download_url":"https://codeload.github.com/MR-Addict/captcha/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MR-Addict%2Fcaptcha/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262732005,"owners_count":23355473,"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":"2024-11-13T05:10:51.931Z","updated_at":"2025-06-30T07:37:54.309Z","avatar_url":"https://github.com/MR-Addict.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Captcha 识别器 ![docker](https://github.com/MR-Addict/captcha/actions/workflows/docker.yml/badge.svg?branch=main)\n\n## 1. 如何搭建\n\n### 1.1 Docker 部署\n\n#### 1.1.1 一键部署\n\n一键部署：\n\n```bash\ndocker run --restart=unless-stopped -p 45547:45547 -d --name captcha mraddict063/captcha\n```\n\ndocker-compose 版：\n\n```bash\ndocker-compose up -d\n```\n\n#### 1.1.2 手动编译\n\n克隆文档：\n\n```bash\ngit clone https://github.com/MR-Addict/captcha.git\n```\n\n编译镜像：\n\n```bash\ndocker build -t captcha .\n```\n\n启动镜像：\n\n```bash\ndocker run --restart=always -p 45547:45547 -d --name captcha captcha\n```\n\n### 1.2 本地部署\n\n克隆文档：\n\n```bash\ngit clone https://github.com/MR-Addict/captcha.git\n```\n\n安装 python 依赖：\n\n```bash\npython install -r requirements\n```\n\n启动 App：\n\n```bash\nuvicorn index:app --reload\n```\n\n## 2. 如何使用\n\n### 2.1 使用 API 接口\n\n服务器请自行部署，API 接口用法如下：\n\n|  参数   |    值    |\n| :-----: | :------: |\n| method  |   post   |\n| captcha | 本地图片 |\n\n#### 2.1.1 curl\n\n```bash\ncurl -skL http://localhost:45547 -F captcha=@captcha.jpg\n```\n\n#### 2.1.2 python\n\n```python\nimport json\nimport requests\n\n\ndef decode_captcha(img_path):\n    files = {'captcha': open(img_path, 'rb')}\n    response = requests.post(\"http://localhost:45547\", files=files)\n    return json.loads(response.text)\n\n\nif __name__ == '__main__':\n    print(decode_captcha(\"image/path.jpg\"))\n```\n\n\u003e 注意：其他语言和脚本使用方法可自行查询参考\n\n### 2.2 使用 Web UI\n\n部署好服务器后，直接打开其本地 Web 地址上传图片即可：\n\n- [http://localhost:45547](http://localhost:45547)\n\n![captcha](images/captcha.png)\n\n## 3. 说明\n\n本项目核心 Captcha 识别使用了 ddddocr 的 Python 库，详细内容可参考 sml2h3 的[GitHub 项目](https://github.com/sml2h3/ddddocr)。\n\n另外本项目也使用了 sml2h3 的[ddddocr 训练项目](https://github.com/sml2h3/dddd_trainer)，来训练适合南京工业大学的校园网登录图形验证码。\n\n使用自己训练的模型，1000 张样本识别的成功率可保持在 100%。默认模型识别的成功率也很高，1000 张样本只有 6、7 张左右的错误。\n\n如果你想使用默认的模型，可以注释掉`src/index.py`中的有关 model 的内容：\n\n```python\nocr = ddddocr.DdddOcr(\n    beta=False,\n    show_ad=False,\n    import_onnx_path=\"model/captcha.onnx\", charsets_path=\"model/charsets.json\"\n)\n```\n\n目前南京工业大学校园网登录图形验证码大致如下：\n\n![Njtech-Captcha](images/5958.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-addict%2Fcaptcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmr-addict%2Fcaptcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-addict%2Fcaptcha/lists"}