← 返回 Skills 市场
jfxia

汉字书法字体识别

作者 jfxia · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
271
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install chinese-calligraphy-recognition
功能描述
汉字书法字体识别技能。用于识别书法图片中的字体类型,包括楷书、行书、草书、篆书、隶书等。 当用户上传书法图片并要求识别字体时触发此技能。 适用于书法作品鉴赏、古籍研究、书法学习、文物鉴定等场景。 模型地址: https://huggingface.co/spaces/jfxia/shufa
使用说明 (SKILL.md)

汉字书法字体识别技能

功能概述

本技能调用 HuggingFace Spaces 上的书法识别模型(jfxia/shufa)来识别书法图片中的字体类型。

支持的字体类型

根据书法识别模型,支持以下字体识别:

字体类型 说明
楷书 标准楷体,如欧阳询、颜真卿、柳公权字体
行书 行云流水,如王羲之、米芾字体
草书 狂放不羁,如怀素、张旭字体
篆书 大篆、小篆
隶书 汉隶风格
魏碑 魏碑体

使用方法

1. 图像输入

支持以下输入方式:

  • 直接上传图片:用户上传书法图片文件(PNG、JPG、JPEG、BMP 等格式)
  • 图片URL:提供图片的网络链接

2. API 调用

使用 HuggingFace Inference API 进行预测:

import requests

# 方法一:使用 HuggingFace Inference API
API_URL = "https://api-inference.huggingface.co/models/xiajingfeng/shufa"
headers = {"Authorization": "Bearer YOUR_API_TOKEN"}

def query(filename):
    with open(filename, "rb") as f:
        data = f.read()
    response = requests.post(API_URL, headers=headers, data=data)
    return response.json()

# 方法二:使用 HuggingFace Space (Gradio UI)
# 直接通过 HTTP 请求调用 Space 的 API
SPACE_URL = "https://xiajingfeng-shufa.hf.space"

3. 返回结果

模型返回识别结果,包括:

{
  "label": "行书",
  "confidence": 0.85,
  "scores": [
    {"label": "行书", "score": 0.85},
    {"label": "楷书", "score": 0.10},
    {"label": "草书", "score": 0.03},
    {"label": "篆书", "score": 0.01},
    {"label": "隶书", "score": 0.01}
  ]
}

识别流程

用户上传书法图片
    │
    ▼
图片预处理
    │
    ├── 格式转换
    ├── 尺寸调整
    └── 质量检查
    │
    ▼
调用识别模型
    │
    ├── API 请求
    ├── 模型推理
    └── 结果解析
    │
    ▼
返回识别结果
    │
    ├── 字体类型
    ├── 置信度
    └── 备选字体

使用示例

示例 1:识别上传的图片

用户输入

请识别这张书法图片是什么字体?

(上传书法图片)

处理流程

  1. 接收用户上传的图片
  2. 进行图片预处理
  3. 调用书法识别 API
  4. 返回识别结果

返回结果

识别结果:行书(置信度 85%)

备选字体:楷书(10%)、草书(3%)

示例 2:识别图片URL

用户输入

识别这个链接中的书法字体:https://example.com/calligraphy.jpg

处理流程

  1. 下载图片
  2. 调用识别 API
  3. 返回结果

注意事项

  1. 图片质量:识别效果与图片质量密切相关,建议使用清晰、完整的书法图片
  2. 图片内容:图片中应包含完整的汉字,避免只识别单个笔画
  3. 混合字体:如果图片中包含多种字体,模型会返回主要字体
  4. API 限制:注意 HuggingFace API 的调用频率限制

错误处理

错误类型 说明 处理方式
图片格式不支持 上传了不支持的图片格式 提示用户使用支持的格式
图片过大 图片超过 API 限制 自动压缩或提示用户
API 调用失败 网络问题或 API 不可用 重试或提示稍后重试
识别失败 模型无法识别 返回"无法识别"并说明原因

相关工具

本技能可能需要使用以下工具:

  • images_understand - 图片理解分析
  • extract_content_from_websites - 从网页提取图片
  • images_search_and_download - 搜索并下载图片
  • image_synthesize - 图片合成(生成书法风格图片)

扩展功能

除了基本的字体识别,还可以扩展以下功能:

  1. 字体风格分析:分析书法的具体风格特点
  2. 作者推断:根据风格推断可能的书法家
  3. 年代鉴定:估计书法作品的大致年代
  4. 临摹建议:提供临摹建议和学习路径
