figcrop 0.1.0__tar.gz
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.
- figcrop-0.1.0/AGENTS.md +90 -0
- figcrop-0.1.0/CLAUDE.md +93 -0
- figcrop-0.1.0/CONNECTORS.md +117 -0
- figcrop-0.1.0/LICENSE +202 -0
- figcrop-0.1.0/MANIFEST.in +4 -0
- figcrop-0.1.0/NOTICE +19 -0
- figcrop-0.1.0/PKG-INFO +218 -0
- figcrop-0.1.0/README.md +184 -0
- figcrop-0.1.0/figcrop.egg-info/PKG-INFO +218 -0
- figcrop-0.1.0/figcrop.egg-info/SOURCES.txt +17 -0
- figcrop-0.1.0/figcrop.egg-info/dependency_links.txt +1 -0
- figcrop-0.1.0/figcrop.egg-info/entry_points.txt +3 -0
- figcrop-0.1.0/figcrop.egg-info/requires.txt +8 -0
- figcrop-0.1.0/figcrop.egg-info/top_level.txt +2 -0
- figcrop-0.1.0/figcrop_mcp.py +84 -0
- figcrop-0.1.0/figtools.py +1508 -0
- figcrop-0.1.0/pyproject.toml +50 -0
- figcrop-0.1.0/requirements-mcp.txt +3 -0
- figcrop-0.1.0/setup.cfg +4 -0
figcrop-0.1.0/AGENTS.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Agent Guide
|
|
2
|
+
|
|
3
|
+
Use this repo to extract publication figures from PDFs. Keep changes small and
|
|
4
|
+
verify outputs visually: figure extraction is geometry-heavy and regressions are
|
|
5
|
+
often only visible in the saved JPEGs.
|
|
6
|
+
|
|
7
|
+
## Important Paths
|
|
8
|
+
|
|
9
|
+
- Main tool: `figtools.py`
|
|
10
|
+
- Local venv on the development machine: `.venv\Scripts\python.exe`
|
|
11
|
+
- Output manifest: `figures.json` in each extraction output directory
|
|
12
|
+
- Model cache/IR: `models/`
|
|
13
|
+
|
|
14
|
+
## Common Commands
|
|
15
|
+
|
|
16
|
+
Windows:
|
|
17
|
+
|
|
18
|
+
```powershell
|
|
19
|
+
.\.venv\Scripts\python.exe figtools.py extract paper.pdf out auto
|
|
20
|
+
.\.venv\Scripts\python.exe figtools.py extract paper.pdf out auto figs=1,2
|
|
21
|
+
.\.venv\Scripts\python.exe figtools.py extract paper.pdf out auto caption=include
|
|
22
|
+
.\.venv\Scripts\python.exe figtools.py extract paper.pdf out auto trim=whiteband
|
|
23
|
+
.\.venv\Scripts\python.exe figtools.py serve auto
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Linux/macOS:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
.venv/bin/python figtools.py extract paper.pdf out auto
|
|
30
|
+
.venv/bin/python figtools.py serve auto
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
HTTP server request:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
curl -s -X POST http://127.0.0.1:8077/extract \
|
|
37
|
+
-H "Content-Type: application/json" \
|
|
38
|
+
-d '{"pdf":"paper.pdf","out_dir":"out","figs":[1,2],"caption_mode":"include"}'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Extraction Options
|
|
42
|
+
|
|
43
|
+
- `figs=1,2`: extract real figure numbers found from PDF text captions.
|
|
44
|
+
- `top=N`: fallback to the first N visual regions per page.
|
|
45
|
+
- `panels=true`: output detected regions/panels separately.
|
|
46
|
+
- `trim=mask`: default fast trim mode.
|
|
47
|
+
- `trim=whiteband`: slower local whitespace snap around the detector bbox.
|
|
48
|
+
- `caption=include`: include the matched caption text below the figure.
|
|
49
|
+
|
|
50
|
+
## Verification
|
|
51
|
+
|
|
52
|
+
Always inspect JPEG outputs, not just command success. At minimum:
|
|
53
|
+
|
|
54
|
+
1. Open a montage or representative outputs with `view_image`.
|
|
55
|
+
2. Check for cut-off axes, table borders, panel labels, and caption text.
|
|
56
|
+
3. Check for neighbor figure/table frame lines, section headings, or unrelated
|
|
57
|
+
fallback regions.
|
|
58
|
+
4. For `caption=include`, check that the caption is complete and that nearby
|
|
59
|
+
frame rules were not included.
|
|
60
|
+
5. Run `python -m py_compile figtools.py` after code changes.
|
|
61
|
+
|
|
62
|
+
Small one-shot extractions usually finish in a few seconds after model setup.
|
|
63
|
+
Use the server when repeatedly extracting from many PDFs or iterating on trim
|
|
64
|
+
logic.
|
|
65
|
+
|
|
66
|
+
## Implementation Notes
|
|
67
|
+
|
|
68
|
+
- Layout detection uses MinerU PP-DocLayoutV2. The OpenVINO IR has static
|
|
69
|
+
800x800 input, so detector edge errors are handled by trimming, not by raising
|
|
70
|
+
detector resolution.
|
|
71
|
+
- Numbering is local logic: PDF text captions are matched to nearby visual
|
|
72
|
+
regions. It is not MinerU's full reading-order pipeline.
|
|
73
|
+
- Default output is one crop per `Fig.N`; `panels=true` opts into region-level
|
|
74
|
+
output.
|
|
75
|
+
- `caption=include` first trims the figure body, then unions it with a tight
|
|
76
|
+
caption text-ink rectangle from the PDF text block. Long horizontal/vertical
|
|
77
|
+
caption-adjacent rules are ignored for the caption bbox.
|
|
78
|
+
- Very dense pages can still need `figs=`, `top=`, or manual review.
|
|
79
|
+
|
|
80
|
+
## Commit Attribution
|
|
81
|
+
|
|
82
|
+
If Codex makes commits in this repo, include:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
Co-authored-by: Codex <noreply@openai.com>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Do not add Codex attribution to commits that were authored by another agent or
|
|
89
|
+
by the user. If rewriting already-pushed history, create a backup branch first
|
|
90
|
+
and use `git push --force-with-lease`, never plain `--force`.
|
figcrop-0.1.0/CLAUDE.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# figcrop Guide for Claude Code
|
|
2
|
+
|
|
3
|
+
This repository contains a single-file tool, `figtools.py`, for extracting
|
|
4
|
+
figures from research-paper PDFs by real `Fig.N` / `Table N` captions.
|
|
5
|
+
|
|
6
|
+
Prefer the existing implementation style. The core behavior is geometry-heavy,
|
|
7
|
+
so do not judge changes only by tests or command success: render crops and look
|
|
8
|
+
at the images.
|
|
9
|
+
|
|
10
|
+
## Quick Commands
|
|
11
|
+
|
|
12
|
+
Windows development environment:
|
|
13
|
+
|
|
14
|
+
```powershell
|
|
15
|
+
.\.venv\Scripts\python.exe figtools.py help
|
|
16
|
+
.\.venv\Scripts\python.exe figtools.py extract paper.pdf out auto
|
|
17
|
+
.\.venv\Scripts\python.exe figtools.py extract paper.pdf out auto figs=1,2
|
|
18
|
+
.\.venv\Scripts\python.exe figtools.py extract paper.pdf out auto caption=include
|
|
19
|
+
.\.venv\Scripts\python.exe figtools.py extract paper.pdf out auto trim=whiteband
|
|
20
|
+
.\.venv\Scripts\python.exe figtools.py serve auto
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Server request:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
curl -s -X POST http://127.0.0.1:8077/extract \
|
|
27
|
+
-H "Content-Type: application/json" \
|
|
28
|
+
-d '{"pdf":"paper.pdf","out_dir":"out","figs":[1,2],"caption_mode":"include"}'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Options
|
|
32
|
+
|
|
33
|
+
- `figs=1,2`: extract real figure numbers from PDF text captions.
|
|
34
|
+
- `top=N`: fallback to first N visual regions per page.
|
|
35
|
+
- `panels=true`: output detected regions/panels separately.
|
|
36
|
+
- `trim=mask`: default fast trim mode.
|
|
37
|
+
- `trim=whiteband`: slower local whitespace snap mode.
|
|
38
|
+
- `caption=include`: include matched caption text below the figure.
|
|
39
|
+
|
|
40
|
+
API fields are `pdf`, `out_dir`, `figs`, `top`, `panels`, `trim_mode`, and
|
|
41
|
+
`caption_mode`.
|
|
42
|
+
|
|
43
|
+
## Verification Workflow
|
|
44
|
+
|
|
45
|
+
After any code change:
|
|
46
|
+
|
|
47
|
+
```powershell
|
|
48
|
+
.\.venv\Scripts\python.exe -m py_compile figtools.py
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
For behavior changes, extract at least one dense PDF and inspect a montage or
|
|
52
|
+
representative JPEGs. Look for:
|
|
53
|
+
|
|
54
|
+
- clipped axes, table borders, panel labels, or captions
|
|
55
|
+
- neighbor frame-line bleed
|
|
56
|
+
- page furniture, section headings, or fallback regions mixed into crops
|
|
57
|
+
- incomplete captions when `caption=include`
|
|
58
|
+
|
|
59
|
+
Known useful local PDFs on the development machine include:
|
|
60
|
+
|
|
61
|
+
- `C:\pf2\ye_p3.pdf`
|
|
62
|
+
- `C:\pf2\ye_full.pdf`
|
|
63
|
+
- `C:\pf2\attn.pdf`
|
|
64
|
+
- `C:\pf2\t_isscc.pdf`
|
|
65
|
+
- `C:\pf2\t_jssc.pdf`
|
|
66
|
+
- `C:\pf2\t_ncomm.pdf`
|
|
67
|
+
|
|
68
|
+
## Implementation Notes
|
|
69
|
+
|
|
70
|
+
- MinerU PP-DocLayoutV2 detects `image`, `chart`, and `table` regions.
|
|
71
|
+
- OpenVINO IR input is static 800x800, so edge mistakes are handled in trim
|
|
72
|
+
logic instead of increasing detector resolution.
|
|
73
|
+
- PDF text captions are read directly from `page.get_text("dict")`; figure
|
|
74
|
+
numbering and region-to-caption assignment are local logic.
|
|
75
|
+
- Default output is one whole-figure crop per `Fig.N`. Use `panels=true` only
|
|
76
|
+
when region-level output is desired.
|
|
77
|
+
- `caption=include` first trims the figure body, then unions it with a tight
|
|
78
|
+
caption text-ink rectangle from the same PDF text block. Long caption-adjacent
|
|
79
|
+
horizontal/vertical rules are ignored for the caption bbox.
|
|
80
|
+
- Always preserve user changes in the worktree. Avoid unrelated refactors.
|
|
81
|
+
|
|
82
|
+
## Commit Attribution
|
|
83
|
+
|
|
84
|
+
If Claude Code makes commits, keep its normal attribution conventions. If Codex
|
|
85
|
+
made the commit, include:
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
Co-authored-by: Codex <noreply@openai.com>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Do not add Codex attribution to Claude/user commits. If rewriting pushed
|
|
92
|
+
history, create a backup branch first, verify the tree diff is empty, and use
|
|
93
|
+
`git push --force-with-lease`, not plain `--force`.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# AI Connectors
|
|
2
|
+
|
|
3
|
+
figcrop can be exposed to AI tools in two practical ways:
|
|
4
|
+
|
|
5
|
+
1. **OpenAPI / REST** via the built-in FastAPI server.
|
|
6
|
+
2. **MCP** via the optional `figcrop_mcp.py` stdio server.
|
|
7
|
+
|
|
8
|
+
Use OpenAPI when an AI product wants an HTTP schema. Use MCP when Claude,
|
|
9
|
+
Codex, or another local agent can run a tool server on the same machine as the
|
|
10
|
+
PDF files.
|
|
11
|
+
|
|
12
|
+
## OpenAPI / REST
|
|
13
|
+
|
|
14
|
+
Start the server:
|
|
15
|
+
|
|
16
|
+
```powershell
|
|
17
|
+
.\.venv\Scripts\python.exe figtools.py serve auto
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Discovery endpoints:
|
|
21
|
+
|
|
22
|
+
- `GET http://127.0.0.1:8077/`
|
|
23
|
+
- `GET http://127.0.0.1:8077/openapi.json`
|
|
24
|
+
- `GET http://127.0.0.1:8077/health`
|
|
25
|
+
|
|
26
|
+
Extraction request:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
curl -s -X POST http://127.0.0.1:8077/extract \
|
|
30
|
+
-H "Content-Type: application/json" \
|
|
31
|
+
-d '{"pdf":"paper.pdf","out_dir":"out","figs":[1,2],"caption_mode":"include"}'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Important request fields:
|
|
35
|
+
|
|
36
|
+
- `pdf`: path to the input PDF on the machine running the server
|
|
37
|
+
- `out_dir`: output directory for JPEG crops and `figures.json`
|
|
38
|
+
- `figs`: optional real figure numbers
|
|
39
|
+
- `top`: optional positional fallback
|
|
40
|
+
- `panels`: output panels/regions separately
|
|
41
|
+
- `trim_mode`: `mask` or `whiteband`
|
|
42
|
+
- `caption_mode`: `exclude` or `include`
|
|
43
|
+
|
|
44
|
+
The server is local by default (`127.0.0.1`). Remote AI products cannot call it
|
|
45
|
+
unless you intentionally expose it through a secure tunnel or hosted deployment.
|
|
46
|
+
|
|
47
|
+
## MCP
|
|
48
|
+
|
|
49
|
+
If installed with pipx from GitHub, the MCP command is available directly:
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
pipx install git+https://github.com/tadalab-keio/figcrop.git
|
|
53
|
+
figcrop-mcp
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
For a source checkout created with `setup.ps1` / `setup.sh`, install the optional
|
|
57
|
+
MCP dependency:
|
|
58
|
+
|
|
59
|
+
```powershell
|
|
60
|
+
uv pip install --python .\.venv\Scripts\python.exe -r requirements-mcp.txt
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Run the MCP server:
|
|
64
|
+
|
|
65
|
+
```powershell
|
|
66
|
+
.\.venv\Scripts\python.exe figcrop_mcp.py
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The MCP tool is named `extract_figures` and accepts:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"pdf": "paper.pdf",
|
|
74
|
+
"out_dir": "out",
|
|
75
|
+
"figs": [1, 2],
|
|
76
|
+
"top": null,
|
|
77
|
+
"panels": false,
|
|
78
|
+
"trim_mode": "mask",
|
|
79
|
+
"caption_mode": "include",
|
|
80
|
+
"device": "auto"
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
It returns the output directory, crop count, `figures.json` path, and manifest
|
|
85
|
+
entries.
|
|
86
|
+
|
|
87
|
+
### Example Local MCP Config
|
|
88
|
+
|
|
89
|
+
Use absolute paths when configuring external clients:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"mcpServers": {
|
|
94
|
+
"figcrop": {
|
|
95
|
+
"command": "figcrop-mcp",
|
|
96
|
+
"args": []
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
If the client does not inherit the pipx command PATH, use the absolute path
|
|
103
|
+
printed by `pipx list` for `figcrop-mcp`.
|
|
104
|
+
|
|
105
|
+
Keep the server local unless you have a clear security model. PDFs and output
|
|
106
|
+
paths may contain private research material.
|
|
107
|
+
|
|
108
|
+
## AI-Side Verification
|
|
109
|
+
|
|
110
|
+
An AI agent should treat extraction as incomplete until it has inspected the
|
|
111
|
+
images. Recommended flow:
|
|
112
|
+
|
|
113
|
+
1. Run extraction.
|
|
114
|
+
2. Read `figures.json`.
|
|
115
|
+
3. Create or open a montage of JPEGs.
|
|
116
|
+
4. Check for clipped axes/captions and neighbor frame lines.
|
|
117
|
+
5. Retry with `figs=`, `top=`, `panels=true`, or `trim=whiteband` if needed.
|
figcrop-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
figcrop-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
figcrop
|
|
2
|
+
Copyright 2026 TadaLab (Keio University)
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0.
|
|
5
|
+
|
|
6
|
+
This product depends on and is built upon third-party software:
|
|
7
|
+
|
|
8
|
+
- MinerU (https://github.com/opendatalab/MinerU)
|
|
9
|
+
Licensed under the "MinerU Open Source License" (based on Apache 2.0 with
|
|
10
|
+
additional terms). figcrop uses MinerU's layout model (PP-DocLayoutV2) and
|
|
11
|
+
adapts a small portion of MinerU's detection post-processing logic and its
|
|
12
|
+
class-label list into figtools.py (the OpenVINO path). MinerU itself is not
|
|
13
|
+
redistributed here; it is installed as a dependency.
|
|
14
|
+
|
|
15
|
+
- OpenVINO (https://github.com/openvinotoolkit/openvino) — Apache License 2.0.
|
|
16
|
+
- PyMuPDF (https://github.com/pymupdf/PyMuPDF).
|
|
17
|
+
|
|
18
|
+
Model weights (PP-DocLayoutV2 etc.) are downloaded at runtime from Hugging Face
|
|
19
|
+
and are governed by their own licenses; they are not included in this repository.
|