Token导航 LogoToken导航TokenDH.com
研究检索敏感数据clawhub未标认证来源可访问clear审计提醒

baiduocr-localfallback百度本地回退

Agent Skill

baiduocr-localfallback 用于查找、检索和筛选相关信息,适合在 OpenClaw 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

2,892

周安装

117

GitHub Stars

公开资料未说明

下载量

908
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:baiduocr-localfallback(百度本地回退)
来源仓库:https://github.com/xx235300/baiduocr-localfallback
安装命令:
openclaw skills install baiduocr-localfallback
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install baiduocr-localfallback

简介

提供超过 115 个百度 OCR API,具有自动 EasyOCR 本地回退、图像预处理、令牌缓存和自动重试以实现稳定的文本识别。

SKILL.md

BaiduOCR-LocalFallback

Disclaimer: 1. This project is not an official Baidu product and has no affiliation with Baidu. This project only provides a wrapper for Baidu OCR API; users must apply for a Baidu Cloud account and comply with Baidu's terms of service. 2. This project is 99% AI-generated. The AI's owner has no programming background. Please evaluate the project's feasibility before use.

115+ Baidu OCR API interfaces with EasyOCR local fallback — auto-switches to local recognition when the network is unstable.

Features

  • 115+ OCR APIs - General, ID cards, receipts, documents, education, and more
  • Local fallback - Integrates EasyOCR; auto-switches when Baidu OCR is unavailable
  • Image preprocessing - Auto compresses and converts to fit the 4MB limit
  • Token caching - access_token cached for 25 days
  • Auto retry - Retries 3 times on network fluctuations
  • Multiple config methods - Environment variables, config file, or interactive setup

Installation

One-click install

bash <(curl -s https://raw.githubusercontent.com/xx235300/BaiduOCR-LocalFallback/main/install.sh)

Manual install

# 1. Clone the repo
git clone https://github.com/xx235300/BaiduOCR-LocalFallback.git
cd BaiduOCR-LocalFallback

# 2. Install dependencies
pip3 install -r requirements.txt

# 3. Configure API credentials
python3 scripts/ocr.py --configure

Quick Start

from scripts.ocr import OCR

ocr = OCR()

# General text recognition
result = ocr.recognize(image="/path/to/image.jpg", api="general_basic")

# ID card recognition
result = ocr.recognize(image="/path/to/idcard.jpg", api="idcard", id_card_side="front")

# Handwriting (local fallback)
result = ocr.recognize(image="/path/to/handwriting.jpg", api="handwriting")

Supported APIs

General Text

APIDescription
generalGeneral text (with location)
general_basicGeneral text (basic)
accurateHigh-accuracy (with location)
accurate_basicHigh-accuracy (basic)

ID & Cards

APIDescription
idcardID card
bankcardBank card
passportPassport
business_licenseBusiness license

Receipts

APIDescription
receiptGeneral receipt
vat_invoiceVAT invoice
taxi_receiptTaxi receipt
train_ticketTrain ticket
invoiceInvoice

Handwriting / Documents

APIDescription
handwritingHandwriting recognition
tableTable recognition
formulaFormula recognition

More APIs (115+)

Run python3 scripts/ocr.py --show-apis for the full list.

Configuration

Method 1: Interactive

python3 scripts/ocr.py --configure

Method 2: Environment variables (recommended for security)

export BAIDU_OCR_API_KEY="<your_api_key>"
export BAIDU_OCR_SECRET_KEY="<your_secret_key>"

Method 3: Config file

mkdir -p ~/.openclaw/skills/BaiduOCR-LocalFallback
cat > ~/.openclaw/skills/BaiduOCR-LocalFallback/config.json << 'EOF'
{
  "api_key": "<your_api_key>",
  "secret_key": "<your_secret_key>"
}
EOF
chmod 600 ~/.openclaw/skills/BaiduOCR-LocalFallback/config.json

Response Format

{
  "words_result": [
    {"words": "Recognized text", "location": {"vertices": [{"x": 0, "y": 0}, ...]}}
  ],
  "words_result_num": 1,
  "fallback_info": {  // only present when using local fallback
    "engine": "EasyOCR",
    "message": "Baidu OCR unavailable, using local EasyOCR"
  }
}

Error Handling

from scripts.ocr import OCR
from scripts.baidu_client import BaiduOCRError

ocr = OCR()
try:
    result = ocr.recognize(image="/path/to/image.jpg")
except BaiduOCRError as e:
    print(f"Baidu OCR error: {e.error_code} - {e.error_msg}")
except Exception as e:
    print(f"Other error: {e}")

FAQ

Q: I have no coding experience, what should I do if an error occurs during use?

Just send the cloud document link to the AI and let it troubleshoot and find a solution on its own. Sample prompt:

Please troubleshoot and resolve the issue according to the skill usage documentation.
Skill Usage Documentation: https://my.feishu.cn/docx/Gjy0djSado5YqVxzO6ecYbOmn4g?from=from_copylink

Q: How to get Baidu OCR API credentials?

  1. Go to Baidu Cloud Console
  2. Search "OCR" or "文字识别"
  3. Create an app and enable the OCR services you need
  4. Get API Key and Secret Key from "My Apps"

Q: "Baidu OCR call failed" but no auto-switch to local fallback?

Check if fallback is disabled:

ocr = OCR(use_fallback=False)  # Fallback disabled

Q: EasyOCR initialization is slow?

First run requires downloading models (~100MB). Pre-initialize:

from scripts.local_ocr import local_ocr
local_ocr._init_reader()  # Warm up

Q: How to handle Base64 images?

import base64

# Read image and convert to Base64
with open("image.jpg", "rb") as f:
    img_base64 = base64.b64encode(f.read()).decode()

result = ocr.recognize(image=img_base64, api="general_basic")

Q: How to specify output format?

# Table - returns Excel
result = ocr.recognize(image="table.jpg", api="table", request_type="excel")

# Table - returns JSON
result = ocr.recognize(image="table.jpg", api="table", request_type="json")

Q: Web image recognition failed?

Web images must be publicly accessible. Ensure:

  1. Image URL is publicly reachable
  2. Firewall allows outbound 80/443
  3. Try downloading locally first

Q: How to disable SSL certificate verification (dev only)?

import os
os.environ['REQUESTS_CA_BUNDLE'] = '/path/to/ca-bundle.crt'

Performance Tips

  • First-time EasyOCR requires downloading models (~100MB), please be patient
  • Recommended image size under 2MB for best performance
  • Large images are auto-compressed and scaled
  • access_token is auto-cached and refreshed

Related Documents

Baidu Cloud Documentation Center

License

MIT © 2026 xx235300

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

70.32%
按下载量换算639

安全审计

VirusTotal

未展示

ClawScan

可疑

Static analysis

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills