Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
kezhengjie committed Sep 25, 2024
1 parent b258a73 commit c622dcb
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 28 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.venv
build/
dist/
__pycache__/
__pycache__/
venv
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"configurations": [
{
"name": "Python: 当前文件",
"type": "python",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Python: FastAPI",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "uvicorn",
"args": [
Expand Down
99 changes: 77 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,82 @@
# captcha_solver_web
这是一个简单的验证码识别服务器,默认监听 127.0.0.1:8000

## 接口
Endpoint: /captcha
Method: POST
Content-Type: application/json
Body Example:
```json
{
"img": "iVBORw0KGgoAAAANSUhEUgAAAUAAAABICAIAAAAI1rskAAAIQ0lEQVR4nOzde1BTZ94H8OckJ9wvuQiBAGpAJSiaKniheK+83l63KrWd6W7XVu1029LRtZ29jLu61nVvnXa666wzdcd21kvHVXfrrtbWtlbdKkqlaqEC5X6JQAiEkECAXHfgpDEcwqVtYvLMfD9/Pc95fsn8mMzXnJzznJGtLTUTAKCTINANAMB3hwADUAwBBqAYAgxAMQQYgGIIMADFEGAAiiHAABRDgAEohgADUAwBBqAYAgxAMQQYgGIIMADFEGAAiiHAABRDgAEohgADUAwBBqAYAgxAMQQYgGIIMADFEGAAiiHAABRDgAEohgADUAwBBqAYAgxAMQQYgGIIMADF2EA3AIFntVkLS69+VVtiMOljImMXZObOzZgf6KZgXBjP/x+4TPtpq7FyeJFIGDZv4qZQNtLpdBQ1njRbDPx3IYKMhGUJ0VMJIRVt/23uKuOtK6VzlLK5fvob4P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HRTMIaxAzz4/GBfQ+edxJj0yBDv+9r15ia9WTNRrA5hI/zQJDwgJrPR7nCIo7ABlhrjCjAABCfstQCgGAIMQDEEGIBiCDAAxRBgAIohwAAUQ4ABKIYAA1AMAQagGAIMQDEEGIBiCDAAxRBgAIohwAAUQ4ABKIYAA1AMAQag2P8CAAD//zkBfy8qu4vrAAAAAElFTkSuQmCC"
}

[README](README.md) | [中文文档](README_zh_CN.md)

A simple HTTP server for solving captchas.
You can download the Windows version from the [release page](https://github.com/AlpsMonaco/captcha_solver_web/releases).
For Linux/Mac OS, you'll need to have `python` installed to run or package the server yourself.

## API Reference

### Endpoint

- URL: `/captcha`
- Method: `POST`
- Content-Type: `application/json`

### Request Body

| Parameter | Description |
| --------- | ----------------------------------- |
| img | Base64-encoded captcha image string |

### Example

For a captcha image, encode it in base64 and call the API:
![captcha](w8.png "captcha")

```bash
curl http://127.0.0.1:8000/captcha -XPOST -H "Content-Type: application/json" \
--data '{"img": "iVBORw0KGgoAAAANSUhEUgAAAUAAAABICAIAAAAI1rskAAAIQ0lEQVR4nOzde1BTZ94H8OckJ9wvuQiBAGpAJSiaKniheK+83l63KrWd6W7XVu1029LRtZ29jLu61nVvnXa666wzdcd21kvHVXfrrtbWtlbdKkqlaqEC5X6JQAiEkECAXHfgpDEcwqVtYvLMfD9/Pc95fsn8mMzXnJzznJGtLTUTAKCTINANAMB3hwADUAwBBqAYAgxAMQQYgGIIMADFEGAAiiHAABRDgAEohgADUAwBBqAYAgxAMQQYgGIIMADFEGAAiiHAABRDgAEohgADUAwBBqAYAgxAMQQYgGIIMADFEGAAiiHAABRDgAEohgADUAwBBqAYAgxAMQQYgGIIMADF2EA3AIFntVkLS69+VVtiMOljImMXZObOzZgf6KZgXBjP/x+4TPtpq7FyeJFIGDZv4qZQNtLpdBQ1njRbDPx3IYKMhGUJ0VMJIRVt/23uKuOtK6VzlLK5fvob4Pv4vOz6zw/u1OpbPQ/Onpb1WsGfFROSAtcXjMuQAP/h4gqbvd9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gJrPR7nCIo7ABlhrjCjAABCfstQCgGAIMQDEEGIBiCDAAxRBgAIohwAAUQ4ABKIYAA1AMAQagGAIMQDEEGIBiCDAAxRBgAIohwAAUQ4ABKIYAA1AMAQag2P8CAAD//zkBfy8qu4vrAAAAAElFTkSuQmCC"}'
```

**Response**:

```bash
>> {"result":"w8"}
```

## Project Setup

For Windows users,you could simply run the binary from [release page](https://github.com/AlpsMonaco/captcha_solver_web/releases).

```powershell
.\captcha_resolver.exe --host 127.0.0.1 --port 8000
```

### Initialize

#### Windows

```powershell
python -m venv venv
call venv\Scripts\activate
pip install -r requirements.txt
```
参数说明:
img: base64编码后的二进制图片数据

返回:
```json
{
"result":"w8"
}

#### Linux/Mac OS

```bash
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```

### Run the Server

#### Windows

```powershell
python -m uvicorn app:app --host 127.0.0.1 --port 8000
```

#### Linux/Mac OS

```bash
python -m uvicorn app:app --host 127.0.0.1 --port 8000
```

## 附录
您可以访问 127.0.0.1:8000/docs
访问接口文档并测试
## Credits

- [ddddocr](https://github.com/sml2h3/ddddocr)
- [uvicorn](https://github.com/encode/uvicorn)
80 changes: 80 additions & 0 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# captcha_solver_web

一个简单的验证码识别 HTTP 服务器。
你可以从[release page](https://github.com/AlpsMonaco/captcha_solver_web/releases) 下载 Windows 版本。
对于 Linux/Mac OS 系统,需要安装 python 运行或自行打包。

## API 参考

### 接口

- 路径: `/captcha`
- 请求方法: `POST`
- 内容类型: `application/json`

### Request Body

| 参数 | 描述 |
| ---- | ----------------------- |
| img | Base64 编码的验证码图片 |

### 示例

对于如下的验证码图片,先将其编码为 base64 后调用 API。
![captcha](w8.png "captcha")

```bash
curl http://127.0.0.1:8000/captcha -XPOST -H "Content-Type: application/json" \
--data '{"img": "iVBORw0KGgoAAAANSUhEUgAAAUAAAABICAIAAAAI1rskAAAIQ0lEQVR4nOzde1BTZ94H8OckJ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/PlDUcHJ4gTx66rM52L4T7DRtTY/tWmfs6Rql5sDOt85d+/fuLfsk0dIH2BqM12hnuUppdnx02vDjD0/+IffsUVbKeq8vfFj5pO86BH9Jjk/568t/i4mMHangpU075dIEpSIV6Q1aY/xMXZS6mXdEEpGUm/oUN5ZGpKTHL+YVKGJVMxJW+LRJ8Jcs1dzT+8/mzV0lFNy/JCliRYvUS9/Z9a4yMfW9K6cL8r2chUGQGO0UmnP05kvubZVCAbt57kFFbIZ7VW9ueqtws91h5aYiYdiW+YfiopT+7Bl8r6unq0ZT1WfpmxA7oVXfUtFQXlh6ddmcRzav2Rro1mA0YwfY1N9+5GZBp/leiDB8/aw9wx/N/6r14/+U7nc47eGimHz1q5OlWf5sGPzlnk7zm8O7KhrK7Hbbo4vzN6/emiBLDHRTMIaxAzz4/GBfQ+edxJj0yBDv+9r15ia9WTNRrA5hI/zQJDwgJrPR7nCIo7ABlhrjCjAABCfstQCgGAIMQDEEGIBiCDAAxRBgAIohwAAUQ4ABKIYAA1AMAQagGAIMQDEEGIBiCDAAxRBgAIohwAAUQ4ABKIYAA1AMAQag2P8CAAD//zkBfy8qu4vrAAAAAElFTkSuQmCC"}'
```

**返回结果:**:

```bash
>> {"result":"w8"}
```

## 项目设置

windows用户可以直接从[release page](https://github.com/AlpsMonaco/captcha_solver_web/releases)下载预编译好的二进制,然后直接运行。

```powershell
.\captcha_resolver.exe --host 127.0.0.1 --port 8000
```

### 初始化

#### Windows

```powershell
python -m venv venv
call venv\Scripts\activate
pip install -r requirements.txt
```

#### Linux/Mac OS

```bash
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```

### 运行服务器

#### Windows

```powershell
python -m uvicorn app:app --host 127.0.0.1 --port 8000
```

#### Linux/Mac OS

```bash
python -m uvicorn app:app --host 127.0.0.1 --port 8000
```

## Credits

- [ddddocr](https://github.com/sml2h3/ddddocr)
- [uvicorn](https://github.com/encode/uvicorn)
7 changes: 6 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import ddddocr
import base64
import uvicorn
import argparse

app = FastAPI()
app.add_middleware(
Expand Down Expand Up @@ -31,4 +32,8 @@ async def get_captcha(req: GetCaptchaRequest):


if __name__ == "__main__":
uvicorn.run(app="app:app")
parser = argparse.ArgumentParser("captcha resolver")
parser.add_argument("--host", help="host", default="127.0.0.1")
parser.add_argument("--port", help="port", default="8000")
args = parser.parse_args()
uvicorn.run(app="app:app", host=args.host, port=int(args.port))
4 changes: 2 additions & 2 deletions app.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ a = Analysis(
['app.py'],
pathex=[],
binaries=[],
datas=[('D:\github.com\captcha_solver_web\.venv\Lib\site-packages\ddddocr\common.onnx','ddddocr')],
datas=[('venv/Lib/site-packages/ddddocr/common.onnx','ddddocr'),('venv/Lib/site-packages/ddddocr/common_old.onnx','ddddocr')],
hiddenimports=[
'uvicorn.logging',
'uvicorn.loops',
Expand Down Expand Up @@ -40,7 +40,7 @@ exe = EXE(
a.zipfiles,
a.datas,
[],
name='app',
name='captcha_resolver',
debug=False,
bootloader_ignore_signals=False,
strip=False,
Expand Down
32 changes: 32 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
altgraph==0.17.4
annotated-types==0.7.0
anyio==4.6.0
click==8.1.7
colorama==0.4.6
coloredlogs==15.0.1
ddddocr==1.5.5
fastapi==0.115.0
flatbuffers==24.3.25
h11==0.14.0
humanfriendly==10.0
idna==3.10
mpmath==1.3.0
numpy==2.1.1
onnxruntime==1.19.2
opencv-python-headless==4.10.0.84
packaging==24.1
pefile==2024.8.26
pillow==10.4.0
protobuf==5.28.2
pydantic==2.9.2
pydantic_core==2.23.4
pyinstaller==6.10.0
pyinstaller-hooks-contrib==2024.8
pyreadline3==3.5.4
pywin32-ctypes==0.2.3
setuptools==75.1.0
sniffio==1.3.1
starlette==0.38.6
sympy==1.13.3
typing_extensions==4.12.2
uvicorn==0.30.6
Binary file added w8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c622dcb

Please sign in to comment.