返回顶部
i

ifly-pdf&image-ocr讯飞PDF图像OCR

ifly-pdf&image-ocr skill supporting both image OCR (AI-powered LLM OCR) and PDF document recognition. Use when user asks to OCR images, extract text from images/PDFs, convert PDF to Word/Markdown, or perform any OCR tasks on images or PDFs. Supports multi-language text extraction, document layout understanding, and various output formats.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
165
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

ifly-pdf&image-ocr

ifly-pdf&image-ocr

基于讯飞先进识别API的AI驱动OCR服务,支持图像和PDF文档识别。

快速开始

图像OCR(大模型OCR)

bash

识别图像并提取文本


python3 scripts/image_ocr.py /path/to/image.jpg

保存结果到文件

python3 scripts/image_ocr.py /path/to/image.jpg -o output.txt

指定输出格式

python3 scripts/image_ocr.py /path/to/image.jpg --format json python3 scripts/image_ocr.py /path/to/image.jpg --format markdown

PDF OCR

bash

将PDF转换为Word(默认)


python3 scripts/pdf_ocr.py document.pdf

将PDF转换为Markdown

python3 scripts/pdf_ocr.py document.pdf --format markdown

将PDF转换为JSON

python3 scripts/pdf_ocr.py document.pdf --format json

从公开URL转换

python3 scripts/pdf_ocr.py --pdf-url https://example.com/doc.pdf --format word

配置

API凭证

讯飞开放平台获取凭证:

图像OCR:

  • - APPID:应用ID
  • APIKEY:用于身份验证的API密钥
  • API_SECRET:用于签名请求的API密钥

PDF OCR:

  • - APPID:应用ID
  • APISECRET:应用密钥(用于签名生成)

环境变量

bash

图像OCR和PDF OCR均需设置


export IFLYAPPID=yourappid

图像OCR需设置

export IFLYAPIKEY=yourapikey

PDF OCR需设置

export IFLYAPISECRET=yourapisecret

功能特性

图像OCR(大模型OCR)

  • - AI驱动:基于先进大模型的高精度OCR
  • 多格式输出:支持JSON、Markdown或两者同时输出
  • 版面理解:保留文档结构
  • 多语言支持:支持多种语言的文本提取
  • 图像预处理:自动旋转校正、去噪处理

PDF OCR

  • - AI驱动OCR:先进AI模型实现精确文本提取
  • 多种输出格式
- Word (.docx) - 可编辑的Word文档 - Markdown - 带格式的纯文本 - JSON - 结构化数据
  • - 大型PDF支持:每份文档最多100页
  • 逐页结果:可获取每页的独立结果
  • 下载链接:提供处理文件的直接链接

API参数

图像OCR参数

参数类型必填描述
image_path字符串图像文件路径
--format
字符串 | 否 | 输出格式:json、markdown、json,markdown(默认:json,markdown) | | --output | 字符串 | 否 | 将结果保存到文件 |

PDF OCR参数

参数类型必填描述
pdf_path字符串PDF文件路径
--pdf-url
字符串 | 否 | PDF文件的公开URL | | --format | 字符串 | 否 | 输出格式:word、markdown、json(默认:word) | | --no-poll | 标志 | 否 | 返回任务ID,不进行轮询 | | --poll-interval | 整数 | 否 | 轮询间隔(秒,最小5,默认:5) | | --max-wait | 整数 | 否 | 最大等待时间(秒,默认:300) |

*必须提供pdf_path或--pdf-url其中之一

身份验证

图像OCR(HMAC-SHA256)

使用HMAC-SHA256签名认证:

  1. 1. 生成RFC1123格式日期:EEE, dd MMM yyyy HH:mm:ss GMT
  2. 创建签名原文:host: {host}\\ndate: {date}\\nPOST {path} HTTP/1.1
  3. 计算签名:HMAC-SHA256(signature_origin, apiSecret)
  4. 构建授权:hmac username={apiKey}, algorithm=hmac-sha256, headers=host date request-line, signature={signature}
  5. 对授权信息进行Base64编码
  6. 作为查询参数发送:?authorization={auth}&host={host}&date={date}

PDF OCR(MD5 + HMAC-SHA1)