安全使用建议
This skill appears to implement calligraphy-font recognition, but there are two issues to check before installing or using it with real images: 1) Unknown mirror endpoint: The script uploads raw image bytes first to https://xjf123.dy.takin.cc/upload (an undocumented third‑party mirror) without authentication. Ask the author why this mirror is used and who operates it. Do not send sensitive or private images until you can verify the mirror's operator and privacy policy. Prefer using the official HuggingFace Space or the official Inference API. 2) Inconsistent provenance: SKILL.md and the code reference multiple different model/space names/URLs. Request the canonical model/space URL and ask the author to update the SKILL.md and code to consistently use the official endpoint. Prefer a workflow that requires your HuggingFace token (so uploads are intentional) and makes the HF Space the primary endpoint. Additional practical steps: - Test with non-sensitive sample images first. - Ask the maintainer to remove or make optional the mirror endpoint and to declare HF_TOKEN in requires.env if HF API usage is expected. - If you cannot verify the mirror's owner and purpose, avoid installing or using this skill for any images you consider private or sensitive. My confidence is medium: the behavior could be sloppy/benign (a convenience mirror) but the combination of inconsistent URLs and an unauthenticated external upload is enough to mark this as suspicious until clarified.
功能分析
Type: OpenClaw Skill Name: chinese-calligraphy-recognition Version: 1.0.0 The skill bundle is a legitimate tool for identifying Chinese calligraphy styles (e.g., Kai, Cao, Li) using image recognition. The core logic in `scripts/recognize.py` facilitates uploading images to HuggingFace Spaces or a documented mirror site (takin.cc) and downloading images from user-provided URLs. The metadata in `SKILL.md` includes standard AIGC provenance signatures (Minimax Agent AI), and the instructions are strictly aligned with the stated purpose without any signs of prompt injection or malicious intent.
能力评估
Purpose & Capability
Skill claims to perform calligraphy font recognition and the included script implements that (file/URL input, preprocessing, HTTP calls to model endpoints). However the code and SKILL.md reference several different HuggingFace model/space names (jfxia, xiajingfeng, xiajingfeng-shufa, jfxia-shufa) and an additional 'mirror' host — these naming/URL inconsistencies reduce provenance confidence.
Instruction Scope
The runtime instructions and script download images and POST raw image data to external endpoints. The script tries an undocumented mirror (https://xjf123.dy.takin.cc/upload) first with no token required, then falls back to a HuggingFace Space. Preferencing an unknown mirror that receives full image bytes is disproportionate for a model that appears to live on HuggingFace; this creates an exfiltration risk for sensitive images. The SKILL.md examples discuss different API hosts than the script uses, adding ambiguity.
Install Mechanism
No install spec — instruction-only plus a small script. Nothing is downloaded or installed by the skill itself, which limits installation risk.
Credentials
No required environment variables are declared, but the script optionally reads HF_TOKEN from the environment or accepts a token argument. The SKILL.md shows use of a HuggingFace bearer token but does not declare it in requires.env — the token usage is reasonable for the HF API but should be declared and made explicit. The more significant issue is that the mirror endpoint requires no token, allowing unauthenticated upload of user images.
Persistence & Privilege
Skill is not always:true, has no install hook or config writes, and does not request system‑wide privileges. Autonomous invocation is allowed (platform default) and not by itself a concern.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install chinese-calligraphy-recognition
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /chinese-calligraphy-recognition 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of 汉字书法字体识别技能 (shufa-recognition): - Recognizes Chinese calligraphy font types (楷书, 行书, 草书, 篆书, 隶书, 魏碑) from images. - Supports direct image upload and image URL inputs for recognition. - Integrates with HuggingFace Spaces model (jfxia/shufa) for inference. - Returns main detected font type, confidence score, and alternative font candidates. - Includes guidance for usage, input requirements, error handling, and potential extensions (style analysis, author inference, etc.). - Suitable for calligraphy appreciation, academic research, learning, and artifact authentication.
元数据
Slug chinese-calligraphy-recognition
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

汉字书法字体识别 是什么?

汉字书法字体识别技能。用于识别书法图片中的字体类型,包括楷书、行书、草书、篆书、隶书等。 当用户上传书法图片并要求识别字体时触发此技能。 适用于书法作品鉴赏、古籍研究、书法学习、文物鉴定等场景。 模型地址: https://huggingface.co/spaces/jfxia/shufa. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 271 次。

如何安装 汉字书法字体识别?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install chinese-calligraphy-recognition」即可一键安装,无需额外配置。

汉字书法字体识别 是免费的吗?

是的,汉字书法字体识别 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

汉字书法字体识别 支持哪些平台?

汉字书法字体识别 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 汉字书法字体识别?

由 jfxia(@jfxia)开发并维护,当前版本 v1.0.0。

💬 留言讨论