{"id":13815263,"url":"https://github.com/YinAoXiong/12306_code_server","last_synced_at":"2025-05-15T07:32:25.388Z","repository":{"id":37617146,"uuid":"212990622","full_name":"YinAoXiong/12306_code_server","owner":"YinAoXiong","description":"该仓库用于构建自托管的12306验证码识别服务器","archived":false,"fork":false,"pushed_at":"2023-05-01T21:16:39.000Z","size":2280,"stargazers_count":541,"open_issues_count":2,"forks_count":172,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-11-19T10:49:23.419Z","etag":null,"topics":["12306","docker","python","tensorflow"],"latest_commit_sha":null,"homepage":"https://12306.yinaoxiong.cn","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YinAoXiong.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}},"created_at":"2019-10-05T11:51:03.000Z","updated_at":"2024-10-11T04:54:03.000Z","dependencies_parsed_at":"2024-01-15T13:35:58.678Z","dependency_job_id":null,"html_url":"https://github.com/YinAoXiong/12306_code_server","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YinAoXiong%2F12306_code_server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YinAoXiong%2F12306_code_server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YinAoXiong%2F12306_code_server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YinAoXiong%2F12306_code_server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YinAoXiong","download_url":"https://codeload.github.com/YinAoXiong/12306_code_server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254296037,"owners_count":22047190,"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":["12306","docker","python","tensorflow"],"created_at":"2024-08-04T04:03:13.633Z","updated_at":"2025-05-15T07:32:20.364Z","avatar_url":"https://github.com/YinAoXiong.png","language":"Python","readme":"# 12306验证码识别服务器\r\n\r\n[![Uptime Robot status](https://img.shields.io/uptimerobot/status/m783635180-ab3d4772f147c2a3b92f8fe5)](https://stats.uptimerobot.com/oyKyLhjJQ/783635180) [![Uptime Robot ratio (30 days)](https://img.shields.io/uptimerobot/ratio/m783635180-ab3d4772f147c2a3b92f8fe5)](https://stats.uptimerobot.com/oyKyLhjJQ/783635180) [![Build Status](https://travis-ci.org/YinAoXiong/12306_code_server.svg?branch=master)](https://travis-ci.org/YinAoXiong/12306_code_server) [![Docker Pulls](https://img.shields.io/docker/pulls/yinaoxiong/12306_code_server)](https://hub.docker.com/r/yinaoxiong/12306_code_server)\r\n\r\n该项目用于构建自托管的12306验证码识别服务器，本项目的全部模型和部分代码来自于此项目 [easy12306](https://github.com/zhaipro/easy12306)，使用该项目构建的api符合 [12306购票小助手](https://github.com/testerSunshine/12306)云打码格式可以直接调用。\r\n\r\n提供一个部署好的线上版本, [https://12306.yinaoxiong.cn](https://12306.yinaoxiong.cn/),部署在腾讯云1核1G的学生机上不保证可用性,服务状态可以通过 [https://stats.uptimerobot.com/oyKyLhjJQ/783635180](https://stats.uptimerobot.com/oyKyLhjJQ/783635180)查看.\r\n\r\n\r\n\r\n## 接口规范\r\n\r\n### 请求\r\n\r\n- Method: **POST**\r\n- URL:  ```/verify/base64/```\r\n- Headers: Content-Type: application/x-www-form-urlencoded\r\n- Body: \r\n  imageFile=\u003eBase64 encoding of the image\r\n\r\n### 响应\r\n\r\n- Headers：Content-Type:application/json\r\n- Body：\r\n\r\n```json\r\n{\r\n    \"code\": 0,\r\n    \"data\": [\r\n        \"1\",  //答案图片的编号数组\r\n        \"3\"\r\n    ],\r\n    \"massage\": \"识别成功\"\r\n}\r\n{\r\n    \"code\": 1,\r\n    \"data\": [\r\n    ],\r\n    \"massage\": \"识别失败\"\r\n}\r\n```\r\n\r\n\r\n\r\n## python版本支持\r\n\r\n- [x] 3.5-3.7\r\n\r\n## 平台支持\r\n\r\n- [x] amd64\r\n- [x] arm64v8\r\n- [x] arm32v7\r\n\r\n其中arm平台建议通过docker运行\r\n\r\n## 部署\r\n\r\n### docker部署(推荐)\r\n\r\n使用docker可以使用如下命令快速部署:\r\n\r\n\r\n  ```shell\r\n  docker run -d -p 8080:80 --name 12306 yinaoxiong/12306_code_server\r\n  ```\r\n\r\n### docker-compose部署(推荐)\r\n\r\n\r\n```yaml\r\nversion: \"3\"\r\n\r\nservices:\r\n  code_12306:\r\n    image: yinaoxiong/12306_code_server\r\n    ports:\r\n      - 5002:80 #可以根据需要修改端口\r\n    environment:\r\n      - WORKERS=1 #gunicorn works 默认为1可以根据服务器配置自行调整\r\n    restart: always\r\n  \r\n```\r\n\r\n### 通过源码部署\r\n\r\n1. 克隆并进入项目\r\n\r\n   ```shell\r\n   git clone https://github.com/YinAoXiong/12306_code_server.git\r\n   cd 12306_code_server\r\n   ```\r\n\r\n2. 安装依赖 自行根据平台和python选择对应的tflite（下面的例子为amd64，python3.7，其他情况对应的下载地址见 [https://www.tensorflow.org/lite/guide/python](https://www.tensorflow.org/lite/guide/python)，可自行在requirements.txt中替换）\r\n\r\n   ```shell\r\n   pip3 install -r requirements.txt\r\n   ```\r\n\r\n3. 下载模型文件\r\n\r\n    ```shell\r\n    bash download_model.sh\r\n    ```\r\n    从GitHub下载慢的话可以选择执行下面的命令\r\n\r\n    ```shell\r\n    wget -c https://cdn.yinaoxiong.cn/models/image.model.tflite\r\n    wget -c https://cdn.yinaoxiong.cn/models/text.model.tflite\r\n    ```\r\n\r\n4. 运行 默认workers为1，使用80端口，可以自行修改 gunicorn.conf\r\n\r\n   ```shell\r\n   gunicorn app:app -c gunicorn.conf.py\r\n   ```\r\n\r\n不推荐在arm平台上使用源码部署,依赖安装有些麻烦.\r\n\r\n## 致谢\r\n\r\n- [easy12306](https://github.com/zhaipro/easy12306) 提供项目运行的model\r\n-  [12306购票小助手](https://github.com/testerSunshine/12306)源于该项目的一个issue\r\n- ~~[tensorflow-on-arm](https://github.com/lhelontra/tensorflow-on-arm)提供arm上运行的tensorflow python包~~ v1.1版本后开始使用tflite而非keras\r\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYinAoXiong%2F12306_code_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FYinAoXiong%2F12306_code_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYinAoXiong%2F12306_code_server/lists"}