使用MD5 + HMAC-SHA1签名认证:

  1. 1. 生成时间戳(Unix纪元秒数)
  2. 计算auth = MD5(appId + timestamp)
  3. 计算signature = Base64(HMAC-SHA1(auth, apiSecret))
  4. 发送请求头:
- appId:应用ID - timestamp:时间戳(秒) - signature:生成的签名

重要提示:时间戳必须在服务器时间的5分钟范围内。

响应格式

图像OCR响应

json
{
header: {
code: 0,
message: success
},
payload: {
result: {
text: Base64编码的OCR文本...
}
}
}

PDF OCR启动响应

json
{
flag: true,
code: 0,
desc: 成功,
data: {
taskNo: 25082744936879,
status: CREATE,
tip: 任务创建成功
}
}

PDF OCR状态响应

json
{
flag: true,
code: 0,
desc: 成功,
data: {
taskNo: 25082759289333,
exportFormat: word,
status: FINISH,
downUrl: http://bjcdn.openstorage.cn/...,
tip: 已完成,
pageList: [...]
}
}

任务状态(PDF OCR)

状态描述
CREATE任务创建成功
WAITING
排队等待中 | | DOING | 处理中 | | FINISH | 已完成 | | FAILED | 失败 | | ANY_FAILED | 部分完成(部分页面失败) | | STOP | 已暂停 |

错误码

(。・ω・。) 嗨~遇到错误码了吗?来看看怎么解决吧~ ✧⁺⸜(●˙▾˙●)⸝⁺✧

平台通用错误码

错误码描述提示解决方案
10009输入数据无效(◎_◎;) 哎呀~数据格式不太对呢检查输入数据是否符合要求
10010
服务授权不足 | (╯°□°)╯︵ ┻━┻ 授权数量不足或已过期! | 提交工单联系客服 | | 10019 | 服务读取缓冲区超时 | (。-ω´-) session超时啦~ | 检查是否数据发送完毕但未关闭连接 | | 10043 | 系统调用音频解码错误 | (◎_◎;) 音频解码失败惹... | 检查aue参数,如果为speex,请确保音频是speex音频并分段压缩且与帧大小一致 | | 10114 | 会话超时 | (。-ω´-) 会话时间超时啦~ | 检查是否发送数据时间超过了60s | | 10139 | 参数无效 | (◎_◎;) 参数好像不太对呢 | 检查参数是否正确 | | 10160 | 解析请求JSON错误 | (◎_◎;) 请求数据格式有误~ | 检查请求数据是否是合法的json | | 10161 | 解析Base64字符串错误 | (◎_◎;) Base64解码失败啦 | 检查发送的数据是否使用base64编码了 | | 10163 | 参数校验错误 | (◎_◎;) 参数校验没通过呢 | 具体原因见详细的描述 | | 10200 | 读取数据超时 | (。-ω´-) 读取数据超时了~ | 检查是否累计10s未发送数据并且未关闭连接 | | 10222 | 上下文截止时间已超过 | (╯°□°)╯︵ ┻━┻ 出错啦! | 1.检查上传数据是否超过接口上限;2.SSL证书无效请提交工单 | | 10223 | 远程负载均衡:找不到有效地址 | (◎_◎;) 找不到服务节点呢 | 提交工单

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 ifly-pdf-image-ocr-1776184801 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 ifly-pdf-image-ocr-1776184801 技能

通过命令行安装

skillhub install ifly-pdf-image-ocr-1776184801

下载

⬇ 下载 ifly-pdf&image-ocr v1.0.0(免费)

文件大小: 10.79 KB | 发布时间: 2026-4-17 15:04

v1.0.0 最新 2026-4-17 15:04
Initial release of ifly-pdf&image-ocr skill.

- Provides AI-powered OCR for both images and PDF documents via iFlytek APIs.
- Supports multi-language text extraction with advanced document layout understanding.
- Outputs can be in Word (.docx), Markdown, or JSON formats.
- Allows conversion of PDF files to desired formats and extraction of text from images.
- Includes authentication details, API parameters, example usage, and detailed error codes.
- Supports both local files and public URL inputs for PDF processing.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部