feat: add glm ocr

This commit is contained in:
liuyuanchuang
2026-02-06 15:06:50 +08:00
parent c372a4afbe
commit f0ad0a4c77
5 changed files with 133 additions and 32 deletions

View File

@@ -27,6 +27,9 @@ class Settings(BaseSettings):
# MinerOCR Settings
miner_ocr_api_url: str = "http://127.0.0.1:8000/file_parse"
# GLM OCR Settings
glm_ocr_url: str = "http://127.0.0.1:8002/v1"
# Model Paths
pp_doclayout_model_dir: Optional[str] = "/home/yoge/.cache/modelscope/hub/models/PaddlePaddle/PP-DocLayoutV2"

View File

@@ -2,7 +2,7 @@
from app.services.image_processor import ImageProcessor
from app.services.layout_detector import LayoutDetector
from app.services.ocr_service import OCRService, MineruOCRService
from app.services.ocr_service import OCRService, MineruOCRService, GLMOCRService
from app.services.converter import Converter
from app.core.config import get_settings
@@ -57,3 +57,14 @@ def get_mineru_ocr_service() -> MineruOCRService:
image_processor=get_image_processor(),
paddleocr_vl_url=paddleocr_vl_url,
)
def get_glmocr_service() -> GLMOCRService:
"""Get a GLM OCR service instance."""
settings = get_settings()
glm_ocr_url = getattr(settings, "glm_ocr_url", "http://127.0.0.1:8002/v1")
return GLMOCRService(
vl_server_url=glm_ocr_url,
image_processor=get_image_processor(),
converter=get_converter(),
)