-
Notifications
You must be signed in to change notification settings - Fork 967
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a42344
commit 6de0c19
Showing
12 changed files
with
840 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Python package | ||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
- name: Install python dependencies | ||
run: | | ||
pip install poetry | ||
poetry install | ||
poetry remove torch | ||
poetry run pip install torch --index-url https://download.pytorch.org/whl/cpu | ||
- name: Build package | ||
run: | | ||
poetry build | ||
- name: Publish package | ||
env: | ||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | ||
run: | | ||
poetry config pypi-token.pypi "$PYPI_TOKEN" | ||
poetry publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Integration test | ||
|
||
on: [push] | ||
|
||
env: | ||
TORCH_DEVICE: "cpu" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
- name: Install apt dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y tesseract-ocr tesseract-ocr-eng | ||
- name: Install python dependencies | ||
run: | | ||
pip install poetry | ||
poetry install | ||
poetry remove torch | ||
poetry run pip install torch --index-url https://download.pytorch.org/whl/cpu | ||
- name: Run benchmark test | ||
run: | | ||
poetry run python benchmark/detection.py --max 2 | ||
poetry run python scripts/verify_benchmark_scores.py results/benchmark/doclaynet_bench/results.json | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ test_data | |
training | ||
wandb | ||
notebooks | ||
results | ||
data | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "surya-ocr" | ||
version = "0.1.0" | ||
version = "0.1.2" | ||
description = "Document OCR models for multilingual text detection and recognition" | ||
authors = ["Vik Paruchuri <[email protected]>"] | ||
readme = "README.md" | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import json | ||
import argparse | ||
|
||
|
||
def verify_scores(file_path): | ||
with open(file_path, 'r') as file: | ||
data = json.load(file) | ||
|
||
scores = data["metrics"]["surya"] | ||
|
||
if scores["precision"] <= 0.9 or scores["recall"] <= 0.9: | ||
print(scores) | ||
raise ValueError("Scores do not meet the required threshold") | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Verify benchmark scores") | ||
parser.add_argument("file_path", type=str, help="Path to the json file") | ||
args = parser.parse_args() | ||
verify_scores(args.file_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters