Skip to content

Commit e29ee9a

Browse files
committed
easyOCR based DocTR
0 parents  commit e29ee9a

12 files changed

+524
-0
lines changed

.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.git/
2+
.github/
3+
.gitignore
4+
.dockerignore
5+
Dockerfile
6+
Containerfile
7+
bin/
8+
build/
9+
*~
10+
**/*.pyc
11+
**/__pyche__
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "🗂 Add new issue to `apps` GHP"
2+
3+
on:
4+
issues:
5+
types:
6+
- opened
7+
- transferred
8+
pull_request_target:
9+
types:
10+
- opened
11+
12+
jobs:
13+
call-assign:
14+
name: "🤙 Call GHP workflow"
15+
uses: clamsproject/.github/.github/workflows/repo-issue-project.yml@main
16+
secrets: inherit
17+
with:
18+
projectnum: 12
19+

.github/workflows/issue-assign.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: "🙆 Assign issue"
2+
3+
on:
4+
create:
5+
6+
jobs:
7+
call-assign:
8+
if: github.ref_type == 'branch'
9+
name: "🤙 Call assignment workflow"
10+
uses: clamsproject/.github/.github/workflows/repo-issue-assign.yml@main
11+
secrets: inherit

.github/workflows/issue-close.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "🙅 Unassign assignees"
2+
3+
on:
4+
issues:
5+
types:
6+
- closed
7+
pull_request_target:
8+
types:
9+
- closed
10+
11+
jobs:
12+
call-unassign:
13+
name: "🤙 Call unassignment workflow"
14+
uses: clamsproject/.github/.github/workflows/repo-issue-close.yml@main
15+
secrets: inherit

.github/workflows/publish.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "📦 Publish image>ghcr, metadata>appdir"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
required: true
8+
type: string
9+
description: 'git tag to use to build an app image'
10+
push:
11+
tags:
12+
- '*'
13+
14+
jobs:
15+
set-version:
16+
runs-on: ubuntu-latest
17+
name: "🏷 Set version value"
18+
outputs:
19+
version: ${{ steps.output_version.outputs.version }}
20+
steps:
21+
- name: "📌 Set VERSION value from dispatch inputs"
22+
id: get_version_dispatch
23+
if: ${{ github.event_name == 'workflow_dispatch' }}
24+
run: echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
25+
- name: "📌 Set VERSION value from pushed tag"
26+
id: get_version_tag
27+
if: ${{ github.event_name == 'push' }}
28+
run: echo "VERSION=$(echo "${{ github.ref }}" | cut -d/ -f3)" >> $GITHUB_ENV
29+
- name: "🏷 Record VERSION for follow-up jobs"
30+
id: output_version
31+
run: |
32+
echo "version=${{ env.VERSION }}" >> $GITHUB_OUTPUT
33+
publish-image:
34+
needs: ['set-version']
35+
name: "🤙 Call app container workflow"
36+
uses: clamsproject/.github/.github/workflows/app-container.yml@main
37+
secrets: inherit
38+
with:
39+
version: ${{ needs.set-version.outputs.version }}
40+
arm64: false
41+
register-appdir:
42+
needs: ['set-version', 'publish-image']
43+
name: "🤙 Call app registration workflow"
44+
uses: clamsproject/apps/.github/workflows/register.yml@main
45+
secrets: inherit
46+
with:
47+
repo: ${{ github.repository }}
48+
tag: ${{ needs.set-version.outputs.version }}
49+
container: 'ghcr.io/${{ github.repository }}:${{ needs.set-version.outputs.version }}'
50+

