Skip to content

Commit

Permalink
Merge pull request #2 from yjmm10/Docly
Browse files Browse the repository at this point in the history
rename project to "Docly"
  • Loading branch information
yjmm10 authored Aug 14, 2024
2 parents f2b1408 + 39089bf commit 8f9721a
Show file tree
Hide file tree
Showing 52 changed files with 197 additions and 209 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Telos CI/CD
name: Docly CI/CD

on:
push:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
run: |
git config --global credential.helper store
echo "https://USER:[email protected]" > ~/.git-credentials
git clone https://huggingface.co/liferecords/Telos.git telos/models
git clone https://huggingface.co/liferecords/Telos.git docly/models
- name: Run tests
run: |
tox -e py
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,6 @@ venv.bak/
**/*.local.yml
**/.secrets.yml

telos/models
docly/models
output-*
tests/output
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM python:3.10

LABEL name="Telos"
LABEL version="0.0.2"
LABEL description="🛠️ Component design with module-based functionality, allowing for on-demand feature acquisition,🚀 easy to expand, and flexible to use, just like playing with building blocks! | 🛠️ 组件化设计,让功能模块化,实现按需获取,🚀 易于扩展,使用起来灵活方便,就像搭积木一样简单!"
LABEL name="Docly"
LABEL version="0.0.3"
LABEL description="🛠️ Docly: A modular toolkit for intelligent document analysis and processing. Easy to expand and flexible to use, just like playing with building blocks!"

WORKDIR /app

Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
English | [中文](README_zh.md) | [日语]()
# Telos 🚀
# Docly 🚀

## 1. Overview 🌟

🛠️ Component design with module-based functionality, allowing for on-demand feature acquisition, 🚀 easy to expand, and flexible to use, just like playing with building blocks!

Telos is a modular component-based toolkit for document analysis and processing. It's designed with flexibility and extensibility in mind, making it easy to expand and use various document processing functionalities as needed.
Docly is a modular component-based toolkit for document analysis and processing. It's designed with flexibility and extensibility in mind, making it easy to expand and use various document processing functionalities as needed.

## 2. Features 🛠️

Expand All @@ -27,9 +27,9 @@ Telos is a modular component-based toolkit for document analysis and processing.

1. Clone the repository:
```bash
git clone https://github.com/yjmm10/telos.git
cd telos
git clone https://huggingface.co/liferecords/Telos.git telos/models
git clone https://github.com/yjmm10/docly.git
cd docly
git clone https://huggingface.co/liferecords/Telos.git docly/models
```

2. Install dependencies:
Expand All @@ -39,10 +39,10 @@ Telos is a modular component-based toolkit for document analysis and processing.

### 3.3 Usage

Here's a quick example of how to use Telos for OCR:
Here's a quick example of how to use Docly for OCR:

```python
from telos import OCR
from docly import OCR
import cv2

# Initialize the OCR model
Expand All @@ -57,7 +57,7 @@ result = ocr_model(image)
print(result)
```

Telos comes with a Streamlit-based web UI for easy demonstration of its capabilities:
Docly comes with a Streamlit-based web UI for easy demonstration of its capabilities:

