基于 Ollama 运行的 glm-ocr 模型,纯本地 OCR 工具,无需网络。
glm-ocr (通过 ollama pull glm-ocr 安装)ollama run glm-ocr "Text Recognition: /path/to/image.png"
import subprocess
result = subprocess.run(
["ollama", "run", "glm-ocr", f"Text Recognition: {image_path}"],
capture_output=True, text=True
)
print(result.stdout)
# 测试
ollama run glm-ocr "Text Recognition: /tmp/test-ocr.png"
# 你的实际图片
ollama run glm-ocr "Text Recognition: ~/Downloads/screenshot.png"
共 1 个版本