paddleocr-skills 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +220 -220
  2. package/bin/paddleocr-skills.js +33 -20
  3. package/lib/copy.js +39 -39
  4. package/lib/installer.js +76 -70
  5. package/lib/prompts.js +67 -67
  6. package/lib/python.js +75 -75
  7. package/lib/verify.js +121 -121
  8. package/package.json +42 -42
  9. package/templates/.env.example +12 -12
  10. package/templates/{paddleocr-vl/references/paddleocr-vl → paddleocr-vl-1.5/references/paddleocr-vl-1.5}/layout_schema.md +64 -64
  11. package/templates/{paddleocr-vl/references/paddleocr-vl → paddleocr-vl-1.5/references/paddleocr-vl-1.5}/output_format.md +154 -154
  12. package/templates/{paddleocr-vl/references/paddleocr-vl → paddleocr-vl-1.5/references/paddleocr-vl-1.5}/vl_model_spec.md +157 -157
  13. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/_lib.py +780 -780
  14. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/configure.py +270 -270
  15. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/optimize_file.py +226 -226
  16. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/requirements-optimize.txt +8 -8
  17. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/requirements.txt +7 -7
  18. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/smoke_test.py +199 -199
  19. package/templates/{paddleocr-vl/scripts/paddleocr-vl → paddleocr-vl-1.5/scripts/paddleocr-vl-1.5}/vl_caller.py +232 -232
  20. package/templates/{paddleocr-vl/skills/paddleocr-vl → paddleocr-vl-1.5/skills/paddleocr-vl-1.5}/SKILL.md +481 -481
  21. package/templates/ppocrv5/references/ppocrv5/agent_policy.md +258 -258
  22. package/templates/ppocrv5/references/ppocrv5/normalized_schema.md +257 -257
  23. package/templates/ppocrv5/references/ppocrv5/provider_api.md +140 -140
  24. package/templates/ppocrv5/scripts/ppocrv5/_lib.py +635 -635
  25. package/templates/ppocrv5/scripts/ppocrv5/configure.py +346 -346
  26. package/templates/ppocrv5/scripts/ppocrv5/ocr_caller.py +684 -684
  27. package/templates/ppocrv5/scripts/ppocrv5/requirements.txt +4 -4
  28. package/templates/ppocrv5/scripts/ppocrv5/smoke_test.py +139 -139
  29. package/templates/ppocrv5/skills/ppocrv5/SKILL.md +272 -272