1. Run the demo:
```bash
Expand All @@ -68,26 +68,26 @@ Telos comes with a Streamlit-based web UI for easy demonstration of its capabili

3. Upload an image and select the model you want to use for processing

Telos also provides a FastAPI-based API service for integration into other applications:
Docly also provides a FastAPI-based API service for integration into other applications:

1. Start the API server:
```bash
uvicorn api.telos_api:app --host 0.0.0.0 --port 8000
uvicorn api.docly_api:app --host 0.0.0.0 --port 8000
```

2. The API documentation will be available at http://localhost:8000/docs

## 4. Development 🔬

For detailed information on development, please refer to the [development guide](./docs/development.md). This guide will help you set up your IDE for working with Telos, including SRC Layout configuration.
For detailed information on development, please refer to the [development guide](./docs/development.md). This guide will help you set up your IDE for working with Docly, including SRC Layout configuration.

## 5. Contributing 🤝

We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for more details.

## 6. License 📄

Telos is released under the MIT License. See the [LICENSE](LICENSE) file for more details.
Docly is released under the MIT License. See the [LICENSE](LICENSE) file for more details.

## 7. Contact 📧

Expand Down
12 changes: 6 additions & 6 deletions README_zh.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[English](README.md) | 中文 | [日语]()

# Telos 🚀
# Docly 🚀

## 1. 概述 🌟

🛠️ 组件化设计,让功能模块化,实现按需获取,🚀 易于扩展,使用起来灵活方便,就像搭积木一样简单!

Telos 是一个基于模块化组件的文档分析和处理工具包。它的设计理念注重灵活性和可扩展性,使得各种文档处理功能的扩展和使用变得简单易行,可以根据需要随时添加新功能。
Docly 是一个基于模块化组件的文档分析和处理工具包。它的设计理念注重灵活性和可扩展性,使得各种文档处理功能的扩展和使用变得简单易行,可以根据需要随时添加新功能。

## 2. 功能特性 🛠️

Expand All @@ -28,9 +28,9 @@ Telos 是一个基于模块化组件的文档分析和处理工具包。它的

1. 克隆仓库:
```bash
git clone https://github.com/yjmm10/telos.git
cd telos
git clone https://huggingface.co/liferecords/Telos.git telos/models
git clone https://github.com/yjmm10/docly.git
cd docly
git clone https://huggingface.co/liferecords/Telos.git docly/models
```

2. 安装依赖:
Expand All @@ -44,7 +44,7 @@ Telos 是一个基于模块化组件的文档分析和处理工具包。它的

## 4. 开发 🔬

有关开发的详细信息,请参阅[开发指南](./docs/development.md)。该指南将帮助您设置 IDE 以使用 Telos,包括 SRC Layout 配置。
有关开发的详细信息,请参阅[开发指南](./docs/development.md)。该指南将帮助您设置 IDE 以使用 Docly,包括 SRC Layout 配置。

## 5. 贡献 🤝

Expand Down
62 changes: 31 additions & 31 deletions Telos_test.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import telos
from telos import YOLOv8
import docly
from docly import YOLOv8

print(telos.__version__)
# print(telos.check_source())
# result = telos.MetaFile(file_path="demo_1.png")
print(docly__version__)
# print(doclycheck_source())
# result = doclyMetaFile(file_path="demo_1.png")
# print(result)
# result = telos.MetaFile(file_path="test_img/PDF.pdf")
# result = doclyMetaFile(file_path="test_img/PDF.pdf")
# print(result)
# result = telos.MetaFile(file_path="test_img/SCAN.pdf")
# result = doclyMetaFile(file_path="test_img/SCAN.pdf")
# print(result)

# result = telos.CVModel("telos")
# result = doclyCVModel("docly")
# print(result)


Expand Down Expand Up @@ -49,14 +49,14 @@ def test_yolo():
def test_layout():
import cv2

from telos import Layout
from docly import Layout

model = Layout(conf_thres=0.3, iou_thres=0.5)
img = cv2.imread("test_img/page_p6.png")

# Detect Objects
result = model(img)
result_T = model._telos()
result_T = model._docly()
# print(result_T)

# Draw detections
Expand All @@ -67,15 +67,15 @@ def test_layout():
def test_formula():
import cv2

from telos import DetFormula
from docly import DetFormula

model = DetFormula(conf_thres=0.3, iou_thres=0.5)
img = cv2.imread("test_img/formula_page0.jpg")

# Detect Objects
result = model(img)
# print(result)
result_T = model._telos()
result_T = model._docly()
print(result_T)

# Draw detections
Expand All @@ -86,10 +86,10 @@ def test_formula():
def test_latexocr():
import cv2

from telos import LatexOCR
from docly import LatexOCR

engine = LatexOCR(
model_path="telos/models/recognition/rec_formula",
model_path="docly/models/recognition/rec_formula",
)
img = cv2.imread("/home/zyj/project/MOP/test_img/formula01.png")
result = engine(img)
Expand All @@ -99,7 +99,7 @@ def test_latexocr():

# # Detect Objects
# result= model(img)
# result_T = model._telos()
# result_T = model._docly()
# print(result_T)

# # Draw detections
Expand All @@ -110,7 +110,7 @@ def test_latexocr():
def test_dbnet():
import cv2

from telos import DBNet
from docly import DBNet

model_path = "detection/det_text.onnx"

Expand All @@ -128,9 +128,9 @@ def test_dbnet():
def test_crnnnet():
import cv2

from telos import CRNN
from docly import CRNN

model_path = "/home/zyj/project/MOP/telos/models/recognition/rec_text"
model_path = "/home/zyj/project/MOP/docly/models/recognition/rec_text"

# Initialize YOLOv8 object detector
model = CRNN(model_path="recognition/rec_text")
Expand All @@ -148,17 +148,17 @@ def test_crnnnet():
def test_OCR():
import cv2

from telos import OCR
from docly import OCR

# Initialize YOLOv8 object detector
model = OCR()
img = cv2.imread("/nas/projects/Github/Telos/tests/test_img/test_ocr.png")
img = cv2.imread("/nas/projects/Github/Docly/tests/test_img/test_ocr.png")
result = model(img)
print(result)
# res_telos = model._telos()
# res_docly = model._docly()
# print(model._json())
# print(result)
# print(res_telos)
# print(res_docly)

# # Draw detections
# combined_img = model.draw_detections(img,mask_alpha=0.2)
Expand All @@ -168,22 +168,22 @@ def test_OCR():
def test_OCR_wo_det():
import cv2

from telos import OCR
from docly import OCR

# Initialize YOLOv8 object detector
model = OCR()
img = cv2.imread("/nas/projects/Github/Telos/tests/test_img/test_crnnnet.png")
img = cv2.imread("/nas/projects/Github/Docly/tests/test_img/test_crnnnet.png")
result = model(img, use_det=False)

# TODO:可视化
res_telos = model._telos()
res_docly = model._docly()
print(model._json())


def test_reading_order():
import cv2

from telos import OCR, DBNet, Layout, ReadingOrder
from docly import OCR, DBNet, Layout, ReadingOrder

# Initialize YOLOv8 object detector
det = Layout(conf_thres=0.3, iou_thres=0.5)
Expand All @@ -204,7 +204,7 @@ def test_reading_order():
result = model(img, bboxs)
# print(model._json())
print(result)
# print(res_telos)
# print(res_docly)

# # Draw detections
# combined_img = model.draw_detections(img,mask_alpha=0.2)
Expand All @@ -214,17 +214,17 @@ def test_reading_order():
def test_Table():
import cv2

from telos import Table_TSR
from docly import Table_TSR

# Initialize YOLOv8 object detector
model = Table_TSR()
img = cv2.imread("/nas/projects/Github/Telos/tests/test_img/test_lore.jpg")
img = cv2.imread("/nas/projects/Github/Docly/tests/test_img/test_lore.jpg")
result = model(img)
print(result)
# res_telos = model._telos()
# res_docly = model._docly()
# print(model._json())
# print(result)
# print(res_telos)
# print(res_docly)

# # Draw detections
# combined_img = model.draw_detections(img,mask_alpha=0.2)
Expand Down
10 changes: 5 additions & 5 deletions api/telos_api.py → api/docly_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from fastapi import FastAPI, File, UploadFile
from fastapi.responses import FileResponse, JSONResponse

from telos import (CRNN, OCR, DBNet, DetFormula, LatexOCR, Layout,
from docly import (CRNN, OCR, DBNet, DetFormula, LatexOCR, Layout,
ReadingOrder, Table_TSR, YOLOv8)

app = FastAPI()
Expand Down Expand Up @@ -47,7 +47,7 @@ async def layout_endpoint(file: UploadFile = File(...)):

model = Layout(conf_thres=0.3, iou_thres=0.5)
result = model(img)
result_T = model._telos()
result_T = model._docly()

return JSONResponse(content={"result": result, "result_T": result_T})

Expand All @@ -60,7 +60,7 @@ async def formula_detection_endpoint(file: UploadFile = File(...)):

model = DetFormula(conf_thres=0.3, iou_thres=0.5)
result = model(img)
result_T = model._telos()
result_T = model._docly()

return JSONResponse(content={"result": result, "result_T": result_T})

Expand All @@ -71,7 +71,7 @@ async def latex_ocr_endpoint(file: UploadFile = File(...)):
nparr = np.fromstring(contents, np.uint8)
img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)

engine = LatexOCR(model_path="telos/models/recognition/rec_formula")
engine = LatexOCR(model_path="docly/models/recognition/rec_formula")
result = engine(img)

return JSONResponse(content={"result": result})
Expand Down Expand Up @@ -146,5 +146,5 @@ async def table_tsr_endpoint(file: UploadFile = File(...)):

# 定义你的模型路径和字典路径
uvicorn.run(
"telos_api:app", host="0.0.0.0", port=8000, reload=True, timeout_keep_alive=30
"docly_api:app", host="0.0.0.0", port=8000, reload=True, timeout_keep_alive=30
)
2 changes: 1 addition & 1 deletion demo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gradio as gr
import numpy as np

from telos import *
from docly import *


def dla(img, conf, iou, model):
Expand Down
Loading

0 comments on commit 8f9721a

Please sign in to comment.