.gitignore

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# linux
2+
.*.sw?
3+
*~
4+
.directory # KDE directory preferences
5+
.Trash-* # Linux trash folder which might appear on any partition or disk
6+
7+
# macos
8+
.DS_Store
9+
.AppleDouble
10+
.LSOverride
11+
Icon # Icon must end with two \r
12+
._* # Thumbnails
13+
.DocumentRevisions-V100 # Files that might appear in the root of a volume
14+
.fseventsd
15+
.Spotlight-V100
16+
.TemporaryItems
17+
.Trashes
18+
.VolumeIcon.icns
19+
.AppleDB # Directories potentially created on remote AFP share
20+
.AppleDesktop
21+
Network Trash Folder
22+
Temporary Items
23+
.apdisk
24+
25+
# windows
26+
Thumbs.db
27+
ehthumbs.db
28+
Desktop.ini
29+
$RECYCLE.BIN/
30+
*.cab # Windows Installer files
31+
*.msi
32+
*.msm
33+
*.msp
34+
*.lnk # Windows shortcuts
35+
36+
# idea
37+
.idea
38+
*.iml
39+
out
40+
gen
41+
42+
# sqlite
43+
*.db
44+
*.sqlite3
45+
46+
# java
47+
*.class
48+
.mtj.tmp/ # Mobile Tools for Java (J2ME)
49+
target/ # Package Files #
50+
*.jar
51+
*.war
52+
*.ear
53+
hs_err_pid* # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
54+
55+
# python byte-compiled / optimized / dll files
56+
__pycache__/
57+
*.py[cod]
58+
*$py.class
59+
60+
# C extensions
61+
*.so
62+
63+
# python Distribution / packaging
64+
.Python
65+
build/
66+
develop-eggs/
67+
dist/
68+
downloads/
69+
eggs/
70+
.eggs/
71+
lib/
72+
lib64/
73+
parts/
74+
sdist/
75+
var/
76+
wheels/
77+
pip-wheel-metadata/
78+
share/python-wheels/
79+
*.egg-info/
80+
.installed.cfg
81+
*.egg
82+
MANIFEST
83+
84+
# python Installer logs
85+
pip-log.txt
86+
pip-delete-this-directory.txt
87+
88+
# python Unit test / coverage reports
89+
htmlcov/
90+
.tox/
91+
.nox/
92+
.coverage
93+
.coverage.*
94+
.cache
95+
nosetests.xml
96+
coverage.xml
97+
*.cover
98+
*.py,cover
99+
.hypothesis/
100+
.pytest_cache/
101+
102+
# Sphinx documentation
103+
docs/_build/
104+
105+
# PyBuilder
106+
target/
107+
108+
# Jupyter Notebook
109+
.ipynb_checkpoints
110+
111+
# IPython
112+
profile_default/
113+
ipython_config.py
114+
115+
# pyenv
116+
.python-version
117+
118+
# pipenv
119+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
120+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
121+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
122+
# install all needed dependencies.
123+
#Pipfile.lock
124+
125+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
126+
__pypackages__/
127+
128+
# Celery stuff
129+
celerybeat-schedule
130+
celerybeat.pid
131+
132+
# SageMath parsed files
133+
*.sage.py
134+
135+
# Virtual Environments
136+
.env
137+
.venv
138+
env/
139+
venv/
140+
ENV/
141+
env.bak/
142+
venv.bak/
143+
144+
# Spyder project settings
145+
.spyderproject
146+
.spyproject
147+
148+
# Rope project settings
149+
.ropeproject
150+
151+
# mkdocs documentation
152+
/site
153+
154+
# mypy
155+
.mypy_cache/
156+
.dmypy.json
157+
dmypy.json
158+
159+
# Pyre type checker
160+
.pyre/
161+
162+
# ctag generated file
163+
tags
164+
.tags

Containerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Use the same base image version as the clams-python python library version
2+
FROM ghcr.io/clamsproject/clams-python:1.0.9
3+
# See https://github.com/orgs/clamsproject/packages?tab=packages&q=clams-python for more base images
4+
# IF you want to automatically publish this image to the clamsproject organization,
5+
# 1. you should have generated this template without --no-github-actions flag
6+
# 1. to add arm64 support, change relevant line in .github/workflows/container.yml
7+
# * NOTE that a lots of software doesn't install/compile or run on arm64 architecture out of the box
8+
# * make sure you locally test the compatibility of all software dependencies before using arm64 support
9+
# 1. use a git tag to trigger the github action. You need to use git tag to properly set app version anyway
10+
11+
################################################################################
12+
# DO NOT EDIT THIS SECTION
13+
ARG CLAMS_APP_VERSION
14+
ENV CLAMS_APP_VERSION ${CLAMS_APP_VERSION}
15+
################################################################################
16+
17+
################################################################################
18+
# clams-python base images are based on debian distro
19+
# install more system packages as needed using the apt manager
20+
################################################################################
21+
22+
################################################################################
23+
# main app installation
24+
COPY ./ /app
25+
WORKDIR /app
26+
RUN pip3 install -r requirements.txt
27+
28+
# default command to run the CLAMS app in a production server
29+
CMD ["python3", "app.py", "--production"]
30+
################################################################################

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Replace this file with the actual license information of the app

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# TO_DEVS: BURN AFTER READING
2+
3+
Delete this section of the document once the app development is done, before publishing the repository.
4+
5+
---
6+
This skeleton code is a scaffolding for Python-based CLAMS app development. Specifically, it contains
7+
8+
1. `app.py` and `metadata.py` to write the app
9+
1. `requirements.txt` to specify python dependencies
10+
1. `Containerfile` to containerize the app and specify system dependencies
11+
1. `.gitignore` and `.dockerignore` files listing commonly ignored files
12+
1. an empty `LICENSE` file to replace with an actual license information of the app
13+
1. `CLAMS-generic-readme.md` file with basic instructions of app installation and execution
14+
1. This `README.md` file for additional information not specified in the generic readme file.
15+
1. A number of GitHub Actions workflows for issue/bug-report management
16+
1. A GHA workflow to publish app images upon any push of a git tag
17+
* **NOTE**: All GHA workflows included are designed to only work in repositories under `clamsproject` organization.
18+
19+
Before pushing your first commit, please make sure to delete this section of the document.
20+
21+
Then use the following section to document any additional information specific to this app. If your app works significantly different from what's described in the generic readme file, be as specific as possible.
22+
23+
24+
> **warning**
25+
> TO_DEVS: Delete these `TO_DEVS` notes and warnings before publishing the repository.
26+
27+
---
28+
29+
# Doctr Wrapper
30+
31+
> **warning**
32+
> TO_DEVS: Again, delete these `TO_DEVS` notes and warnings before publishing the repository.
33+
34+
## Description
35+
36+
> **note**
37+
> TO_DEVS: A brief description of the app, expected behavior, underlying software/library/technology, etc.
38+
39+
## User instruction
40+
41+
General user instructions for CLAMS apps is available at [CLAMS Apps documentation](https://apps.clams.ai/clamsapp).
42+
43+
> **note**
44+
> TO_DEVS: Below is a list of additional information specific to this app.
45+
46+
47+
### System requirements
48+
49+
> **note**
50+
> TO_DEVS: Any system-level software required to run this app. Usually include some of the following:
51+
> * supported OS and CPU architectures
52+
> * usage of GPU
53+
> * system package names (e.g. `ffmpeg`, `libav`, `libopencv-dev`, etc.)
54+
> * some example code snippet to install them on Debian/Ubuntu (because our base images are based on Debian)
55+
> * e.g. `apt-get update && apt-get install -y <package-name>`
56+
57+
### Configurable runtime parameter
58+
59+
Although all CLAMS apps are supposed to run as *stateless* HTTP servers, some apps can configured at request time using [URL query strings](https://en.wikipedia.org/wiki/Query_string). For runtime parameter supported by this app, please visit [CLAMS App Directory](https://apps.clams.ai) and look for the app name and version.
60+
61+
> **warning**
62+
> TO_DEVS: If you're not developing this app for publishing on the CLAMS App Directory, the above paragraph is not applicable. Feel free to delete or change it.
63+
64+
> **note**
65+
> TO_DEVS: all runtime parameters are supported to be VERY METICULOUSLY documented in the app's `metadata.py` file. However for some reason, if you need to use this space to elaborate what's already documented in `metadata.py`, feel free to do so.

0 commit comments

Comments
 (0)