Support external FunCaptcha ONNX fallback

This commit is contained in:
Hua
2026-03-12 19:53:51 +08:00
parent 221af67bf4
commit 201e517b86
7 changed files with 181 additions and 13 deletions

View File

@@ -143,6 +143,20 @@ uv run captcha export --model 4_3d_rollball_animals
uv run captcha predict-funcaptcha challenge.jpg --question 4_3d_rollball_animals
```
如果暂时没有训练数据,也可以直接复用外部 ONNX
```bash
FUNCAPTCHA_ROLLBALL_MODEL_PATH=/path/to/4_3d_rollball_animals.onnx \
uv run captcha predict-funcaptcha challenge.jpg --question 4_3d_rollball_animals
```
推理查找顺序为:
- `onnx_models/funcaptcha_rollball_animals.onnx`
- 环境变量 `FUNCAPTCHA_ROLLBALL_MODEL_PATH`
- 默认回退 `/mnt/data/code/python/funcaptcha-server/model/4_3d_rollball_animals.onnx`
不要把 ONNX 文件放到 `models/`;该目录用于 Python 模型定义源码,运行时模型产物应放在 `onnx_models/`
## HTTP API
```bash