Agent skill

ppocrv5

Use this skill when users need to extract text from images, PDFs, or documents. Supports URLs and local files, with adaptive quality modes. Returns structured JSON containing recognized text, confidence scores, and quality metrics.

Stars 129
Forks 41

Install this agent skill to your Project

npx add-skill https://github.com/zephyrwang6/myskill/tree/main/ppocrv5

SKILL.md

PP-OCRv5 API Skill

When to Use This Skill

Invoke this skill in the following situations:

  • Extract text from images (screenshots, photos, scans, charts)
  • Read text from PDF or document images
  • Perform OCR on any visual content containing text
  • Parse structured documents (invoices, receipts, forms, tables)
  • Recognize text in photos taken by mobile phones
  • Extract text from URLs pointing to images or PDFs

Do not use this skill in the following situations:

  • Plain text files that can be read directly with the Read tool
  • Code files or markdown documents
  • Tasks that do not involve image-to-text conversion

How to Use This Skill

Basic Workflow

  1. Identify the input source:

    • User provides URL: Use the --file-url parameter
    • User provides local file path: Use the --file-path parameter
    • User uploads image: Save it first, then use --file-path
  2. Execute OCR:

    bash
    python scripts/ocr_caller.py --file-url "URL provided by user" --pretty
    

    Or for local files:

    bash
    python scripts/ocr_caller.py --file-path "file path" --pretty
    
  3. Parse JSON response:

    • Check the ok field: true means success, false means error
    • Extract text: result.full_text contains all recognized text
    • Get quality: quality.quality_score indicates recognition confidence (0.0-1.0)
    • Handle errors: If ok is false, display error.message
  4. Present results to user:

    • Display extracted text in a readable format
    • If quality score is low (<0.5), alert the user
    • If structured output is needed, use result.pages[].items[] to get line-by-line data

Mode Selection

Always use --mode auto (default) unless the user explicitly requests otherwise:

User Request Use Mode Command Flag
Default/unspecified Auto (adaptive) --mode auto (or omit)
"Quick recognition" / "fast" Fast --mode fast
"High precision" / "accurate" Quality --mode quality

Auto mode (recommended): Automatically tries 1-3 times, progressively increasing correction levels, returning the best result.

Usage Mode Examples

Mode 1: Simple URL OCR

bash
python scripts/ocr_caller.py --file-url "https://example.com/invoice.jpg" --pretty

Mode 2: Local File OCR

bash
python scripts/ocr_caller.py --file-path "./document.pdf" --pretty

Mode 3: Fast Mode for Clear Images

bash
python scripts/ocr_caller.py --file-url "URL" --mode fast --pretty

Understanding the Output

The script outputs JSON structure as follows:

json
{
  "ok": true,
  "result": {
    "full_text": "All recognized text here...",
    "pages": [...]
  },
  "quality": {
    "quality_score": 0.85,
    "text_items": 42
  }
}

Key fields to extract:

  • result.full_text: Complete text for the user
  • quality.quality_score: 0.72+ is good, <0.5 is poor
  • error.message: If ok is false, provides error description

First-Time Configuration

If the user has not configured API credentials, run:

bash
python scripts/configure.py

This will prompt for:

  • API_URL: Paddle AI Studio endpoint
  • PADDLE_OCR_TOKEN: User's access token

Configuration is saved to the .env file, only needs to be configured once.

Error Handling

Configuration missing:

Error: API_URL not configured

→ Run python scripts/configure.py

Authentication failed (403):

error_code: PROVIDER_AUTH_ERROR

→ Token is invalid, reconfigure with correct credentials

Quota exceeded (429):

error_code: PROVIDER_QUOTA_EXCEEDED

→ Daily API quota exhausted, inform user to wait or upgrade

No text detected:

quality_score: 0.0, text_items: 0

→ Image may be blank, corrupted, or contain no text

Quality Interpretation

When presenting results to users, consider the quality score:

Quality Score Explanation to User
0.90 - 1.00 Excellent recognition quality
0.72 - 0.89 Good recognition quality (default target)
0.50 - 0.71 Fair recognition quality, may have some errors
0.00 - 0.49 Poor recognition quality or no text detected

If quality is below 0.5, mention to the user and suggest:

  • Try using --mode quality for better accuracy
  • Check if the image is clear and contains text
  • Provide a higher resolution image if possible

Advanced Options

Use only when explicitly requested by the user:

Include raw provider response (for debugging):

bash
python scripts/ocr_caller.py --file-url "URL" --return-raw-provider

Request visualization (show detection regions):

bash
python scripts/ocr_caller.py --file-url "URL" --visualize

Adjust auto mode parameters:

bash
python scripts/ocr_caller.py --file-url "URL" \
  --max-attempts 2 \
  --quality-target 0.80 \
  --budget-ms 20000

Reference Documentation

For in-depth understanding of the OCR system, refer to:

  • references/agent_policy.md - Auto mode strategy and quality scoring
  • references/normalized_schema.md - Complete output schema specification
  • references/provider_api.md - Provider API contract details

Load these reference documents into context when:

  • Debugging complex issues
  • User asks about quality scoring algorithm
  • Need to understand adaptive retry mechanism
  • Customizing auto mode parameters

Testing the Skill

To verify the skill is working properly:

bash
python scripts/smoke_test.py

This tests configuration and API connectivity.

Expand your agent's capabilities with these related and highly-rated skills.

zephyrwang6/myskill

start-work

每日工作启动助手。读取Obsidian收件箱、计划文件,提醒今日待办,询问内容创作计划,展示周计划进度,调用热点采集。触发词:"开始工作"、"开启新一天"、"今天做什么"。帮助用户快速进入高效工作状态。

129 41
Explore
zephyrwang6/myskill

doc-coauthoring

Guide users through a structured workflow for co-authoring documentation, articles, or long-form content. Use when user wants to write documentation, proposals, articles, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting articles, or using "co-authoring" workflow.

129 41
Explore
zephyrwang6/myskill

mem-query

AI个人记忆系统的记忆查询功能。检索各层级记忆文件,综合多层级信息回答用户问题。使用场景:(1) 用户问"我的记忆中关于XXX"时;(2) 用户询问自己的习惯/偏好/价值观时;(3) 需要基于用户历史提供建议时。该skill会自动检索L1-L4各层级,引用来源,给出基于记忆的个性化回答。

129 41
Explore
zephyrwang6/myskill

article-review

根据原文内容撰写深度文章评价/解读。当用户提供一篇文章、博客、公众号文章或任何长文内容,并要求生成评价、解读、读后感或二次创作内容时使用此技能。适用于:(1) 对技术文章、行业分析、年终总结等进行深度解读,(2) 提炼文章核心观点并用通俗语言重新表达,(3) 为社交媒体传播生成二次内容。

129 41
Explore
zephyrwang6/myskill

mem-record

AI个人记忆系统的记忆记录功能。自动从对话中提炼关键信息并记录到相应层级。使用场景:(1) 用户说"记录到记忆系统"、"记住这个"、"把这次对话记下来"时;(2) 检测到重要事件、决策、偏好表达时;(3) 用户完成重要任务或做出决策时。该skill会自动判断应该记录到L1情境层、L2行为层、L3认知层,还是建议更新L4核心层。

129 41
Explore
zephyrwang6/myskill

remotion-video

使用 Remotion 框架以编程方式创建视频。Remotion 让你用 React 组件定义视频内容,支持动画、字幕、音乐可视化、3D 视频、教程讲解视频等。适用于程序化视频、批量生成、数据驱动视频、音乐可视化、自动字幕等场景。

129 41
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results