package/README.md CHANGED
@@ -1,220 +1,220 @@
1
- # PaddleOCR Skills
2
-
3
- One-command installer to add PaddleOCR Skills to your Claude Code project.
4
-
5
- ## Quick Start
6
-
7
- Install PaddleOCR Skills in your Claude Code project with a single command:
8
-
9
- ```bash
10
- npx paddleocr-skills
11
- ```
12
-
13
- The installer will:
14
- 1. Prompt you to select skills (PP-OCRv5 and/or PaddleOCR-VL)
15
- 2. Copy skill files to your project
16
- 3. Install Python dependencies
17
- 4. Guide you through API configuration
18
- 5. Verify the installation
19
-
20
- ## What's Included
21
-
22
- ### PP-OCRv5 (Text OCR)
23
- - Fast text recognition for images and documents
24
- - Adaptive quality modes (auto/fast/quality)
25
- - Supports URLs and local files
26
- - Confidence scoring and quality metrics
27
-
28
- ### PaddleOCR-VL (Document Parsing)
29
- - Advanced document structure analysis
30
- - Table, formula, and chart recognition
31
- - Layout detection (headers, footers, page numbers)
32
- - Complete document parsing with reading order
33
-
34
- ## Prerequisites
35
-
36
- - **Node.js**: 14.0.0 or higher
37
- - **Python**: 3.7 or higher
38
- - **Claude Code**: Installed and configured
39
- - **API Access**: Get your API credentials at [Baidu AI Studio](https://aistudio.baidu.com/paddleocr/task)
40
-
41
- ## Installation
42
-
43
- ### Interactive Mode (Recommended)
44
-
45
- ```bash
46
- npx paddleocr-skills
47
- ```
48
-
49
- The installer will guide you through:
50
- - Skill selection
51
- - Python dependency installation
52
- - API configuration
53
-
54
- ### Skip Configuration
55
-
56
- If you want to configure later:
57
-
58
- ```bash
59
- npx paddleocr-skills
60
- # Choose "No" when asked about configuration
61
- ```
62
-
63
- Then configure manually:
64
-
65
- ```bash
66
- # For PP-OCRv5
67
- python scripts/ppocrv5/configure.py
68
-
69
- # For PaddleOCR-VL
70
- python scripts/paddleocr-vl/configure.py
71
- ```
72
-
73
- ## Usage
74
-
75
- After installation, use the skills in your Claude Code session:
76
-
77
- ### PP-OCRv5 Example
78
-
79
- ```bash
80
- # Extract text from an image
81
- python scripts/ppocrv5/ocr_caller.py --file-url "https://example.com/image.jpg" --pretty
82
-
83
- # Save result to file
84
- python scripts/ppocrv5/ocr_caller.py --file-path "document.pdf" --output result.json --pretty
85
- ```
86
-
87
- ### PaddleOCR-VL Example
88
-
89
- ```bash
90
- # Parse a complex document
91
- python scripts/paddleocr-vl/vl_caller.py --file-url "https://example.com/paper.pdf" --pretty
92
-
93
- # Save result to file
94
- python scripts/paddleocr-vl/vl_caller.py --file-path "invoice.pdf" --output result.json --pretty
95
- ```
96
-
97
- ## Project Structure
98
-
99
- After installation, your project will have:
100
-
101
- ```
102
- your-project/
103
- ├── skills/
104
- │ ├── ppocrv5/
105
- │ │ └── SKILL.md
106
- │ └── paddleocr-vl/
107
- │ └── SKILL.md
108
- ├── scripts/
109
- │ ├── ppocrv5/
110
- │ │ ├── ocr_caller.py
111
- │ │ ├── configure.py
112
- │ │ ├── smoke_test.py
113
- │ │ └── requirements.txt
114
- │ └── paddleocr-vl/
115
- │ ├── vl_caller.py
116
- │ ├── configure.py
117
- │ ├── smoke_test.py
118
- │ └── requirements.txt
119
- ├── references/
120
- │ ├── ppocrv5/
121
- │ └── paddleocr-vl/
122
- └── .env.example
123
- ```
124
-
125
- ## Configuration
126
-
127
- ### Manual Configuration
128
-
129
- If you skipped auto-configuration, create a `.env` file:
130
-
131
- ```bash
132
- # Copy the example file
133
- cp .env.example .env
134
-
135
- # Edit with your credentials
136
- nano .env
137
- ```
138
-
139
- Add your API credentials:
140
-
141
- ```env
142
- # PP-OCRv5
143
- API_URL=https://your-api-url.aistudio-app.com/ocr
144
- TOKEN=your-token-here
145
-
146
- # PaddleOCR-VL
147
- VL_API_URL=https://your-vl-api-url.com/v1
148
- VL_TOKEN=your-vl-token-here
149
- ```
150
-
151
- ### Using Configuration Scripts
152
-
153
- ```bash
154
- # Configure PP-OCRv5
155
- python scripts/ppocrv5/configure.py --api-url "YOUR_URL" --token "YOUR_TOKEN"
156
-
157
- # Configure PaddleOCR-VL
158
- python scripts/paddleocr-vl/configure.py --api-url "YOUR_URL" --token "YOUR_TOKEN"
159
- ```
160
-
161
- ## Verification
162
-
163
- Test your installation:
164
-
165
- ```bash
166
- # Test PP-OCRv5
167
- python scripts/ppocrv5/smoke_test.py
168
-
169
- # Test PaddleOCR-VL
170
- python scripts/paddleocr-vl/smoke_test.py
171
- ```
172
-
173
- ## Troubleshooting
174
-
175
- ### Python Not Found
176
-
177
- Ensure Python is in your PATH:
178
-
179
- ```bash
180
- python --version
181
- ```
182
-
183
- If not found, install Python 3.7+ from [python.org](https://www.python.org/).
184
-
185
- ### API Configuration Error
186
-
187
- Get your API credentials:
188
-
189
- 1. Visit [Baidu AI Studio](https://aistudio.baidu.com/paddleocr/task)
190
- 2. Create a new task or use an existing one
191
- 3. Copy the API URL and TOKEN
192
- 4. Run the configuration script
193
-
194
- ### Permission Denied
195
-
196
- On Windows, run your terminal as Administrator if you encounter permission errors.
197
-
198
- ## Documentation
199
-
200
- Each skill includes comprehensive documentation:
201
-
202
- - **skills/ppocrv5/SKILL.md**: PP-OCRv5 usage guide
203
- - **skills/paddleocr-vl/SKILL.md**: PaddleOCR-VL usage guide
204
- - **references/**: Technical reference documentation
205
-
206
- ## License
207
-
208
- MIT
209
-
210
- ## Support
211
-
212
- For issues and questions:
213
- - GitHub Issues: [Report a bug](https://github.com/yourusername/PP-OCRv5-claude-code-Skill/issues)
214
- - Documentation: See `skills/*/SKILL.md` files
215
-
216
- ## Credits
217
-
218
- Built with:
219
- - [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) by PaddlePaddle
220
- - [Claude Code](https://claude.ai/claude-code) by Anthropic
1
+ # PaddleOCR Skills
2
+
3
+ One-command installer to add PaddleOCR Skills to your Claude Code project.
4
+
5
+ ## Quick Start
6
+
7
+ Install PaddleOCR Skills in your Claude Code project with a single command:
8
+
9
+ ```bash
10
+ npx paddleocr-skills
11
+ ```
12
+
13
+ The installer will:
14
+ 1. Prompt you to select skills (PP-OCRv5 and/or PaddleOCR-VL)
15
+ 2. Copy skill files to your project
16
+ 3. Install Python dependencies
17
+ 4. Guide you through API configuration
18
+ 5. Verify the installation
19
+
20
+ ## What's Included
21
+
22
+ ### PP-OCRv5 (Text OCR)
23
+ - Fast text recognition for images and documents
24
+ - Adaptive quality modes (auto/fast/quality)
25
+ - Supports URLs and local files
26
+ - Confidence scoring and quality metrics
27
+
28
+ ### PaddleOCR-VL (Document Parsing)
29
+ - Advanced document structure analysis
30
+ - Table, formula, and chart recognition
31
+ - Layout detection (headers, footers, page numbers)
32
+ - Complete document parsing with reading order
33
+
34
+ ## Prerequisites
35
+
36
+ - **Node.js**: 14.0.0 or higher
37
+ - **Python**: 3.7 or higher
38
+ - **Claude Code**: Installed and configured
39
+ - **API Access**: Get your API credentials at [Baidu AI Studio](https://aistudio.baidu.com/paddleocr/task)
40
+
41
+ ## Installation
42
+
43
+ ### Interactive Mode (Recommended)
44
+
45
+ ```bash
46
+ npx paddleocr-skills
47
+ ```
48
+
49
+ The installer will guide you through:
50
+ - Skill selection
51
+ - Python dependency installation
52
+ - API configuration
53
+
54
+ ### Skip Configuration
55
+
56
+ If you want to configure later:
57
+
58
+ ```bash
59
+ npx paddleocr-skills
60
+ # Choose "No" when asked about configuration
61
+ ```
62
+
63
+ Then configure manually:
64
+
65
+ ```bash
66
+ # For PP-OCRv5
67
+ python scripts/ppocrv5/configure.py
68
+
69
+ # For PaddleOCR-VL
70
+ python scripts/paddleocr-vl-1.5/configure.py
71
+ ```
72
+
73
+ ## Usage
74
+
75
+ After installation, use the skills in your Claude Code session:
76
+
77
+ ### PP-OCRv5 Example
78
+
79
+ ```bash
80
+ # Extract text from an image
81
+ python scripts/ppocrv5/ocr_caller.py --file-url "https://example.com/image.jpg" --pretty
82
+
83
+ # Save result to file
84
+ python scripts/ppocrv5/ocr_caller.py --file-path "document.pdf" --output result.json --pretty
85
+ ```
86
+
87
+ ### PaddleOCR-VL Example
88
+
89
+ ```bash
90
+ # Parse a complex document
91
+ python scripts/paddleocr-vl-1.5/vl_caller.py --file-url "https://example.com/paper.pdf" --pretty
92
+
93
+ # Save result to file
94
+ python scripts/paddleocr-vl-1.5/vl_caller.py --file-path "invoice.pdf" --output result.json --pretty
95
+ ```
96
+
97
+ ## Project Structure
98
+
99
+ After installation, your project will have:
100
+
101
+ ```
102
+ your-project/
103
+ ├── skills/
104
+ │ ├── ppocrv5/
105
+ │ │ └── SKILL.md
106
+ │ └── paddleocr-vl-1.5/
107
+ │ └── SKILL.md
108
+ ├── scripts/
109
+ │ ├── ppocrv5/
110
+ │ │ ├── ocr_caller.py
111
+ │ │ ├── configure.py
112
+ │ │ ├── smoke_test.py
113
+ │ │ └── requirements.txt
114
+ │ └── paddleocr-vl-1.5/
115
+ │ ├── vl_caller.py
116
+ │ ├── configure.py
117
+ │ ├── smoke_test.py
118
+ │ └── requirements.txt
119
+ ├── references/
120
+ │ ├── ppocrv5/
121
+ │ └── paddleocr-vl-1.5/
122
+ └── .env.example
123
+ ```
124
+
125
+ ## Configuration
126
+
127
+ ### Manual Configuration
128
+
129
+ If you skipped auto-configuration, create a `.env` file:
130
+
131
+ ```bash
132
+ # Copy the example file
133
+ cp .env.example .env
134
+
135
+ # Edit with your credentials
136
+ nano .env
137
+ ```
138
+
139
+ Add your API credentials:
140
+
141
+ ```env
142
+ # PP-OCRv5
143
+ API_URL=https://your-api-url.aistudio-app.com/ocr
144
+ TOKEN=your-token-here
145
+
146
+ # PaddleOCR-VL
147
+ VL_API_URL=https://your-vl-api-url.com/v1
148
+ VL_TOKEN=your-vl-token-here
149
+ ```
150
+
151
+ ### Using Configuration Scripts
152
+
153
+ ```bash
154
+ # Configure PP-OCRv5
155
+ python scripts/ppocrv5/configure.py --api-url "YOUR_URL" --token "YOUR_TOKEN"
156
+
157
+ # Configure PaddleOCR-VL
158
+ python scripts/paddleocr-vl-1.5/configure.py --api-url "YOUR_URL" --token "YOUR_TOKEN"
159
+ ```
160
+
161
+ ## Verification
162
+
163
+ Test your installation:
164
+
165
+ ```bash
166
+ # Test PP-OCRv5
167
+ python scripts/ppocrv5/smoke_test.py
168
+
169
+ # Test PaddleOCR-VL
170
+ python scripts/paddleocr-vl-1.5/smoke_test.py
171
+ ```
172
+
173
+ ## Troubleshooting
174
+
175
+ ### Python Not Found
176
+
177
+ Ensure Python is in your PATH:
178
+
179
+ ```bash
180
+ python --version
181
+ ```
182
+
183
+ If not found, install Python 3.7+ from [python.org](https://www.python.org/).
184
+
185
+ ### API Configuration Error
186
+
187
+ Get your API credentials:
188
+
189
+ 1. Visit [Baidu AI Studio](https://aistudio.baidu.com/paddleocr/task)
190
+ 2. Create a new task or use an existing one
191
+ 3. Copy the API URL and TOKEN
192
+ 4. Run the configuration script
193
+
194
+ ### Permission Denied
195
+
196
+ On Windows, run your terminal as Administrator if you encounter permission errors.
197
+
198
+ ## Documentation
199
+
200
+ Each skill includes comprehensive documentation:
201
+
202
+ - **skills/ppocrv5/SKILL.md**: PP-OCRv5 usage guide
203
+ - **skills/paddleocr-vl-1.5/SKILL.md**: PaddleOCR-VL usage guide
204
+ - **references/**: Technical reference documentation
205
+
206
+ ## License
207
+
208
+ MIT
209
+
210
+ ## Support
211
+
212
+ For issues and questions:
213
+ - GitHub Issues: [Report a bug](https://github.com/yourusername/PP-OCRv5-claude-code-Skill/issues)
214
+ - Documentation: See `skills/*/SKILL.md` files
215
+
216
+ ## Credits
217
+
218
+ Built with:
219
+ - [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) by PaddlePaddle
220
+ - [Claude Code](https://claude.ai/claude-code) by Anthropic
@@ -1,20 +1,33 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * PaddleOCR Skills Installer for Claude Code
5
- *
6
- * Entry point for npx paddleocr-skills
7
- */
8
-
9
- const { runInstaller } = require('../lib/installer');
10
-
11
- async function main() {
12
- try {
13
- await runInstaller();
14
- } catch (error) {
15
- console.error('\n❌ Installation failed:', error.message);
16
- process.exit(1);
17
- }
18
- }
19
-
20
- main();
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * PaddleOCR Skills Installer for Claude Code
5
+ *
6
+ * Usage:
7
+ * npx paddleocr-skills # Interactive (select skills)
8
+ * npx paddleocr-skills --all # Install both skills
9
+ * npx paddleocr-skills --ppocrv5 # Install PP-OCRv5 only
10
+ * npx paddleocr-skills --vl # Install PaddleOCR-VL 1.5 only
11
+ */
12
+
13
+ const { runInstaller } = require('../lib/installer');
14
+
15
+ function parseArgs() {
16
+ const args = process.argv.slice(2);
17
+ if (args.includes('--all')) return ['ppocrv5', 'paddleocr-vl-1.5'];
18
+ if (args.includes('--ppocrv5')) return ['ppocrv5'];
19
+ if (args.includes('--vl')) return ['paddleocr-vl-1.5'];
20
+ return null; // interactive mode
21
+ }
22
+
23
+ async function main() {
24
+ try {
25
+ const skills = parseArgs();
26
+ await runInstaller(skills);
27
+ } catch (error) {
28
+ console.error('\n❌ Installation failed:', error.message);
29
+ process.exit(1);
30
+ }
31
+ }
32
+
33
+ main();
package/lib/copy.js CHANGED
@@ -1,39 +1,39 @@
1
- const fs = require('fs-extra');
2
- const path = require('path');
3
-
4
- /**
5
- * Copy skill files from template to target directory
6
- */
7
- async function copySkillFiles(skills, targetDir) {
8
- const templateDir = path.join(__dirname, '../templates');
9
-
10
- for (const skill of skills) {
11
- const skillTemplateDir = path.join(templateDir, skill);
12
-
13
- // Copy scripts directory
14
- const scriptsSource = path.join(skillTemplateDir, 'scripts', skill);
15
- const scriptsTarget = path.join(targetDir, 'scripts', skill);
16
- await fs.copy(scriptsSource, scriptsTarget, { overwrite: false });
17
-
18
- // Copy skills directory
19
- const skillsSource = path.join(skillTemplateDir, 'skills', skill);
20
- const skillsTarget = path.join(targetDir, 'skills', skill);
21
- await fs.copy(skillsSource, skillsTarget, { overwrite: false });
22
-
23
- // Copy references directory if exists
24
- const referencesSource = path.join(skillTemplateDir, 'references', skill);
25
- if (await fs.pathExists(referencesSource)) {
26
- const referencesTarget = path.join(targetDir, 'references', skill);
27
- await fs.copy(referencesSource, referencesTarget, { overwrite: false });
28
- }
29
- }
30
-
31
- // Copy .env.example if it doesn't exist
32
- const envExampleSource = path.join(templateDir, '.env.example');
33
- const envExampleTarget = path.join(targetDir, '.env.example');
34
- if (await fs.pathExists(envExampleSource)) {
35
- await fs.copy(envExampleSource, envExampleTarget, { overwrite: false });
36
- }
37
- }
38
-
39
- module.exports = { copySkillFiles };
1
+ const fs = require('fs-extra');
2
+ const path = require('path');
3
+
4
+ /**
5
+ * Copy skill files from template to target directory
6
+ */
7
+ async function copySkillFiles(skills, targetDir) {
8
+ const templateDir = path.join(__dirname, '../templates');
9
+
10
+ for (const skill of skills) {
11
+ const skillTemplateDir = path.join(templateDir, skill);
12
+
13
+ // Copy scripts directory
14
+ const scriptsSource = path.join(skillTemplateDir, 'scripts', skill);
15
+ const scriptsTarget = path.join(targetDir, 'scripts', skill);
16
+ await fs.copy(scriptsSource, scriptsTarget, { overwrite: false });
17
+
18
+ // Copy skills directory
19
+ const skillsSource = path.join(skillTemplateDir, 'skills', skill);
20
+ const skillsTarget = path.join(targetDir, 'skills', skill);
21
+ await fs.copy(skillsSource, skillsTarget, { overwrite: false });
22
+
23
+ // Copy references directory if exists
24
+ const referencesSource = path.join(skillTemplateDir, 'references', skill);
25
+ if (await fs.pathExists(referencesSource)) {
26
+ const referencesTarget = path.join(targetDir, 'references', skill);
27
+ await fs.copy(referencesSource, referencesTarget, { overwrite: false });
28
+ }
29
+ }
30
+
31
+ // Copy .env.example if it doesn't exist
32
+ const envExampleSource = path.join(templateDir, '.env.example');
33
+ const envExampleTarget = path.join(targetDir, '.env.example');
34
+ if (await fs.pathExists(envExampleSource)) {
35
+ await fs.copy(envExampleSource, envExampleTarget, { overwrite: false });
36
+ }
37
+ }
38
+
39
+ module.exports = { copySkillFiles };