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

@@ -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(),
)